[DBGHELP_APITEST] Skip more tests on 2k3's dbghelp.dll

This commit is contained in:
Mark Jansen 2023-01-31 16:26:21 +01:00 committed by Timo Kreuzer
parent 3bf4ef6fec
commit eeaddf5bbc

View file

@ -310,92 +310,93 @@ static void test_SymFromAddr(HANDLE hProc, DWORD64 BaseAddress)
DWORD64 Displacement; DWORD64 Displacement;
DWORD dwErr; DWORD dwErr;
/* No address found before load address of module */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress -1, &Displacement, pSymbol);
dwErr = GetLastError();
ok_int(Ret, FALSE);
ok_hex(dwErr, ERROR_MOD_NOT_FOUND);
/* Right at the start of the module is recognized as the first symbol found */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0xffffffffffffffff);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* The actual first instruction of the function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x1010, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* The last instruction in the function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x102D, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0x1d);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* The padding below the function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x102E, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0x1e);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* One byte before the next function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x103f, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0x2f);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* First byte of the next function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x1040, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1040);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "FfsChkdsk");
if (!supports_pdb(hProc, BaseAddress)) if (!supports_pdb(hProc, BaseAddress))
{ {
skip("dbghelp.dll too old or cannot read this symbol!\n"); skip("dbghelp.dll too old or cannot enumerate symbols!\n");
} }
else else
{ {
/* No address found before load address of module */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress -1, &Displacement, pSymbol);
dwErr = GetLastError();
ok_int(Ret, FALSE);
ok_hex(dwErr, ERROR_MOD_NOT_FOUND);
/* Right at the start of the module is recognized as the first symbol found */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0xffffffffffffffff);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* The actual first instruction of the function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x1010, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* The last instruction in the function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x102D, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0x1d);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* The padding below the function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x102E, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0x1e);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* One byte before the next function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x103f, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0x2f);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1010);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "DllMain");
/* First byte of the next function */
Displacement = 0;
INIT_PSYM(buffer);
Ret = SymFromAddr(hProc, BaseAddress + 0x1040, &Displacement, pSymbol);
ok_int(Ret, TRUE);
ok_ulonglong(Displacement, 0);
ok_ulonglong(pSymbol->ModBase, BaseAddress);
ok_hex(pSymbol->Flags, 0);
ok_ulonglong(pSymbol->Address, BaseAddress + 0x1040);
ok_hex(pSymbol->Tag, SymTagFunction);
ok_str(pSymbol->Name, "FfsChkdsk");
/* .idata */ /* .idata */
Displacement = 0; Displacement = 0;
INIT_PSYM(buffer); INIT_PSYM(buffer);