Eric Pouech eric.pouech@wanadoo.fr writes:
- hFile = CreateFileW(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
- if (hFile != INVALID_HANDLE_VALUE)
- {
hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hMap != INVALID_HANDLE_VALUE)
{
CreateFileMapping returns 0 on error.
base = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
if (base)
{
HANDLE hModule = (HMODULE)(ULONG_PTR)base;
if (RtlImageNtHeader(hModule)) /* we got a PE file */
{
if (first)
{
LPWSTR manifestfile;
manifestfile = HeapAlloc(GetProcessHeap(), 0,
lstrlenW(name) * sizeof(WCHAR) + sizeof(dotManifestW));
if (manifestfile)
{
strcpyW(manifestfile, name);
strcatW(manifestfile, dotManifestW);
ret = get_manifest_in_file(acl, ai, manifestfile,
resname, FALSE);
HeapFree(GetProcessHeap(), 0, manifestfile);
}
}
if (ret) ret = get_manifest_in_module(acl, ai, hModule, resname);
You cannot pretend that a file mapping is a module and call resource functions on it. You have to use LOAD_LIBRARY_AS_DATAFILE for that.
I don't think this patch series is quite ready to go in; this is the third resend and all patches still have obvious bugs. You need to spend more time on it, this is kernel stuff, it needs to be correct.