Moved Wine private heap creation flags to other values.
Return system heap when a shared heap is requested.
diff --git a/include/winnt.h b/include/winnt.h
index 8e68578..93524cd 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -163,10 +163,14 @@
#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 80ffe48..62bae3a 100644
--- a/memory/heap.c
+++ b/memory/heap.c
@@ -430,7 +430,7 @@
/* 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 @@
/* 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 @@
) {
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 @@
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 @@
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 );