[RFA/win32] Change the DLL base address type to LPVOID

Joel Brobecker
2009-01-07T11:46:34Z

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

This patch changes the type used to manipulate the DLL base address from
DWORD to LPVOID. The Windows headers declare this address as an LPVOID,
and using DWORD causes problems on x86_64-windows because the types do
not have the same size.

2009-01-07 Joel Brobecker <brobecker@adacore.com>

* win32-nat.c (get_module_name): Change the type of parameter
"base_address" to LPVOID. Remove unnecessary cast.
(struct lm_info): Change type of load_addr to LPVOID.
(win32_make_so): Change the type of parameter "load_addr"
to LPVOID. Remove some unnecessary casts.
(handle_unload_dll): Change the type of "lpBaseOfDll" to LPVOID.
(win32_xfer_shared_libraries): Add missing cast.

Tested on x86-windows.
OK to apply?

Thanks,
--
Joel

[-- Attachment #2: farproc.diff --]
[-- Type: text/plain, Size: 1677 bytes --]

diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 1b15dfb..5300731 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -1600,11 +1600,11 @@ has_detach_ability (void)
if (kernel32)
{
if (!kernel32_DebugSetProcessKillOnExit)
- kernel32_DebugSetProcessKillOnExit = GetProcAddress (kernel32,
- "DebugSetProcessKillOnExit");
+ kernel32_DebugSetProcessKillOnExit =
+ (void *) GetProcAddress (kernel32, "DebugSetProcessKillOnExit");
if (!kernel32_DebugActiveProcessStop)
- kernel32_DebugActiveProcessStop = GetProcAddress (kernel32,
- "DebugActiveProcessStop");
+ kernel32_DebugActiveProcessStop =
+ (void *) GetProcAddress (kernel32, "DebugActiveProcessStop");
if (kernel32_DebugSetProcessKillOnExit
&& kernel32_DebugActiveProcessStop)
return 1;
@@ -1641,13 +1641,14 @@ set_process_privilege (const char *privilege, BOOL enable)
if (!(advapi32 = LoadLibrary ("advapi32.dll")))
goto out;
if (!OpenProcessToken)
- OpenProcessToken = GetProcAddress (advapi32, "OpenProcessToken");
+ OpenProcessToken =
+ (void *) GetProcAddress (advapi32, "OpenProcessToken");
if (!LookupPrivilegeValue)
- LookupPrivilegeValue = GetProcAddress (advapi32,
- "LookupPrivilegeValueA");
+ LookupPrivilegeValue =
+ (void *) GetProcAddress (advapi32, "LookupPrivilegeValueA");
if (!AdjustTokenPrivileges)
- AdjustTokenPrivileges = GetProcAddress (advapi32,
- "AdjustTokenPrivileges");
+ AdjustTokenPrivileges =
+ (void *) GetProcAddress (advapi32, "AdjustTokenPrivileges");
if (!OpenProcessToken || !LookupPrivilegeValue || !AdjustTokenPrivileges)
{
advapi32 = NULL;