Implemented GetCPInfoExA/W.
[wine] / memory / heap.c
1 /*
2  * Win32 heap functions
3  *
4  * Copyright 1996 Alexandre Julliard
5  * Copyright 1998 Ulrich Weigand
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #include "config.h"
23
24 #include <assert.h>
25 #include <stdlib.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <string.h>
29
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"
39
40 WINE_DEFAULT_DEBUG_CHANNEL(heap);
41
42 /***********************************************************************
43  *           HeapLock   (KERNEL32.@)
44  * Attempts to acquire the critical section object for a specified heap.
45  *
46  * RETURNS
47  *      TRUE: Success
48  *      FALSE: Failure
49  */
50 BOOL WINAPI HeapLock(
51               HANDLE heap /* [in] Handle of heap to lock for exclusive access */
52 ) {
53     return RtlLockHeap( heap );
54 }
55
56
57 /***********************************************************************
58  *           HeapUnlock   (KERNEL32.@)
59  * Releases ownership of the critical section object.
60  *
61  * RETURNS
62  *      TRUE: Success
63  *      FALSE: Failure
64  */
65 BOOL WINAPI HeapUnlock(
66               HANDLE heap /* [in] Handle to the heap to unlock */
67 ) {
68     return RtlUnlockHeap( heap );
69 }
70
71
72 /***********************************************************************
73  *           GetProcessHeap    (KERNEL32.@)
74  */
75 HANDLE WINAPI GetProcessHeap(void)
76 {
77     return NtCurrentTeb()->Peb->ProcessHeap;
78 }
79
80
81 /* FIXME: these functions are needed for dlls that aren't properly separated yet */
82
83 LPVOID WINAPI HeapAlloc( HANDLE heap, DWORD flags, SIZE_T size )
84 {
85     return RtlAllocateHeap( heap, flags, size );
86 }
87
88 BOOL WINAPI HeapFree( HANDLE heap, DWORD flags, LPVOID ptr )
89 {
90     return RtlFreeHeap( heap, flags, ptr );
91 }
92
93 LPVOID WINAPI HeapReAlloc( HANDLE heap, DWORD flags, LPVOID ptr, SIZE_T size )
94 {
95     return RtlReAllocateHeap( heap, flags, ptr, size );
96 }
97
98 SIZE_T WINAPI HeapSize( HANDLE heap, DWORD flags, LPVOID ptr )
99 {
100     return RtlSizeHeap( heap, flags, ptr );
101 }