From e5590cbe6acb9d843c495970c71def597ab9e2ac Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 21 May 2019 17:52:50 +0200 Subject: [PATCH] toolhelp: Avoid using libwine functions. Signed-off-by: Alexandre Julliard --- dlls/krnl386.exe16/krnl386.exe16.spec | 2 ++ dlls/toolhelp.dll16/toolhelp.c | 19 ++++++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/dlls/krnl386.exe16/krnl386.exe16.spec b/dlls/krnl386.exe16/krnl386.exe16.spec index cf804391096..ddd321cbc31 100644 --- a/dlls/krnl386.exe16/krnl386.exe16.spec +++ b/dlls/krnl386.exe16/krnl386.exe16.spec @@ -709,6 +709,8 @@ @ stdcall -arch=win32 GetExeVersion16() @ stdcall -arch=win32 GetExpWinVer16(long) @ stdcall -arch=win32 GetModuleHandle16(str) +@ stdcall -arch=win32 GetSelectorBase(long) +@ stdcall -arch=win32 GetSelectorLimit16(long) @ stdcall -arch=win32 GlobalReAlloc16(long long long) @ stdcall -arch=win32 InitTask16(ptr) @ stdcall -arch=win32 IsBadReadPtr16(long long) diff --git a/dlls/toolhelp.dll16/toolhelp.c b/dlls/toolhelp.dll16/toolhelp.c index 47c2d2da081..02e8d6a8d53 100644 --- a/dlls/toolhelp.dll16/toolhelp.c +++ b/dlls/toolhelp.dll16/toolhelp.c @@ -36,7 +36,6 @@ #include "wine/winbase16.h" #include "toolhelp.h" -#include "wine/library.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(toolhelp); @@ -639,15 +638,12 @@ void WINAPI TerminateApp16(HTASK16 hTask, WORD wFlags) */ DWORD WINAPI MemoryRead16( WORD sel, DWORD offset, void *buffer, DWORD count ) { - LDT_ENTRY entry; - DWORD limit; + char *base = (char *)GetSelectorBase( sel ); + DWORD limit = GetSelectorLimit16( sel ); - wine_ldt_get_entry( sel, &entry ); - if (wine_ldt_is_empty( &entry )) return 0; - limit = wine_ldt_get_limit( &entry ); if (offset > limit) return 0; if (offset + count > limit + 1) count = limit + 1 - offset; - memcpy( buffer, (char *)wine_ldt_get_base(&entry) + offset, count ); + memcpy( buffer, base + offset, count ); return count; } @@ -657,15 +653,12 @@ DWORD WINAPI MemoryRead16( WORD sel, DWORD offset, void *buffer, DWORD count ) */ DWORD WINAPI MemoryWrite16( WORD sel, DWORD offset, void *buffer, DWORD count ) { - LDT_ENTRY entry; - DWORD limit; + char *base = (char *)GetSelectorBase( sel ); + DWORD limit = GetSelectorLimit16( sel ); - wine_ldt_get_entry( sel, &entry ); - if (wine_ldt_is_empty( &entry )) return 0; - limit = wine_ldt_get_limit( &entry ); if (offset > limit) return 0; if (offset + count > limit) count = limit + 1 - offset; - memcpy( (char *)wine_ldt_get_base(&entry) + offset, buffer, count ); + memcpy( base + offset, buffer, count ); return count; }