Commit da2892c0 authored by Alexandre Julliard's avatar Alexandre Julliard

Do not allocate any USER data on the system heap.

parent 92b23186
......@@ -640,7 +640,7 @@ static void MENU_FreeItemData( MENUITEM* item )
{
/* delete text */
if (IS_STRING_ITEM(item->fType) && item->text)
HeapFree( SystemHeap, 0, item->text );
HeapFree( GetProcessHeap(), 0, item->text );
}
/***********************************************************************
......@@ -1869,7 +1869,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT id,
flags |= MF_HELP;
str++;
}
if (!(text = HEAP_strdupW( SystemHeap, 0, str ))) return FALSE;
if (!(text = HEAP_strdupW( GetProcessHeap(), 0, str ))) return FALSE;
item->text = text;
}
}
......@@ -1914,7 +1914,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT id,
/* Don't call SetRectEmpty here! */
if (prevText) HeapFree( SystemHeap, 0, prevText );
if (prevText) HeapFree( GetProcessHeap(), 0, prevText );
debug_print_menuitem("MENU_SetItemData to : ", item, "");
return TRUE;
......@@ -1950,7 +1950,7 @@ static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags )
/* Create new items array */
newItems = HeapAlloc( SystemHeap, 0, sizeof(MENUITEM) * (menu->nItems+1) );
newItems = HeapAlloc( GetProcessHeap(), 0, sizeof(MENUITEM) * (menu->nItems+1) );
if (!newItems)
{
WARN("allocation failed\n" );
......@@ -1962,7 +1962,7 @@ static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags )
if (pos > 0) memcpy( newItems, menu->items, pos * sizeof(MENUITEM) );
if (pos < menu->nItems) memcpy( &newItems[pos+1], &menu->items[pos],
(menu->nItems-pos)*sizeof(MENUITEM) );
HeapFree( SystemHeap, 0, menu->items );
HeapFree( GetProcessHeap(), 0, menu->items );
}
menu->items = newItems;
menu->nItems++;
......@@ -2046,14 +2046,8 @@ static LPCSTR MENUEX_ParseResource( LPCSTR res, HMENU hMenu)
/* Align the following fields on a dword boundary. */
res += (~((int)res - 1)) & 3;
/* FIXME: This is inefficient and cannot be optimised away by gcc. */
{
LPSTR newstr = HEAP_strdupWtoA(GetProcessHeap(),
0, mii.dwTypeData);
TRACE("Menu item: [%08x,%08x,%04x,%04x,%s]\n",
mii.fType, mii.fState, mii.wID, resinfo, newstr);
HeapFree( GetProcessHeap(), 0, newstr );
}
TRACE("Menu item: [%08x,%08x,%04x,%04x,%s]\n",
mii.fType, mii.fState, mii.wID, resinfo, debugstr_w(mii.dwTypeData));
if (resinfo & 1) { /* Pop-up? */
/* DWORD helpid = GET_DWORD(res); FIXME: use this. */
......@@ -3720,7 +3714,7 @@ BOOL WINAPI RemoveMenu( HMENU hMenu, UINT nPos, UINT wFlags )
if (--menu->nItems == 0)
{
HeapFree( SystemHeap, 0, menu->items );
HeapFree( GetProcessHeap(), 0, menu->items );
menu->items = NULL;
}
else
......@@ -3731,7 +3725,7 @@ BOOL WINAPI RemoveMenu( HMENU hMenu, UINT nPos, UINT wFlags )
item++;
nPos++;
}
menu->items = HeapReAlloc( SystemHeap, 0, menu->items,
menu->items = HeapReAlloc( GetProcessHeap(), 0, menu->items,
menu->nItems * sizeof(MENUITEM) );
}
return TRUE;
......@@ -3960,7 +3954,7 @@ BOOL WINAPI DestroyMenu( HMENU hMenu )
if (item->fType & MF_POPUP) DestroyMenu(item->hSubMenu);
MENU_FreeItemData( item );
}
HeapFree( SystemHeap, 0, lppop->items );
HeapFree( GetProcessHeap(), 0, lppop->items );
}
USER_HEAP_FREE( hMenu );
MENU_ReleaseTopPopupWnd();
......@@ -4500,7 +4494,7 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
if (lpmii->fMask & MIIM_TYPE ) {
/* Get rid of old string. */
if ( IS_STRING_ITEM(menu->fType) && menu->text) {
HeapFree(SystemHeap, 0, menu->text);
HeapFree(GetProcessHeap(), 0, menu->text);
menu->text = NULL;
}
......@@ -4512,16 +4506,16 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
if (IS_STRING_ITEM(menu->fType) && menu->text) {
if (unicode)
menu->text = HEAP_strdupW(SystemHeap, 0, lpmii->dwTypeData);
menu->text = HEAP_strdupW(GetProcessHeap(), 0, lpmii->dwTypeData);
else
menu->text = HEAP_strdupAtoW(SystemHeap, 0, (LPSTR)lpmii->dwTypeData);
menu->text = HEAP_strdupAtoW(GetProcessHeap(), 0, (LPSTR)lpmii->dwTypeData);
}
}
if (lpmii->fMask & MIIM_FTYPE ) {
/* free the string when the type is changing */
if ( (!IS_STRING_ITEM(lpmii->fType)) && IS_STRING_ITEM(menu->fType) && menu->text) {
HeapFree(SystemHeap, 0, menu->text);
HeapFree(GetProcessHeap(), 0, menu->text);
menu->text = NULL;
}
menu->fType &= ~MENU_ITEM_TYPE(menu->fType);
......@@ -4531,11 +4525,11 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
if (lpmii->fMask & MIIM_STRING ) {
/* free the string when used */
if ( IS_STRING_ITEM(menu->fType) && menu->text) {
HeapFree(SystemHeap, 0, menu->text);
HeapFree(GetProcessHeap(), 0, menu->text);
if (unicode)
menu->text = HEAP_strdupW(SystemHeap, 0, lpmii->dwTypeData);
menu->text = HEAP_strdupW(GetProcessHeap(), 0, lpmii->dwTypeData);
else
menu->text = HEAP_strdupAtoW(SystemHeap, 0, (LPSTR) lpmii->dwTypeData);
menu->text = HEAP_strdupAtoW(GetProcessHeap(), 0, (LPSTR) lpmii->dwTypeData);
}
}
......
......@@ -9,7 +9,6 @@
#include "wingdi.h"
#include "wine/winuser16.h"
#include "controls.h"
#include "heap.h"
#include "win.h"
#include "debugtools.h"
#include "user.h"
......@@ -162,7 +161,7 @@ static SCROLLBAR_INFO *SCROLL_GetPtrScrollInfo( WND* wndPtr, INT nBar )
if (!infoPtr) /* Create the info structure if needed */
{
if ((infoPtr = HeapAlloc( SystemHeap, 0, sizeof(SCROLLBAR_INFO) )))
if ((infoPtr = HeapAlloc( GetProcessHeap(), 0, sizeof(SCROLLBAR_INFO) )))
{
infoPtr->MinVal = infoPtr->CurVal = infoPtr->Page = 0;
infoPtr->MaxVal = 100;
......
......@@ -7,7 +7,6 @@
#include "config.h"
#include "gdi.h"
#include "heap.h"
#include "ttydrv.h"
#include "win.h"
#include "debugtools.h"
......@@ -52,8 +51,7 @@ WINDOW *TTYDRV_WND_GetCursesWindow(WND *wndPtr)
*/
void TTYDRV_WND_Initialize(WND *wndPtr)
{
TTYDRV_WND_DATA *pWndDriverData =
(TTYDRV_WND_DATA *) HeapAlloc(SystemHeap, 0, sizeof(TTYDRV_WND_DATA));
TTYDRV_WND_DATA *pWndDriverData = HeapAlloc(GetProcessHeap(), 0, sizeof(TTYDRV_WND_DATA));
TRACE("(%p)\n", wndPtr);
......@@ -81,7 +79,7 @@ void TTYDRV_WND_Finalize(WND *wndPtr)
ERR("WND destroyed without destroying the associated Curses Windows");
}
HeapFree(SystemHeap, 0, pWndDriverData);
HeapFree(GetProcessHeap(), 0, pWndDriverData);
wndPtr->pDriverData = NULL;
}
......
......@@ -174,7 +174,7 @@ static ICONCACHE* CURSORICON_FindCache(HANDLE handle)
*/
static void CURSORICON_AddSharedIcon( HMODULE hModule, HRSRC hRsrc, HRSRC hGroupRsrc, HANDLE handle )
{
ICONCACHE *ptr = HeapAlloc( SystemHeap, 0, sizeof(ICONCACHE) );
ICONCACHE *ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(ICONCACHE) );
if ( !ptr ) return;
ptr->hModule = hModule;
......@@ -234,7 +234,7 @@ void CURSORICON_FreeModuleIcons( HMODULE hModule )
*ptr = freePtr->next;
GlobalFree16( freePtr->handle );
HeapFree( SystemHeap, 0, freePtr );
HeapFree( GetProcessHeap(), 0, freePtr );
continue;
}
ptr = &(*ptr)->next;
......
......@@ -23,7 +23,6 @@
#include "win.h"
#include "gdi.h"
#include "region.h"
#include "heap.h"
#include "user.h"
#include "debugtools.h"
#include "windef.h"
......@@ -76,10 +75,10 @@ DCE *DCE_AllocDCE( HWND hWnd, DCE_TYPE type )
DCE * dce;
WND* wnd;
if (!(dce = HeapAlloc( SystemHeap, 0, sizeof(DCE) ))) return NULL;
if (!(dce = HeapAlloc( GetProcessHeap(), 0, sizeof(DCE) ))) return NULL;
if (!(dce->hDC = CreateDCA( "DISPLAY", NULL, NULL, NULL )))
{
HeapFree( SystemHeap, 0, dce );
HeapFree( GetProcessHeap(), 0, dce );
return 0;
}
......@@ -134,7 +133,7 @@ DCE* DCE_FreeDCE( DCE *dce )
DeleteDC( dce->hDC );
if( dce->hClipRgn && !(dce->DCXflags & DCX_KEEPCLIPRGN) )
DeleteObject(dce->hClipRgn);
HeapFree( SystemHeap, 0, dce );
HeapFree( GetProcessHeap(), 0, dce );
WIN_UnlockWnds();
......
......@@ -9,7 +9,6 @@
#include "win.h"
#include "user.h"
#include "heap.h"
#include "nonclient.h"
#include "winpos.h"
#include "dce.h"
......@@ -67,8 +66,8 @@ void DEFWND_SetTextA( WND *wndPtr, LPCSTR text )
if (!text) text = "";
count = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 );
if (wndPtr->text) HeapFree(SystemHeap, 0, wndPtr->text);
if ((wndPtr->text = HeapAlloc(SystemHeap, 0, count * sizeof(WCHAR))))
if (wndPtr->text) HeapFree(GetProcessHeap(), 0, wndPtr->text);
if ((wndPtr->text = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR))))
MultiByteToWideChar( CP_ACP, 0, text, -1, wndPtr->text, count );
else
ERR("Not enough memory for window text");
......@@ -89,8 +88,8 @@ void DEFWND_SetTextW( WND *wndPtr, LPCWSTR text )
if (!text) text = empty_string;
count = strlenW(text) + 1;
if (wndPtr->text) HeapFree(SystemHeap, 0, wndPtr->text);
if ((wndPtr->text = HeapAlloc(SystemHeap, 0, count * sizeof(WCHAR))))
if (wndPtr->text) HeapFree(GetProcessHeap(), 0, wndPtr->text);
if ((wndPtr->text = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR))))
strcpyW( wndPtr->text, text );
else
ERR("Not enough memory for window text");
......@@ -379,10 +378,10 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
return NC_HandleNCActivate( wndPtr, wParam );
case WM_NCDESTROY:
if (wndPtr->text) HeapFree( SystemHeap, 0, wndPtr->text );
if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text );
wndPtr->text = NULL;
if (wndPtr->pVScroll) HeapFree( SystemHeap, 0, wndPtr->pVScroll );
if (wndPtr->pHScroll) HeapFree( SystemHeap, 0, wndPtr->pHScroll );
if (wndPtr->pVScroll) HeapFree( GetProcessHeap(), 0, wndPtr->pVScroll );
if (wndPtr->pHScroll) HeapFree( GetProcessHeap(), 0, wndPtr->pHScroll );
wndPtr->pVScroll = wndPtr->pHScroll = NULL;
return 0;
......
......@@ -1182,8 +1182,8 @@ static void MDI_UpdateFrameText( WND *frameWnd, HWND hClient,
/* store new "default" title if lpTitle is not NULL */
if (lpTitle)
{
if (ci->frameTitle) HeapFree( SystemHeap, 0, ci->frameTitle );
ci->frameTitle = HEAP_strdupW( SystemHeap, 0, lpTitle );
if (ci->frameTitle) HeapFree( GetProcessHeap(), 0, ci->frameTitle );
ci->frameTitle = HEAP_strdupW( GetProcessHeap(), 0, lpTitle );
}
if (ci->frameTitle)
......
......@@ -135,14 +135,14 @@ BOOL WINAPI SetPropA( HWND hwnd, LPCSTR str, HANDLE handle )
/* We need to create it */
WND *pWnd = WIN_FindWndPtr( hwnd );
if (!pWnd) return FALSE;
if (!(prop = HeapAlloc( SystemHeap, 0, sizeof(*prop) )))
if (!(prop = HeapAlloc( GetProcessHeap(), 0, sizeof(*prop) )))
{
WIN_ReleaseWndPtr(pWnd);
return FALSE;
}
if (!(prop->string = SEGPTR_STRDUP(str)))
{
HeapFree( SystemHeap, 0, prop );
HeapFree( GetProcessHeap(), 0, prop );
WIN_ReleaseWndPtr(pWnd);
return FALSE;
......@@ -229,7 +229,7 @@ HANDLE WINAPI RemovePropA( HWND hwnd, LPCSTR str )
handle = prop->handle;
*pprop = prop->next;
SEGPTR_FREE(prop->string);
HeapFree( SystemHeap, 0, prop );
HeapFree( GetProcessHeap(), 0, prop );
return handle;
}
......@@ -264,7 +264,7 @@ void PROPERTY_RemoveWindowProps( WND *pWnd )
{
next = prop->next;
SEGPTR_FREE( prop->string );
HeapFree( SystemHeap, 0, prop );
HeapFree( GetProcessHeap(), 0, prop );
}
pWnd->pProp = NULL;
}
......
......@@ -14,7 +14,6 @@
#include "queue.h"
#include "win.h"
#include "hook.h"
#include "heap.h"
#include "thread.h"
#include "debugtools.h"
#include "server.h"
......@@ -70,7 +69,7 @@ PERQUEUEDATA * PERQDATA_CreateInstance( )
}
/* Allocate PERQUEUEDATA from the system heap */
if (!( pQData = (PERQUEUEDATA *) HeapAlloc( SystemHeap, 0,
if (!( pQData = (PERQUEUEDATA *) HeapAlloc( GetProcessHeap(), 0,
sizeof(PERQUEUEDATA) ) ))
return 0;
......@@ -139,7 +138,7 @@ ULONG PERQDATA_Release( PERQUEUEDATA *pQData )
pQDataWin16 = 0;
/* Free the PERQUEUEDATA instance */
HeapFree( SystemHeap, 0, pQData );
HeapFree( GetProcessHeap(), 0, pQData );
return 0;
}
......@@ -309,16 +308,16 @@ MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue;
HeapLock( SystemHeap ); /* FIXME: a bit overkill */
HeapLock( GetProcessHeap() ); /* FIXME: a bit overkill */
queue = GlobalLock16( hQueue );
if ( !queue || (queue->magic != QUEUE_MAGIC) )
{
HeapUnlock( SystemHeap );
HeapUnlock( GetProcessHeap() );
return NULL;
}
queue->lockCount++;
HeapUnlock( SystemHeap );
HeapUnlock( GetProcessHeap() );
return queue;
}
......@@ -333,7 +332,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue )
{
if (queue)
{
HeapLock( SystemHeap ); /* FIXME: a bit overkill */
HeapLock( GetProcessHeap() ); /* FIXME: a bit overkill */
if ( --queue->lockCount == 0 )
{
......@@ -343,7 +342,7 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue )
GlobalFree16( queue->self );
}
HeapUnlock( SystemHeap );
HeapUnlock( GetProcessHeap() );
}
}
......@@ -551,7 +550,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
/* flush sent messages */
QUEUE_FlushMessages( msgQueue );
HeapLock( SystemHeap ); /* FIXME: a bit overkill */
HeapLock( GetProcessHeap() ); /* FIXME: a bit overkill */
/* Release per queue data if present */
if ( msgQueue->pQData )
......@@ -579,7 +578,7 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
if (pPrev && *pPrev) *pPrev = msgQueue->next;
msgQueue->self = 0;
HeapUnlock( SystemHeap );
HeapUnlock( GetProcessHeap() );
/* free up resource used by MESSAGEQUEUE structure */
msgQueue->lockCount--;
......@@ -1030,7 +1029,7 @@ BOOL QUEUE_AddMsg( HQUEUE16 hQueue, int type, MSG *msg, DWORD extraInfo )
if (!(msgQueue = QUEUE_Lock( hQueue ))) return FALSE;
/* allocate new message in global heap for now */
if (!(qmsg = (QMSG *) HeapAlloc( SystemHeap, 0, sizeof(QMSG) ) ))
if (!(qmsg = (QMSG *) HeapAlloc( GetProcessHeap(), 0, sizeof(QMSG) ) ))
{
QUEUE_Unlock( msgQueue );
return 0;
......@@ -1130,7 +1129,7 @@ void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, QMSG *qmsg )
msgQueue->lastMsg = qmsg->prevMsg;
/* deallocate the memory for the message */
HeapFree( SystemHeap, 0, qmsg );
HeapFree( GetProcessHeap(), 0, qmsg );
msgQueue->msgCount--;
if (!msgQueue->msgCount) msgQueue->wakeBits &= ~QS_POSTMESSAGE;
......@@ -1246,7 +1245,7 @@ void hardware_event( UINT message, WPARAM wParam, LPARAM lParam,
/* Don't merge allocate a new msg in the global heap */
if (!(qmsg = (QMSG *) HeapAlloc( SystemHeap, 0, sizeof(QMSG) ) ))
if (!(qmsg = (QMSG *) HeapAlloc( GetProcessHeap(), 0, sizeof(QMSG) ) ))
{
LeaveCriticalSection( &sysMsgQueue->cSection );
return;
......@@ -1494,13 +1493,13 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags )
queuePtr = QUEUE_Lock( hQueue );
queuePtr->teb = NtCurrentTeb();
HeapLock( SystemHeap ); /* FIXME: a bit overkill */
HeapLock( GetProcessHeap() ); /* FIXME: a bit overkill */
SetThreadQueue16( 0, hQueue );
teb->queue = hQueue;
queuePtr->next = hFirstQueue;
hFirstQueue = hQueue;
HeapUnlock( SystemHeap );
HeapUnlock( GetProcessHeap() );
QUEUE_Unlock( queuePtr );
}
......
......@@ -109,7 +109,7 @@ void WINPOS_CheckInternalPos( WND* wndPtr )
{
if( IsWindow(lpPos->hwndIconTitle) )
DestroyWindow( lpPos->hwndIconTitle );
HeapFree( SystemHeap, 0, lpPos );
HeapFree( GetProcessHeap(), 0, lpPos );
}
QUEUE_Unlock( pMsgQ );
......@@ -1087,7 +1087,7 @@ static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT pt,
/* this happens when the window is minimized/maximized
* for the first time (rectWindow is not adjusted yet) */
lpPos = HeapAlloc( SystemHeap, 0, sizeof(INTERNALPOS) );
lpPos = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNALPOS) );
if( !lpPos ) return NULL;
SetPropA( wnd->hwndSelf, atomInternalPos, (HANDLE)lpPos );
......
......@@ -22,7 +22,6 @@
#include "gdi.h"
#include "options.h"
#include "message.h"
#include "heap.h"
#include "win.h"
#include "windef.h"
#include "x11drv.h"
......@@ -137,8 +136,7 @@ static BOOL X11DRV_WND_IsZeroSizeWnd(WND *wndPtr)
*/
void X11DRV_WND_Initialize(WND *wndPtr)
{
X11DRV_WND_DATA *pWndDriverData =
(X11DRV_WND_DATA *) HeapAlloc(SystemHeap, 0, sizeof(X11DRV_WND_DATA));
X11DRV_WND_DATA *pWndDriverData = HeapAlloc(GetProcessHeap(), 0, sizeof(X11DRV_WND_DATA));
wndPtr->pDriverData = (void *) pWndDriverData;
......@@ -165,7 +163,7 @@ void X11DRV_WND_Finalize(WND *wndPtr)
pWndDriverData->window
);
}
HeapFree(SystemHeap, 0, wndPtr->pDriverData);
HeapFree(GetProcessHeap(), 0, wndPtr->pDriverData);
wndPtr->pDriverData = NULL;
}
......
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