user32: Get rid of the 16-bit heap support.

This commit is contained in:
Alexandre Julliard 2009-10-12 14:32:21 +02:00
parent db79a9f2e9
commit 796346f825
4 changed files with 17 additions and 57 deletions

View File

@ -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

View File

@ -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)
*/

View File

@ -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" );

View File

@ -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))