fusion: Fix the 32/64 PE image format check on 64-bit platforms.

This commit is contained in:
Alexandre Julliard 2009-04-08 12:06:35 +02:00
parent bbe70550fe
commit e2aefee80e
1 changed files with 6 additions and 2 deletions

View File

@ -631,14 +631,18 @@ static HRESULT parse_pe_header(ASSEMBLY *assembly)
if (!assembly->nthdr) if (!assembly->nthdr)
return E_FAIL; return E_FAIL;
if (assembly->nthdr->FileHeader.Machine == IMAGE_FILE_MACHINE_AMD64) if (assembly->nthdr->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
{ {
IMAGE_OPTIONAL_HEADER64 *opthdr = IMAGE_OPTIONAL_HEADER64 *opthdr =
(IMAGE_OPTIONAL_HEADER64 *)&assembly->nthdr->OptionalHeader; (IMAGE_OPTIONAL_HEADER64 *)&assembly->nthdr->OptionalHeader;
datadirs = opthdr->DataDirectory; datadirs = opthdr->DataDirectory;
} }
else else
datadirs = assembly->nthdr->OptionalHeader.DataDirectory; {
IMAGE_OPTIONAL_HEADER32 *opthdr =
(IMAGE_OPTIONAL_HEADER32 *)&assembly->nthdr->OptionalHeader;
datadirs = opthdr->DataDirectory;
}
if (!datadirs) if (!datadirs)
return E_FAIL; return E_FAIL;