winedbg: Add wrappers for Read/WriteProcessMemory to fix the mingw build.

This commit is contained in:
Alexandre Julliard 2009-06-05 15:16:14 +02:00
parent 84ccadeeee
commit 8d0cb61bc7
5 changed files with 47 additions and 18 deletions

View File

@ -237,9 +237,9 @@ struct dbg_process
struct be_process_io struct be_process_io
{ {
BOOL (*close_process)(struct dbg_process*, BOOL); BOOL (*close_process)(struct dbg_process*, BOOL);
BOOL (WINAPI *read)(HANDLE, const void*, void*, SIZE_T, SIZE_T*); BOOL (*read)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
BOOL (WINAPI *write)(HANDLE, void*, const void*, SIZE_T, SIZE_T*); BOOL (*write)(HANDLE, void*, const void*, SIZE_T, SIZE_T*);
BOOL (WINAPI *get_selector)(HANDLE, DWORD, LDT_ENTRY*); BOOL (*get_selector)(HANDLE, DWORD, LDT_ENTRY*);
}; };
extern struct dbg_process* dbg_curr_process; extern struct dbg_process* dbg_curr_process;

View File

@ -111,11 +111,23 @@ struct gdb_context
unsigned long wine_segs[3]; /* load addresses of the ELF wine exec segments (text, bss and data) */ unsigned long wine_segs[3]; /* load addresses of the ELF wine exec segments (text, bss and data) */
}; };
static BOOL tgt_process_gdbproxy_read(HANDLE hProcess, const void* addr,
void* buffer, SIZE_T len, SIZE_T* rlen)
{
return ReadProcessMemory( hProcess, addr, buffer, len, rlen );
}
static BOOL tgt_process_gdbproxy_write(HANDLE hProcess, void* addr,
const void* buffer, SIZE_T len, SIZE_T* wlen)
{
return WriteProcessMemory( hProcess, addr, buffer, len, wlen );
}
static struct be_process_io be_process_gdbproxy_io = static struct be_process_io be_process_gdbproxy_io =
{ {
NULL, /* we shouldn't use close_process() in gdbproxy */ NULL, /* we shouldn't use close_process() in gdbproxy */
ReadProcessMemory, tgt_process_gdbproxy_read,
WriteProcessMemory tgt_process_gdbproxy_write
}; };
/* =============================================== * /* =============================================== *

View File

@ -1004,10 +1004,27 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
return TRUE; return TRUE;
} }
static BOOL tgt_process_active_read(HANDLE hProcess, const void* addr,
void* buffer, SIZE_T len, SIZE_T* rlen)
{
return ReadProcessMemory( hProcess, addr, buffer, len, rlen );
}
static BOOL tgt_process_active_write(HANDLE hProcess, void* addr,
const void* buffer, SIZE_T len, SIZE_T* wlen)
{
return WriteProcessMemory( hProcess, addr, buffer, len, wlen );
}
static BOOL tgt_process_active_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le)
{
return GetThreadSelectorEntry( hThread, sel, le );
}
static struct be_process_io be_process_active_io = static struct be_process_io be_process_active_io =
{ {
tgt_process_active_close_process, tgt_process_active_close_process,
ReadProcessMemory, tgt_process_active_read,
WriteProcessMemory, tgt_process_active_write,
GetThreadSelectorEntry, tgt_process_active_get_selector
}; };

View File

@ -84,8 +84,8 @@ static inline struct tgt_process_minidump_data* private_data(struct dbg_process*
return pcs->pio_data; return pcs->pio_data;
} }
static BOOL WINAPI tgt_process_minidump_read(HANDLE hProcess, const void* addr, static BOOL tgt_process_minidump_read(HANDLE hProcess, const void* addr,
void* buffer, SIZE_T len, SIZE_T* rlen) void* buffer, SIZE_T len, SIZE_T* rlen)
{ {
void* stream; void* stream;
@ -125,8 +125,8 @@ static BOOL WINAPI tgt_process_minidump_read(HANDLE hProcess, const void* addr,
return FALSE; return FALSE;
} }
static BOOL WINAPI tgt_process_minidump_write(HANDLE hProcess, void* addr, static BOOL tgt_process_minidump_write(HANDLE hProcess, void* addr,
const void* buffer, SIZE_T len, SIZE_T* wlen) const void* buffer, SIZE_T len, SIZE_T* wlen)
{ {
return FALSE; return FALSE;
} }
@ -447,7 +447,7 @@ static BOOL tgt_process_minidump_close_process(struct dbg_process* pcs, BOOL kil
return TRUE; return TRUE;
} }
static BOOL WINAPI tgt_process_minidump_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le) static BOOL tgt_process_minidump_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le)
{ {
/* so far, pretend all selectors are valid, and mapped to a 32bit flat address space */ /* so far, pretend all selectors are valid, and mapped to a 32bit flat address space */
memset(le, 0, sizeof(*le)); memset(le, 0, sizeof(*le));

View File

@ -33,14 +33,14 @@
static struct be_process_io be_process_module_io; static struct be_process_io be_process_module_io;
static BOOL WINAPI tgt_process_module_read(HANDLE hProcess, const void* addr, static BOOL tgt_process_module_read(HANDLE hProcess, const void* addr,
void* buffer, SIZE_T len, SIZE_T* rlen) void* buffer, SIZE_T len, SIZE_T* rlen)
{ {
return FALSE; return FALSE;
} }
static BOOL WINAPI tgt_process_module_write(HANDLE hProcess, void* addr, static BOOL tgt_process_module_write(HANDLE hProcess, void* addr,
const void* buffer, SIZE_T len, SIZE_T* wlen) const void* buffer, SIZE_T len, SIZE_T* wlen)
{ {
return FALSE; return FALSE;
} }
@ -102,7 +102,7 @@ static BOOL tgt_process_module_close_process(struct dbg_process* pcs, BOOL kill)
return TRUE; return TRUE;
} }
static BOOL WINAPI tgt_process_module_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le) static BOOL tgt_process_module_get_selector(HANDLE hThread, DWORD sel, LDT_ENTRY* le)
{ {
return FALSE; return FALSE;
} }