От: | Tom | http://www.RSDN.ru | |
Дата: | 23.08.05 09:57 | ||
Оценка: |
SL>The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before calling SymGetLineFromAddr64.
SL>The caller must allocate the Symbol buffer properly and fill in the required parameters in the IMAGEHLP_SYMBOL64 structure before calling SymGetSymFromAddr64.
DWORD dwAddress;
DWORD dwDisplacement;
BYTE buffer[256];
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = sizeof(buffer) - sizeof(SYMBOL_INFO) + 1;
if (SymFromAddr(hProcess, dwAddress, &dwDisplacement, pSymbol))
{
// SymFromAddr returned success
}
else
{
// SymFromAddr failed
error = GetLastError();
printf("SymFromAddr returned error : %d\n", error);
}
DWORD64 dwAddress;
DWORD dwDisplacement;
IMAGEHLP_LINE64 line;
SymSetOptions(SYMOPT_LOAD_LINES);
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
if (SymGetLineFromAddr64(hProcess, dwAddress, &dwDisplacement, &line))
{
// SymGetLineFromAddr64 returned success
}
else
{
// SymGetLineFromAddr64 failed
error = GetLastError();
printf("SymGetLineFromAddr64 returned error : %d\n", error);
}