dbghelp: Implemented SymRegisterCallbackW64 and 64 -> 64W mapping function.

This commit is contained in:
Eric Pouech 2006-05-10 21:35:11 +02:00 committed by Alexandre Julliard
parent 2e7d3c386a
commit 4a80e63a29
4 changed files with 84 additions and 8 deletions

View File

@ -479,10 +479,64 @@ static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, U
BOOL pcs_callback(const struct process* pcs, ULONG action, void* data)
{
TRACE("%p %lu %p\n", pcs, action, data);
if (!pcs->reg_cb) return FALSE;
if (pcs->reg_is_unicode)
{
IMAGEHLP_DEFERRED_SYMBOL_LOAD64* idsl;
IMAGEHLP_DEFERRED_SYMBOL_LOADW64 idslW;
switch (action)
{
case CBA_DEBUG_INFO:
case CBA_DEFERRED_SYMBOL_LOAD_CANCEL:
case CBA_SET_OPTIONS:
case CBA_SYMBOLS_UNLOADED:
break;
case CBA_DEFERRED_SYMBOL_LOAD_COMPLETE:
case CBA_DEFERRED_SYMBOL_LOAD_FAILURE:
case CBA_DEFERRED_SYMBOL_LOAD_PARTIAL:
case CBA_DEFERRED_SYMBOL_LOAD_START:
idsl = (IMAGEHLP_DEFERRED_SYMBOL_LOAD64*)(DWORD)data;
idslW.SizeOfStruct = sizeof(idslW);
idslW.BaseOfImage = idsl->BaseOfImage;
idslW.CheckSum = idsl->CheckSum;
idslW.TimeDateStamp = idsl->TimeDateStamp;
MultiByteToWideChar(CP_ACP, 0, idsl->FileName, -1,
idslW.FileName, sizeof(idslW.FileName) / sizeof(WCHAR));
idslW.Reparse = idsl->Reparse;
data = &idslW;
break;
case CBA_DUPLICATE_SYMBOL:
case CBA_EVENT:
case CBA_READ_MEMORY:
default:
FIXME("No mapping for action %lu\n", action);
return FALSE;
}
}
return pcs->reg_cb(pcs->handle, action, (ULONG64)(DWORD_PTR)data, pcs->reg_user);
}
/******************************************************************
* sym_register_cb
*
* Helper for registering a callback.
*/
static BOOL sym_register_cb(HANDLE hProcess,
PSYMBOL_REGISTERED_CALLBACK64 cb,
DWORD64 user, BOOL unicode)
{
struct process* pcs = process_find_by_handle(hProcess);
if (!pcs) return FALSE;
pcs->reg_cb = cb;
pcs->reg_is_unicode = unicode;
pcs->reg_user = user;
return TRUE;
}
/***********************************************************************
* SymRegisterCallback (DBGHELP.@)
*/
@ -491,7 +545,9 @@ BOOL WINAPI SymRegisterCallback(HANDLE hProcess,
PVOID UserContext)
{
DWORD64 tmp = ((ULONGLONG)(DWORD)CallbackFunction << 32) | (DWORD)UserContext;
return SymRegisterCallback64(hProcess, reg_cb64to32, tmp);
TRACE("(%p, %p, %p)\n",
hProcess, CallbackFunction, UserContext);
return sym_register_cb(hProcess, reg_cb64to32, tmp, FALSE);
}
/***********************************************************************
@ -501,15 +557,21 @@ BOOL WINAPI SymRegisterCallback64(HANDLE hProcess,
PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction,
ULONG64 UserContext)
{
struct process* pcs = process_find_by_handle(hProcess);
TRACE("(%p, %p, %s)\n",
hProcess, CallbackFunction, wine_dbgstr_longlong(UserContext));
if (!pcs) return FALSE;
pcs->reg_cb = CallbackFunction;
pcs->reg_user = UserContext;
return sym_register_cb(hProcess, CallbackFunction, UserContext, FALSE);
}
return TRUE;
/***********************************************************************
* SymRegisterCallbackW64 (DBGHELP.@)
*/
BOOL WINAPI SymRegisterCallbackW64(HANDLE hProcess,
PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction,
ULONG64 UserContext)
{
TRACE("(%p, %p, %s)\n",
hProcess, CallbackFunction, wine_dbgstr_longlong(UserContext));
return sym_register_cb(hProcess, CallbackFunction, UserContext, TRUE);
}
/* This is imagehlp version not dbghelp !! */

View File

@ -130,7 +130,7 @@
@ stub SymRefreshModuleList
@ stdcall SymRegisterCallback(long ptr ptr)
@ stdcall SymRegisterCallback64(long ptr double)
@ stub SymRegisterCallbackW64
@ stdcall SymRegisterCallbackW64(long ptr double)
@ stdcall SymRegisterFunctionEntryCallback(ptr ptr ptr)
@ stdcall SymRegisterFunctionEntryCallback64(ptr ptr double)
@ stdcall SymSearch(long double long long str double ptr ptr long)

View File

@ -294,6 +294,7 @@ struct process
WCHAR* search_path;
PSYMBOL_REGISTERED_CALLBACK64 reg_cb;
BOOL reg_is_unicode;
DWORD64 reg_user;
struct module* lmodules;

View File

@ -287,6 +287,18 @@ typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
DWORD Flags;
} IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64
{
DWORD SizeOfStruct;
DWORD64 BaseOfImage;
DWORD CheckSum;
DWORD TimeDateStamp;
WCHAR FileName[MAX_PATH + 1];
BOOLEAN Reparse;
HANDLE hFile;
DWORD Flags;
} IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
{
DWORD SizeOfStruct;
@ -889,6 +901,7 @@ typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID
BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE, ULONG, ULONG64, ULONG64);
BOOL WINAPI SymRegisterCallback64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
BOOL WINAPI SymRegisterCallbackW64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
BOOL WINAPI SymUnDName64(PIMAGEHLP_SYMBOL64, PSTR, DWORD);
DWORD WINAPI UnDecorateSymbolName(LPCSTR, LPSTR, DWORD, DWORD);