Commit 9150071b authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

kernel32: Remove shared heap functionality.

parent 40c7cb0b
...@@ -41,58 +41,10 @@ ...@@ -41,58 +41,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(globalmem); WINE_DEFAULT_DEBUG_CHANNEL(globalmem);
/* address where we try to map the system heap */
#define SYSTEM_HEAP_BASE ((void*)0x80000000)
#define SYSTEM_HEAP_SIZE 0x1000000 /* Default heap size = 16Mb */
static HANDLE systemHeap; /* globally shared heap */
BOOLEAN WINAPI RtlGetUserInfoHeap( HANDLE handle, ULONG flags, void *ptr, void **user_value, ULONG *user_flags ); BOOLEAN WINAPI RtlGetUserInfoHeap( HANDLE handle, ULONG flags, void *ptr, void **user_value, ULONG *user_flags );
BOOLEAN WINAPI RtlSetUserValueHeap( HANDLE handle, ULONG flags, void *ptr, void *user_value ); BOOLEAN WINAPI RtlSetUserValueHeap( HANDLE handle, ULONG flags, void *ptr, void *user_value );
/*********************************************************************** /***********************************************************************
* HEAP_CreateSystemHeap
*
* Create the system heap.
*/
static inline HANDLE HEAP_CreateSystemHeap(void)
{
int created;
void *base;
HANDLE map, event;
/* create the system heap event first */
event = CreateEventA( NULL, TRUE, FALSE, "__wine_system_heap_event" );
if (!(map = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, SEC_COMMIT | PAGE_READWRITE,
0, SYSTEM_HEAP_SIZE, "__wine_system_heap" ))) return 0;
created = (GetLastError() != ERROR_ALREADY_EXISTS);
if (!(base = MapViewOfFileEx( map, FILE_MAP_ALL_ACCESS, 0, 0, 0, SYSTEM_HEAP_BASE )))
{
/* pre-defined address not available */
ERR( "system heap base address %p not available\n", SYSTEM_HEAP_BASE );
return 0;
}
if (created) /* newly created heap */
{
systemHeap = RtlCreateHeap( HEAP_SHARED, base, SYSTEM_HEAP_SIZE,
SYSTEM_HEAP_SIZE, NULL, NULL );
SetEvent( event );
}
else
{
/* wait for the heap to be initialized */
WaitForSingleObject( event, INFINITE );
systemHeap = base;
}
CloseHandle( map );
return systemHeap;
}
/***********************************************************************
* HeapCreate (KERNEL32.@) * HeapCreate (KERNEL32.@)
* *
* Create a heap object. * Create a heap object.
...@@ -108,17 +60,8 @@ HANDLE WINAPI HeapCreate( ...@@ -108,17 +60,8 @@ HANDLE WINAPI HeapCreate(
) { ) {
HANDLE ret; HANDLE ret;
if ( flags & HEAP_SHARED ) ret = RtlCreateHeap( flags, NULL, maxSize, initialSize, NULL, NULL );
{ if (!ret) SetLastError( ERROR_NOT_ENOUGH_MEMORY );
if (!systemHeap) HEAP_CreateSystemHeap();
else WARN( "Shared Heap requested, returning system heap.\n" );
ret = systemHeap;
}
else
{
ret = RtlCreateHeap( flags, NULL, maxSize, initialSize, NULL, NULL );
if (!ret) SetLastError( ERROR_NOT_ENOUGH_MEMORY );
}
return ret; return ret;
} }
...@@ -134,11 +77,6 @@ HANDLE WINAPI HeapCreate( ...@@ -134,11 +77,6 @@ HANDLE WINAPI HeapCreate(
*/ */
BOOL WINAPI HeapDestroy( HANDLE heap /* [in] Handle of heap */ ) BOOL WINAPI HeapDestroy( HANDLE heap /* [in] Handle of heap */ )
{ {
if (heap == systemHeap)
{
WARN( "attempt to destroy system heap, returning TRUE!\n" );
return TRUE;
}
if (!RtlDestroyHeap( heap )) return TRUE; if (!RtlDestroyHeap( heap )) return TRUE;
SetLastError( ERROR_INVALID_HANDLE ); SetLastError( ERROR_INVALID_HANDLE );
return FALSE; return FALSE;
......
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