From 9f7907eb698f62877492d1626392d260e5512753 Mon Sep 17 00:00:00 2001 From: Peter Ganten Date: Tue, 1 Aug 2000 23:38:02 +0000 Subject: [PATCH] Moved Wine private heap creation flags to other values. Return system heap when a shared heap is requested. --- include/winnt.h | 12 ++++++++---- memory/heap.c | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/winnt.h b/include/winnt.h index 8e685780ed6..93524cd72b0 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -163,10 +163,14 @@ typedef struct _SINGLE_LIST_ENTRY { #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 #define HEAP_CREATE_ALIGN_16 0x00010000 #define HEAP_CREATE_ENABLE_TRACING 0x00020000 -#define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */ -#define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */ -#define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */ -#define HEAP_WINE_SHARED 0x08000000 /* Not a Win32 flag */ + +/* This flag allows it to create heaps shared by all processes under win95, + FIXME: correct name */ +#define HEAP_SHARED 0x04000000 + +#define HEAP_WINE_SEGPTR 0x10000000 /* Not a Win32 flag */ +#define HEAP_WINE_CODESEG 0x20000000 /* Not a Win32 flag */ +#define HEAP_WINE_CODE16SEG 0x40000000 /* Not a Win32 flag */ /* Processor feature flags. */ #define PF_FLOATING_POINT_PRECISION_ERRATA 0 diff --git a/memory/heap.c b/memory/heap.c index 80ffe48314c..62bae3ac46e 100644 --- a/memory/heap.c +++ b/memory/heap.c @@ -430,7 +430,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena ) /* Decommit the end of the heap */ - if (!(subheap->heap->flags & HEAP_WINE_SHARED)) HEAP_Decommit( subheap, pFree + 1 ); + if (!(subheap->heap->flags & HEAP_SHARED)) HEAP_Decommit( subheap, pFree + 1 ); } @@ -469,7 +469,7 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags, /* Commit memory */ - if (flags & HEAP_WINE_SHARED) + if (flags & HEAP_SHARED) commitSize = totalSize; /* always commit everything in a shared heap */ if (!VirtualAlloc(address, commitSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE)) { @@ -998,6 +998,11 @@ HANDLE WINAPI HeapCreate( ) { SUBHEAP *subheap; + if ( flags & HEAP_SHARED ) { + FIXME ( "Shared Heap requested, returning system heap.\n" ); + return SystemHeap; + } + /* Allocate the heap block */ if (!maxSize) @@ -1039,6 +1044,11 @@ BOOL WINAPI HeapDestroy( HANDLE heap /* [in] Handle of heap */ ) HEAP *heapPtr = HEAP_GetPtr( heap ); SUBHEAP *subheap; + if ( heap == SystemHeap ) { + FIXME ( "attempt to destroy system heap, returning TRUE!\n" ); + return TRUE; + } + TRACE("%08x\n", heap ); if (!heapPtr) return FALSE; @@ -1570,7 +1580,7 @@ BOOL HEAP_CreateSystemHeap(void) if (created) /* newly created heap */ { - HEAP_InitSubHeap( heapPtr, heapPtr, HEAP_WINE_SHARED, 0, HEAP_DEF_SIZE ); + HEAP_InitSubHeap( heapPtr, heapPtr, HEAP_SHARED, 0, HEAP_DEF_SIZE ); HeapLock( heap ); descr = heapPtr->private = HeapAlloc( heap, HEAP_ZERO_MEMORY, sizeof(*descr) ); assert( descr );