Commit b037912c authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Fix a couple of casts on 64bit platforms.

parent c300f215
...@@ -479,7 +479,7 @@ static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, U ...@@ -479,7 +479,7 @@ static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, U
case CBA_DEFERRED_SYMBOL_LOAD_FAILURE: case CBA_DEFERRED_SYMBOL_LOAD_FAILURE:
case CBA_DEFERRED_SYMBOL_LOAD_PARTIAL: case CBA_DEFERRED_SYMBOL_LOAD_PARTIAL:
case CBA_DEFERRED_SYMBOL_LOAD_START: case CBA_DEFERRED_SYMBOL_LOAD_START:
idsl64 = (IMAGEHLP_DEFERRED_SYMBOL_LOAD64*)(DWORD)data; idsl64 = (IMAGEHLP_DEFERRED_SYMBOL_LOAD64*)(DWORD_PTR)data;
if (!validate_addr64(idsl64->BaseOfImage)) if (!validate_addr64(idsl64->BaseOfImage))
return FALSE; return FALSE;
idsl.SizeOfStruct = sizeof(idsl); idsl.SizeOfStruct = sizeof(idsl);
......
...@@ -498,7 +498,7 @@ extern BOOL path_find_symbol_file(const struct process* pcs, PCSTR full_ ...@@ -498,7 +498,7 @@ extern BOOL path_find_symbol_file(const struct process* pcs, PCSTR full_
BOOL* is_unmatched); BOOL* is_unmatched);
/* pe_module.c */ /* pe_module.c */
extern BOOL pe_load_nt_header(HANDLE hProc, DWORD base, IMAGE_NT_HEADERS* nth); extern BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS* nth);
extern struct module* extern struct module*
pe_load_native_module(struct process* pcs, const WCHAR* name, pe_load_native_module(struct process* pcs, const WCHAR* name,
HANDLE hFile, DWORD base, DWORD size); HANDLE hFile, DWORD base, DWORD size);
......
...@@ -654,7 +654,7 @@ static enum location_error ...@@ -654,7 +654,7 @@ static enum location_error
compute_location(dwarf2_traverse_context_t* ctx, struct location* loc, compute_location(dwarf2_traverse_context_t* ctx, struct location* loc,
HANDLE hproc, const struct location* frame) HANDLE hproc, const struct location* frame)
{ {
unsigned long stack[64]; DWORD_PTR stack[64];
unsigned stk; unsigned stk;
unsigned char op; unsigned char op;
BOOL piece_found = FALSE; BOOL piece_found = FALSE;
...@@ -767,12 +767,12 @@ compute_location(dwarf2_traverse_context_t* ctx, struct location* loc, ...@@ -767,12 +767,12 @@ compute_location(dwarf2_traverse_context_t* ctx, struct location* loc,
} }
if (hproc) if (hproc)
{ {
DWORD addr = stack[stk--]; DWORD_PTR addr = stack[stk--];
DWORD deref; DWORD_PTR deref;
if (!ReadProcessMemory(hproc, (void*)addr, &deref, sizeof(deref), NULL)) if (!ReadProcessMemory(hproc, (void*)addr, &deref, sizeof(deref), NULL))
{ {
WARN("Couldn't read memory at %x\n", addr); WARN("Couldn't read memory at %lx\n", addr);
return loc_err_cant_read; return loc_err_cant_read;
} }
stack[++stk] = deref; stack[++stk] = deref;
......
...@@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); ...@@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
struct dump_memory struct dump_memory
{ {
ULONG base; ULONG64 base;
ULONG size; ULONG size;
ULONG rva; ULONG rva;
}; };
...@@ -42,7 +42,7 @@ struct dump_memory ...@@ -42,7 +42,7 @@ struct dump_memory
struct dump_module struct dump_module
{ {
unsigned is_elf; unsigned is_elf;
ULONG base; ULONG64 base;
ULONG size; ULONG size;
DWORD timestamp; DWORD timestamp;
DWORD checksum; DWORD checksum;
...@@ -251,7 +251,7 @@ static BOOL fetch_thread_info(struct dump_context* dc, int thd_idx, ...@@ -251,7 +251,7 @@ static BOOL fetch_thread_info(struct dump_context* dc, int thd_idx,
* Add a module to a dump context * Add a module to a dump context
*/ */
static BOOL add_module(struct dump_context* dc, const WCHAR* name, static BOOL add_module(struct dump_context* dc, const WCHAR* name,
DWORD base, DWORD size, DWORD timestamp, DWORD checksum, DWORD64 base, DWORD size, DWORD timestamp, DWORD checksum,
BOOL is_elf) BOOL is_elf)
{ {
if (!dc->modules) if (!dc->modules)
...@@ -272,7 +272,7 @@ static BOOL add_module(struct dump_context* dc, const WCHAR* name, ...@@ -272,7 +272,7 @@ static BOOL add_module(struct dump_context* dc, const WCHAR* name,
return FALSE; return FALSE;
} }
if (is_elf || if (is_elf ||
!GetModuleFileNameExW(dc->hProcess, (HMODULE)base, !GetModuleFileNameExW(dc->hProcess, (HMODULE)(DWORD_PTR)base,
dc->modules[dc->num_modules].name, dc->modules[dc->num_modules].name,
sizeof(dc->modules[dc->num_modules].name) / sizeof(WCHAR))) sizeof(dc->modules[dc->num_modules].name) / sizeof(WCHAR)))
lstrcpynW(dc->modules[dc->num_modules].name, name, lstrcpynW(dc->modules[dc->num_modules].name, name,
...@@ -834,7 +834,7 @@ static unsigned dump_memory_info(struct dump_context* dc) ...@@ -834,7 +834,7 @@ static unsigned dump_memory_info(struct dump_context* dc)
{ {
len = min(dc->mem[i].size - pos, sizeof(tmp)); len = min(dc->mem[i].size - pos, sizeof(tmp));
if (ReadProcessMemory(dc->hProcess, if (ReadProcessMemory(dc->hProcess,
(void*)(dc->mem[i].base + pos), (void*)(DWORD_PTR)(dc->mem[i].base + pos),
tmp, len, NULL)) tmp, len, NULL))
WriteFile(dc->hFile, tmp, len, &written, NULL); WriteFile(dc->hFile, tmp, len, &written, NULL);
} }
......
...@@ -432,13 +432,13 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, ...@@ -432,13 +432,13 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name,
* pe_load_nt_header * pe_load_nt_header
* *
*/ */
BOOL pe_load_nt_header(HANDLE hProc, DWORD base, IMAGE_NT_HEADERS* nth) BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS* nth)
{ {
IMAGE_DOS_HEADER dos; IMAGE_DOS_HEADER dos;
return ReadProcessMemory(hProc, (char*)base, &dos, sizeof(dos), NULL) && return ReadProcessMemory(hProc, (char*)(DWORD_PTR)base, &dos, sizeof(dos), NULL) &&
dos.e_magic == IMAGE_DOS_SIGNATURE && dos.e_magic == IMAGE_DOS_SIGNATURE &&
ReadProcessMemory(hProc, (char*)(base + dos.e_lfanew), ReadProcessMemory(hProc, (char*)(DWORD_PTR)(base + dos.e_lfanew),
nth, sizeof(*nth), NULL) && nth, sizeof(*nth), NULL) &&
nth->Signature == IMAGE_NT_SIGNATURE; nth->Signature == IMAGE_NT_SIGNATURE;
} }
......
...@@ -261,7 +261,7 @@ static BOOL stack_walk(struct stack_walk_callback* cb, LPSTACKFRAME frame) ...@@ -261,7 +261,7 @@ static BOOL stack_walk(struct stack_walk_callback* cb, LPSTACKFRAME frame)
WARN("Bad stack frame 0x%08x\n", p); WARN("Bad stack frame 0x%08x\n", p);
goto done_err; goto done_err;
} }
curr_switch = (DWORD)frame16.frame32; curr_switch = (DWORD_PTR)frame16.frame32;
if (!sw_read_mem(cb, curr_switch, &ch, sizeof(ch))) if (!sw_read_mem(cb, curr_switch, &ch, sizeof(ch)))
curr_switch = 0xFFFFFFFF; curr_switch = 0xFFFFFFFF;
...@@ -327,7 +327,7 @@ static BOOL stack_walk(struct stack_walk_callback* cb, LPSTACKFRAME frame) ...@@ -327,7 +327,7 @@ static BOOL stack_walk(struct stack_walk_callback* cb, LPSTACKFRAME frame)
WARN("Bad stack frame 0x%08x\n", p); WARN("Bad stack frame 0x%08x\n", p);
goto done_err; goto done_err;
} }
curr_switch = (DWORD)frame16.frame32; curr_switch = (DWORD_PTR)frame16.frame32;
curr_mode = stm_32bit; curr_mode = stm_32bit;
if (!sw_read_mem(cb, curr_switch, &ch, sizeof(ch))) if (!sw_read_mem(cb, curr_switch, &ch, sizeof(ch)))
curr_switch = 0; curr_switch = 0;
......
...@@ -702,7 +702,7 @@ static void symt_fill_sym_info(const struct module_pair* pair, ...@@ -702,7 +702,7 @@ static void symt_fill_sym_info(const struct module_pair* pair,
case VT_UI4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.ulVal; break; case VT_UI4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.ulVal; break;
case VT_UI2: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.uiVal; break; case VT_UI2: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.uiVal; break;
case VT_UI1: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.bVal; break; case VT_UI1: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.bVal; break;
case VT_I1 | VT_BYREF: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.byref; break; case VT_I1 | VT_BYREF: sym_info->Value = (ULONG64)(DWORD_PTR)data->u.value.n1.n2.n3.byref; break;
case VT_EMPTY: sym_info->Value = 0; break; case VT_EMPTY: sym_info->Value = 0; break;
default: default:
FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt); FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment