Removed dependency on ntdll_misc.h.
[wine/wine64.git] / memory / heap.c
blob4e71b1322bac94098f81de3c2ba9d4ee88c1e95b
1 /*
2 * Win32 heap functions
4 * Copyright 1996 Alexandre Julliard
5 * Copyright 1998 Ulrich Weigand
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
24 #include <assert.h>
25 #include <stdlib.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <string.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winerror.h"
33 #include "winnt.h"
34 #include "winreg.h"
35 #include "winternl.h"
36 #include "wine/unicode.h"
37 #include "thread.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(heap);
42 /***********************************************************************
43 * HeapLock (KERNEL32.@)
44 * Attempts to acquire the critical section object for a specified heap.
46 * RETURNS
47 * TRUE: Success
48 * FALSE: Failure
50 BOOL WINAPI HeapLock(
51 HANDLE heap /* [in] Handle of heap to lock for exclusive access */
52 ) {
53 return RtlLockHeap( heap );
57 /***********************************************************************
58 * HeapUnlock (KERNEL32.@)
59 * Releases ownership of the critical section object.
61 * RETURNS
62 * TRUE: Success
63 * FALSE: Failure
65 BOOL WINAPI HeapUnlock(
66 HANDLE heap /* [in] Handle to the heap to unlock */
67 ) {
68 return RtlUnlockHeap( heap );
72 /***********************************************************************
73 * GetProcessHeap (KERNEL32.@)
75 HANDLE WINAPI GetProcessHeap(void)
77 return NtCurrentTeb()->Peb->ProcessHeap;
81 /* FIXME: these functions are needed for dlls that aren't properly separated yet */
83 LPVOID WINAPI HeapAlloc( HANDLE heap, DWORD flags, SIZE_T size )
85 return RtlAllocateHeap( heap, flags, size );
88 BOOL WINAPI HeapFree( HANDLE heap, DWORD flags, LPVOID ptr )
90 return RtlFreeHeap( heap, flags, ptr );
93 LPVOID WINAPI HeapReAlloc( HANDLE heap, DWORD flags, LPVOID ptr, SIZE_T size )
95 return RtlReAllocateHeap( heap, flags, ptr, size );
98 SIZE_T WINAPI HeapSize( HANDLE heap, DWORD flags, LPVOID ptr )
100 return RtlSizeHeap( heap, flags, ptr );