From 796346f825e92759c957ffaba4ad24d1a9761a73 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 12 Oct 2009 14:32:21 +0200 Subject: [PATCH] user32: Get rid of the 16-bit heap support. --- dlls/user32/user.exe.spec | 2 +- dlls/user32/user16.c | 15 +++++++++++++ dlls/user32/user_main.c | 11 +-------- dlls/user32/user_private.h | 46 -------------------------------------- 4 files changed, 17 insertions(+), 57 deletions(-) diff --git a/dlls/user32/user.exe.spec b/dlls/user32/user.exe.spec index 9a22d87cf60..517ced81d35 100644 --- a/dlls/user32/user.exe.spec +++ b/dlls/user32/user.exe.spec @@ -351,7 +351,7 @@ 371 pascal -ret16 SetWindowPlacement(word ptr) SetWindowPlacement16 372 stub GetInternalIconHeader 373 pascal -ret16 SubtractRect(ptr ptr ptr) SubtractRect16 -#374 DllEntryPoint +374 pascal -ret16 DllEntryPoint(long word word word long word) 375 stub DrawTextEx 376 stub SetMessageExtraInfo 378 stub SetPropEx diff --git a/dlls/user32/user16.c b/dlls/user32/user16.c index 85b72128aab..5ca88372d20 100644 --- a/dlls/user32/user16.c +++ b/dlls/user32/user16.c @@ -56,6 +56,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(user); WORD WINAPI DestroyIcon32(HGLOBAL16, UINT16); +WORD USER_HeapSel = 0; /* USER heap selector */ struct gray_string_info { @@ -1205,6 +1206,20 @@ BOOL16 WINAPI SubtractRect16( LPRECT16 dest, const RECT16 *src1, } +/********************************************************************** + * DllEntryPoint (USER.374) + */ +BOOL WINAPI DllEntryPoint( DWORD reason, HINSTANCE16 inst, WORD ds, + WORD heap, DWORD reserved1, WORD reserved2 ) +{ + if (reason != DLL_PROCESS_ATTACH) return TRUE; + if (USER_HeapSel) return TRUE; /* already called */ + + USER_HeapSel = ds; + return TRUE; +} + + /********************************************************************** * SetMenuContextHelpId (USER.384) */ diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 7b7b8850af2..516338c0c89 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -36,7 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(graphics); #define DESKTOP_ALL_ACCESS 0x01ff -WORD USER_HeapSel = 0; /* USER heap selector */ HMODULE user32_module = 0; static SYSLEVEL USER_SysLevel; @@ -267,15 +266,7 @@ static void winstation_init(void) */ static BOOL process_attach(void) { - HINSTANCE16 instance; - - /* Create USER heap */ - if ((instance = LoadLibrary16( "USER.EXE" )) >= 32) USER_HeapSel = instance | 7; - else - { - USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 65536 ); - LocalInit16( USER_HeapSel, 32, 65534 ); - } + LoadLibrary16( "user.exe" ); /* some Win9x dlls expect keyboard to be loaded */ if (GetVersion() & 0x80000000) LoadLibrary16( "keyboard.drv" ); diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index fa6118d3c2b..3dc1d83dc04 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -29,55 +29,9 @@ #include "winreg.h" #include "winternl.h" #include "wine/windef16.h" -#include "wine/winbase16.h" extern WORD USER_HeapSel DECLSPEC_HIDDEN; -static inline HLOCAL16 LOCAL_Alloc( HANDLE16 ds, UINT16 flags, WORD size ) -{ - STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); - HANDLE16 oldDS = stack16->ds; - HLOCAL16 ret; - - stack16->ds = ds; - ret = LocalAlloc16 (flags, size); - stack16->ds = oldDS; - return ret; -} - -static inline HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, UINT16 flags ) -{ - STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); - HANDLE16 oldDS = stack16->ds; - HLOCAL16 ret; - - stack16->ds = ds; - ret = LocalReAlloc16 (handle, size, flags); - stack16->ds = oldDS; - return ret; -} - -static inline HLOCAL16 LOCAL_Free( HANDLE16 ds, HLOCAL16 handle ) -{ - STACK16FRAME* stack16 = MapSL(PtrToUlong(NtCurrentTeb()->WOW32Reserved)); - HANDLE16 oldDS = stack16->ds; - HLOCAL16 ret; - - stack16->ds = ds; - ret = LocalFree16 (handle); - stack16->ds = oldDS; - return ret; -} - -#define USER_HEAP_ALLOC(size) \ - ((HANDLE)(ULONG_PTR)LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) )) -#define USER_HEAP_REALLOC(handle,size) \ - ((HANDLE)(ULONG_PTR)LOCAL_ReAlloc( USER_HeapSel, LOWORD(handle), (size), LMEM_FIXED )) -#define USER_HEAP_FREE(handle) \ - LOCAL_Free( USER_HeapSel, LOWORD(handle) ) -#define USER_HEAP_LIN_ADDR(handle) \ - ((handle) ? MapSL(MAKESEGPTR(USER_HeapSel, LOWORD(handle))) : NULL) - #define GET_WORD(ptr) (*(const WORD *)(ptr)) #define GET_DWORD(ptr) (*(const DWORD *)(ptr))