Alexandre Julliard : toolhelp: Avoid using libwine functions.

Alexandre Julliard julliard at winehq.org
Tue May 21 16:45:20 CDT 2019


Module: wine
Branch: master
Commit: e5590cbe6acb9d843c495970c71def597ab9e2ac
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e5590cbe6acb9d843c495970c71def597ab9e2ac

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue May 21 17:52:50 2019 +0200

toolhelp: Avoid using libwine functions.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 cf80439..ddd321c 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 47c2d2d..02e8d6a 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;
 }
 




More information about the wine-cvs mailing list