Skip to content

Commit ce9abcf

Browse files
authored
Minor fixes in symtest example (microsoft#167)
Fixed invocations of `SymGetModuleInfo64` and `SymEnumSymbols` Tested on x64 only. Output snippets from `symtest.exe` before fix: SymGetModuleInfo64(FFFFFFFFFFFFFFFF, 000000006EBC0000) [64] failed: 87 and ===Enum=== SymEnumSymbols() failed: 318 Output snippets from `symtest.exe` after fix: SymGetModuleInfo64(FFFFFFFFFFFFFFFF, 000000006EBC0000) [64] succeeded: 0 NumSyms: 0 SymType: 3 ModuleName: target64 ImageName: target64.dll LoadedImageName: target64.dll and ===Enum=== 000000006EBD4A60: __newclmap 000000006EBD4A60: __newclmap 000000006EBD2238: __guard_xfg_dispatch_icall_fptr 000000006EBDDA40: _fltused 000000006EBD8AC0: __mask_mant 000000006EBDD000: SelfHidden 000000006EBC1000: Target 000000006EBC1060: Hidden
1 parent 99ac5f9 commit ce9abcf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/findfunc/symtest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ int __cdecl main(void)
283283

284284
IMAGEHLP_MODULE64 modinfo;
285285
ZeroMemory(&modinfo, sizeof(modinfo));
286-
modinfo.SizeOfStruct = 512/*sizeof(modinfo)*/;
286+
modinfo.SizeOfStruct = sizeof(modinfo);
287287
if (!pfSymGetModuleInfo64(hProcess, (DWORD64)hModule, &modinfo)) {
288288
printf("SymGetModuleInfo64(%p, %p) [64] failed: %ld\n",
289289
hProcess, hModule, GetLastError());
@@ -318,7 +318,7 @@ int __cdecl main(void)
318318
printf("===Enum===\n");
319319
SetLastError(0);
320320
nSymbolCount = 0;
321-
if (!pfSymEnumSymbols(hProcess, (DWORD64)hModule, NULL, SymEnumerateSymbols, NULL)) {
321+
if (!pfSymEnumSymbols(hProcess, loaded, NULL, SymEnumerateSymbols, NULL)) {
322322
printf("SymEnumSymbols() failed: %ld\n",
323323
GetLastError());
324324
}

0 commit comments

Comments
 (0)