From c9e17df1c01e758e12ceb3cfd21c3f5b6bc516da Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Fri, 13 Oct 2017 23:38:32 +0200 Subject: [PATCH] DBG+LAUNCHER: correctly handle mixed mode executables fixes #1758 --- src/dbg/GetPeArch.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dbg/GetPeArch.h b/src/dbg/GetPeArch.h index 0d85b606..e2ec5c80 100644 --- a/src/dbg/GetPeArch.h +++ b/src/dbg/GetPeArch.h @@ -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;