Commit 8ad6c255 authored by Dimi Paun's avatar Dimi Paun Committed by Alexandre Julliard

Remove LOCAL_*() calls from USER, use Local*16() instead.

parent 442f8937
......@@ -28,10 +28,47 @@
#include "winuser.h"
#include "winreg.h"
#include "winternl.h"
#include "local.h"
#include "wine/windef16.h"
#include "wine/winbase16.h"
extern WORD USER_HeapSel;
static inline HLOCAL16 LOCAL_Alloc( HANDLE16 ds, UINT16 flags, WORD size )
{
STACK16FRAME* stack16 = MapSL((SEGPTR)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((SEGPTR)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((SEGPTR)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) \
......
......@@ -32,7 +32,7 @@
#include "winuser.h"
#include "wownt32.h"
#include "winreg.h"
#include "local.h"
#include "winternl.h"
#include "gdi.h" /* sic */
#include "wine/debug.h"
......@@ -105,14 +105,19 @@ static void SYSCOLOR_MakeObjectSystem( HGDIOBJ16 handle, BOOL set)
if (!heap_sel) heap_sel = LoadLibrary16( "gdi" );
if (heap_sel >= 32)
{
ptr = (LPWORD)LOCAL_Lock(heap_sel, handle);
STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved);
HANDLE16 oldDS = stack16->ds;
stack16->ds = heap_sel;
ptr = MapSL(LocalLock16(handle));
/* touch the "system" bit of the wMagic field of a GDIOBJHDR */
if (set)
*ptr &= ~OBJECT_NOSYSTEM;
else
*ptr |= OBJECT_NOSYSTEM;
LOCAL_Unlock( heap_sel, handle );
LocalUnlock16( handle );
stack16->ds = oldDS;
}
}
......
......@@ -35,7 +35,6 @@
#include "win.h"
#include "controls.h"
#include "cursoricon.h"
#include "local.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(user);
......@@ -73,6 +72,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(user);
*/
WORD WINAPI GetFreeSystemResources16( WORD resType )
{
STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved);
HANDLE16 oldDS = stack16->ds;
HINSTANCE16 gdi_inst;
WORD gdi_heap;
int userPercent, gdiPercent;
......@@ -83,22 +84,25 @@ WORD WINAPI GetFreeSystemResources16( WORD resType )
switch(resType)
{
case GFSR_USERRESOURCES:
userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
LOCAL_HeapSize( USER_HeapSel );
stack16->ds = USER_HeapSel;
userPercent = (int)LocalCountFree16() * 100 / LocalHeapSize16();
gdiPercent = 100;
stack16->ds = oldDS;
break;
case GFSR_GDIRESOURCES:
gdiPercent = (int)LOCAL_CountFree( gdi_inst ) * 100 /
LOCAL_HeapSize( gdi_inst );
stack16->ds = gdi_inst;
gdiPercent = (int)LocalCountFree16() * 100 / LocalHeapSize16();
userPercent = 100;
stack16->ds = oldDS;
break;
case GFSR_SYSTEMRESOURCES:
userPercent = (int)LOCAL_CountFree( USER_HeapSel ) * 100 /
LOCAL_HeapSize( USER_HeapSel );
gdiPercent = (int)LOCAL_CountFree( gdi_inst ) * 100 /
LOCAL_HeapSize( gdi_inst );
stack16->ds = USER_HeapSel;
userPercent = (int)LocalCountFree16() * 100 / LocalHeapSize16();
stack16->ds = gdi_inst;
gdiPercent = (int)LocalCountFree16() * 100 / LocalHeapSize16();
stack16->ds = oldDS;
break;
default:
......@@ -546,23 +550,33 @@ BOOL WINAPI EnumDisplayDevicesW(
*/
DWORD WINAPI UserSeeUserDo16(WORD wReqType, WORD wParam1, WORD wParam2, WORD wParam3)
{
STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved);
HANDLE16 oldDS = stack16->ds;
DWORD ret = (DWORD)-1;
stack16->ds = USER_HeapSel;
switch (wReqType)
{
case USUD_LOCALALLOC:
return LOCAL_Alloc(USER_HeapSel, wParam1, wParam3);
ret = LocalAlloc16(wParam1, wParam3);
break;
case USUD_LOCALFREE:
return LOCAL_Free(USER_HeapSel, wParam1);
ret = LocalFree16(wParam1);
break;
case USUD_LOCALCOMPACT:
return LOCAL_Compact(USER_HeapSel, wParam3);
ret = LocalCompact16(wParam3);
break;
case USUD_LOCALHEAP:
return USER_HeapSel;
ret = USER_HeapSel;
break;
case USUD_FIRSTCLASS:
FIXME("return a pointer to the first window class.\n");
return (DWORD)-1;
break;
default:
WARN("wReqType %04x (unknown)\n", wReqType);
return (DWORD)-1;
}
stack16->ds = oldDS;
return ret;
}
/***********************************************************************
......
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