1
0
Fork 0

DBG+LAUNCHER: correctly handle mixed mode executables

fixes #1758
This commit is contained in:
Duncan Ogilvie 2017-10-13 23:38:32 +02:00
parent 8cf9f63bac
commit c9e17df1c0
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 6 additions and 1 deletions

View File

@ -68,6 +68,9 @@ static PeArch GetPeArch(const wchar_t* szFileName)
// environment based on the current platforms bitness (x86 or x64)
// Class libraries (DLLs) cannot specify the "Prefer 32 bit".
// https://mega.nz/#!vx5nVILR!jLafWGWhhsC0Qo5fE-3oEIc-uHBcRpraOo8L_KlUeXI
// Binaries that do not have COMIMAGE_FLAGS_ILONLY appear to be executed
// in a process that matches their native type.
// https://github.com/x64dbg/x64dbg/issues/1758
auto pcorh = PIMAGE_COR20_HEADER(ULONG_PTR(fileMap) + comAddr);
if(pcorh->cb == sizeof(IMAGE_COR20_HEADER))
@ -79,8 +82,10 @@ static PeArch GetPeArch(const wchar_t* szFileName)
{
if(test(COMIMAGE_FLAGS_32BITREQUIRED))
result = !isDll && test(MY_COMIMAGE_FLAGS_32BITPREFERRED) ? PeArch::DotnetAnyCpuPrefer32 : PeArch::Dotnet86;
else
else if(test(COMIMAGE_FLAGS_ILONLY))
result = PeArch::DotnetAnyCpu;
else
result = PeArch::Dotnet86;
}
else // x64
result = PeArch::Dotnet64;