Hi guys,

using the below code i'm trying to insert resource to external exe.
The problem is, that when i trying to extract the resource FindResource() fail, claiming that there is no resource in that name.
But, the weird part is that using EnumResourceNames() i do find that resource.

any ideas what may cause this?

Code:
		HANDLE hUpdateRes = ::BeginUpdateResource(
			szDest,
			TRUE);

	HANDLE hFile=CreateFile(szExePath,
		GENERIC_READ,
		NULL,
		NULL,
		OPEN_EXISTING,
		FILE_ATTRIBUTE_NORMAL,
		NULL);
	
	if(hFile==INVALID_HANDLE_VALUE)
	{

		return 0;
	}

	DWORD dwSize;	
	dwSize=GetFileSize(hFile,NULL);
	
	char *szData=new char[dwSize+1];
	DWORD dwReaden;

	ReadFile(hFile,(LPVOID)szData,dwSize,&dwReaden,NULL);

		if(NULL == hUpdateRes)
		{
			// ERROR: 
			return false;
		}

		bool bRes = false;

		if(0 == ::UpdateResource(
			hUpdateRes,	// update resource handle 
			RT_RCDATA,	// type
			szHijackedResName,	// name
			MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),  // language
			szData,		// ptr to resource info 
			dwReaden)) // size of resource info. 
		{
			DWORD dwErr = ::GetLastError();
			// ERROR: Could not add resource
	
		}	

		if(0 != (::EndUpdateResource(hUpdateRes, FALSE)))
		{
			bRes = true;
		}

thanks in advance for any further help.