Commit e5590cbe authored by Alexandre Julliard's avatar Alexandre Julliard

toolhelp: Avoid using libwine functions.

parent 0d7d0427
......@@ -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)
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment