From b037912c9dc5b31d16e0833f2470f428b583c98e Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sat, 12 Dec 2009 12:18:28 +0100 Subject: [PATCH] dbghelp: Fix a couple of casts on 64bit platforms. --- dlls/dbghelp/dbghelp.c | 2 +- dlls/dbghelp/dbghelp_private.h | 2 +- dlls/dbghelp/dwarf.c | 8 ++++---- dlls/dbghelp/minidump.c | 10 +++++----- dlls/dbghelp/pe_module.c | 6 +++--- dlls/dbghelp/stack.c | 4 ++-- dlls/dbghelp/symbol.c | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index b540516d694..e5cfc73d04c 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -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_PARTIAL: 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)) return FALSE; idsl.SizeOfStruct = sizeof(idsl); diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index cae3c95aeda..49261147ec8 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -498,7 +498,7 @@ extern BOOL path_find_symbol_file(const struct process* pcs, PCSTR full_ BOOL* is_unmatched); /* 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* pe_load_native_module(struct process* pcs, const WCHAR* name, HANDLE hFile, DWORD base, DWORD size); diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 60062028a81..bb7257e7826 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -654,7 +654,7 @@ static enum location_error compute_location(dwarf2_traverse_context_t* ctx, struct location* loc, HANDLE hproc, const struct location* frame) { - unsigned long stack[64]; + DWORD_PTR stack[64]; unsigned stk; unsigned char op; BOOL piece_found = FALSE; @@ -767,12 +767,12 @@ compute_location(dwarf2_traverse_context_t* ctx, struct location* loc, } if (hproc) { - DWORD addr = stack[stk--]; - DWORD deref; + DWORD_PTR addr = stack[stk--]; + DWORD_PTR deref; 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; } stack[++stk] = deref; diff --git a/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c index 1f165a847fe..b026d32f0de 100644 --- a/dlls/dbghelp/minidump.c +++ b/dlls/dbghelp/minidump.c @@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); struct dump_memory { - ULONG base; + ULONG64 base; ULONG size; ULONG rva; }; @@ -42,7 +42,7 @@ struct dump_memory struct dump_module { unsigned is_elf; - ULONG base; + ULONG64 base; ULONG size; DWORD timestamp; DWORD checksum; @@ -251,7 +251,7 @@ static BOOL fetch_thread_info(struct dump_context* dc, int thd_idx, * Add a module to a dump context */ 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) { if (!dc->modules) @@ -272,7 +272,7 @@ static BOOL add_module(struct dump_context* dc, const WCHAR* name, return FALSE; } if (is_elf || - !GetModuleFileNameExW(dc->hProcess, (HMODULE)base, + !GetModuleFileNameExW(dc->hProcess, (HMODULE)(DWORD_PTR)base, dc->modules[dc->num_modules].name, sizeof(dc->modules[dc->num_modules].name) / sizeof(WCHAR))) lstrcpynW(dc->modules[dc->num_modules].name, name, @@ -834,7 +834,7 @@ static unsigned dump_memory_info(struct dump_context* dc) { len = min(dc->mem[i].size - pos, sizeof(tmp)); if (ReadProcessMemory(dc->hProcess, - (void*)(dc->mem[i].base + pos), + (void*)(DWORD_PTR)(dc->mem[i].base + pos), tmp, len, NULL)) WriteFile(dc->hFile, tmp, len, &written, NULL); } diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 3b9cceb4337..664affcbac7 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -432,13 +432,13 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, * 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; - 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 && - ReadProcessMemory(hProc, (char*)(base + dos.e_lfanew), + ReadProcessMemory(hProc, (char*)(DWORD_PTR)(base + dos.e_lfanew), nth, sizeof(*nth), NULL) && nth->Signature == IMAGE_NT_SIGNATURE; } diff --git a/dlls/dbghelp/stack.c b/dlls/dbghelp/stack.c index 959ab644840..0d2585e76a6 100644 --- a/dlls/dbghelp/stack.c +++ b/dlls/dbghelp/stack.c @@ -261,7 +261,7 @@ static BOOL stack_walk(struct stack_walk_callback* cb, LPSTACKFRAME frame) WARN("Bad stack frame 0x%08x\n", p); goto done_err; } - curr_switch = (DWORD)frame16.frame32; + curr_switch = (DWORD_PTR)frame16.frame32; if (!sw_read_mem(cb, curr_switch, &ch, sizeof(ch))) curr_switch = 0xFFFFFFFF; @@ -327,7 +327,7 @@ static BOOL stack_walk(struct stack_walk_callback* cb, LPSTACKFRAME frame) WARN("Bad stack frame 0x%08x\n", p); goto done_err; } - curr_switch = (DWORD)frame16.frame32; + curr_switch = (DWORD_PTR)frame16.frame32; curr_mode = stm_32bit; if (!sw_read_mem(cb, curr_switch, &ch, sizeof(ch))) curr_switch = 0; diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index c266ce24f92..9f836facacc 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -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_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_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; default: FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt);