dbghelp: Rewrote the SymRegisterCallback function so that they work on a 64bit platform.

This commit is contained in:
Eric Pouech 2009-12-12 12:18:34 +01:00 committed by Alexandre Julliard
parent b037912c9d
commit 114bb38cd8
2 changed files with 11 additions and 10 deletions

View File

@ -461,8 +461,7 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
*/ */
static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, ULONG64 user) static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, ULONG64 user)
{ {
PSYMBOL_REGISTERED_CALLBACK cb32 = (PSYMBOL_REGISTERED_CALLBACK)(DWORD)(user >> 32); struct process* pcs = process_find_by_handle(hProcess);
DWORD user32 = (DWORD)user;
void* data32; void* data32;
IMAGEHLP_DEFERRED_SYMBOL_LOAD64* idsl64; IMAGEHLP_DEFERRED_SYMBOL_LOAD64* idsl64;
IMAGEHLP_DEFERRED_SYMBOL_LOAD idsl; IMAGEHLP_DEFERRED_SYMBOL_LOAD idsl;
@ -473,7 +472,7 @@ static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, U
case CBA_DEFERRED_SYMBOL_LOAD_CANCEL: case CBA_DEFERRED_SYMBOL_LOAD_CANCEL:
case CBA_SET_OPTIONS: case CBA_SET_OPTIONS:
case CBA_SYMBOLS_UNLOADED: case CBA_SYMBOLS_UNLOADED:
data32 = (void*)(DWORD)data; data32 = (void*)(DWORD_PTR)data;
break; break;
case CBA_DEFERRED_SYMBOL_LOAD_COMPLETE: case CBA_DEFERRED_SYMBOL_LOAD_COMPLETE:
case CBA_DEFERRED_SYMBOL_LOAD_FAILURE: case CBA_DEFERRED_SYMBOL_LOAD_FAILURE:
@ -497,7 +496,7 @@ static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, U
FIXME("No mapping for action %u\n", action); FIXME("No mapping for action %u\n", action);
return FALSE; return FALSE;
} }
return cb32(hProcess, action, data32, (PVOID)user32); return pcs->reg_cb32(hProcess, action, data32, (PVOID)(DWORD_PTR)user);
} }
/****************************************************************** /******************************************************************
@ -552,12 +551,14 @@ BOOL pcs_callback(const struct process* pcs, ULONG action, void* data)
*/ */
static BOOL sym_register_cb(HANDLE hProcess, static BOOL sym_register_cb(HANDLE hProcess,
PSYMBOL_REGISTERED_CALLBACK64 cb, PSYMBOL_REGISTERED_CALLBACK64 cb,
PSYMBOL_REGISTERED_CALLBACK cb32,
DWORD64 user, BOOL unicode) DWORD64 user, BOOL unicode)
{ {
struct process* pcs = process_find_by_handle(hProcess); struct process* pcs = process_find_by_handle(hProcess);
if (!pcs) return FALSE; if (!pcs) return FALSE;
pcs->reg_cb = cb; pcs->reg_cb = cb;
pcs->reg_cb32 = cb32;
pcs->reg_is_unicode = unicode; pcs->reg_is_unicode = unicode;
pcs->reg_user = user; pcs->reg_user = user;
@ -571,10 +572,9 @@ BOOL WINAPI SymRegisterCallback(HANDLE hProcess,
PSYMBOL_REGISTERED_CALLBACK CallbackFunction, PSYMBOL_REGISTERED_CALLBACK CallbackFunction,
PVOID UserContext) PVOID UserContext)
{ {
DWORD64 tmp = ((ULONGLONG)(DWORD)CallbackFunction << 32) | (DWORD)UserContext;
TRACE("(%p, %p, %p)\n", TRACE("(%p, %p, %p)\n",
hProcess, CallbackFunction, UserContext); hProcess, CallbackFunction, UserContext);
return sym_register_cb(hProcess, reg_cb64to32, tmp, FALSE); return sym_register_cb(hProcess, reg_cb64to32, CallbackFunction, (DWORD_PTR)UserContext, FALSE);
} }
/*********************************************************************** /***********************************************************************
@ -586,7 +586,7 @@ BOOL WINAPI SymRegisterCallback64(HANDLE hProcess,
{ {
TRACE("(%p, %p, %s)\n", TRACE("(%p, %p, %s)\n",
hProcess, CallbackFunction, wine_dbgstr_longlong(UserContext)); hProcess, CallbackFunction, wine_dbgstr_longlong(UserContext));
return sym_register_cb(hProcess, CallbackFunction, UserContext, FALSE); return sym_register_cb(hProcess, CallbackFunction, NULL, UserContext, FALSE);
} }
/*********************************************************************** /***********************************************************************
@ -598,7 +598,7 @@ BOOL WINAPI SymRegisterCallbackW64(HANDLE hProcess,
{ {
TRACE("(%p, %p, %s)\n", TRACE("(%p, %p, %s)\n",
hProcess, CallbackFunction, wine_dbgstr_longlong(UserContext)); hProcess, CallbackFunction, wine_dbgstr_longlong(UserContext));
return sym_register_cb(hProcess, CallbackFunction, UserContext, TRUE); return sym_register_cb(hProcess, CallbackFunction, NULL, UserContext, TRUE);
} }
/* This is imagehlp version not dbghelp !! */ /* This is imagehlp version not dbghelp !! */

View File

@ -363,6 +363,7 @@ struct process
WCHAR* search_path; WCHAR* search_path;
PSYMBOL_REGISTERED_CALLBACK64 reg_cb; PSYMBOL_REGISTERED_CALLBACK64 reg_cb;
PSYMBOL_REGISTERED_CALLBACK reg_cb32;
BOOL reg_is_unicode; BOOL reg_is_unicode;
DWORD64 reg_user; DWORD64 reg_user;