Commit 8aea0395 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp/tests: Introduce get_machine_bitness() helper.

parent 160d961e
...@@ -206,6 +206,23 @@ static BOOL ends_withW(const WCHAR* str, const WCHAR* suffix) ...@@ -206,6 +206,23 @@ static BOOL ends_withW(const WCHAR* str, const WCHAR* suffix)
return strlen >= sfxlen && !wcsicmp(str + strlen - sfxlen, suffix); return strlen >= sfxlen && !wcsicmp(str + strlen - sfxlen, suffix);
} }
static unsigned get_machine_bitness(USHORT machine)
{
switch (machine)
{
case IMAGE_FILE_MACHINE_I386:
case IMAGE_FILE_MACHINE_ARM:
case IMAGE_FILE_MACHINE_ARMNT:
return 32;
case IMAGE_FILE_MACHINE_AMD64:
case IMAGE_FILE_MACHINE_ARM64:
return 64;
default:
ok(0, "Unsupported machine %x\n", machine);
return 0;
}
}
static USHORT get_module_machine(const char* path) static USHORT get_module_machine(const char* path)
{ {
HANDLE hFile, hMap; HANDLE hFile, hMap;
...@@ -570,22 +587,11 @@ static BOOL CALLBACK aggregate_cb(PCWSTR imagename, DWORD64 base, ULONG sz, PVOI ...@@ -570,22 +587,11 @@ static BOOL CALLBACK aggregate_cb(PCWSTR imagename, DWORD64 base, ULONG sz, PVOI
ok(ret, "SymGetModuleInfoW64 failed: %lu\n", GetLastError()); ok(ret, "SymGetModuleInfoW64 failed: %lu\n", GetLastError());
} }
switch (im.MachineType) switch (get_machine_bitness(im.MachineType))
{ {
case IMAGE_FILE_MACHINE_UNKNOWN: case 32: aggregation->count_32bit++; break;
break; case 64: aggregation->count_64bit++; break;
case IMAGE_FILE_MACHINE_I386: default: break;
case IMAGE_FILE_MACHINE_ARM:
case IMAGE_FILE_MACHINE_ARMNT:
aggregation->count_32bit++;
break;
case IMAGE_FILE_MACHINE_AMD64:
case IMAGE_FILE_MACHINE_ARM64:
aggregation->count_64bit++;
break;
default:
ok(0, "Unsupported machine %lx\n", im.MachineType);
break;
} }
if (ends_withW(imagename, L".exe")) if (ends_withW(imagename, L".exe"))
aggregation->count_exe++; aggregation->count_exe++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment