1 /* $Id: heap.c,v 1.17 2001/02/17 00:01:26 ekohl Exp $
4 * Copyright (C) 1996, Onno Hovers, All rights reserved
6 * This software is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This software is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this software; see the file COPYING.LIB. If
18 * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 * Cambridge, MA 02139, USA.
21 * Win32 heap functions (HeapXXX).
26 * Adapted for the ReactOS system libraries by David Welch (welch@mcmail.com)
27 * Put the type definitions of the heap in a seperate header. Boudewijn Dekker
30 #include <ddk/ntddk.h>
31 #include <ntdll/rtl.h>
34 #include <kernel32/kernel32.h>
36 /*********************************************************************
37 * HeapCreate -- KERNEL32 *
38 *********************************************************************/
39 HANDLE STDCALL
HeapCreate(DWORD flags
, DWORD minsize
, DWORD maxsize
)
42 DPRINT("HeapCreate( 0x%lX, 0x%lX, 0x%lX )\n", flags
, minsize
, maxsize
);
43 return(RtlCreateHeap(flags
, NULL
, maxsize
, minsize
, NULL
, NULL
));
46 /*********************************************************************
47 * HeapDestroy -- KERNEL32 *
48 *********************************************************************/
49 BOOL WINAPI
HeapDestroy(HANDLE hheap
)
51 return(RtlDestroyHeap(hheap
));
54 /*********************************************************************
55 * GetProcessHeap -- KERNEL32 *
56 *********************************************************************/
57 HANDLE WINAPI
GetProcessHeap(VOID
)
59 DPRINT("GetProcessHeap()\n");
60 return(RtlGetProcessHeap());
63 /********************************************************************
64 * GetProcessHeaps -- KERNEL32 *
66 * NOTE in Win95 this function is not implemented and just returns *
67 * ERROR_CALL_NOT_IMPLEMENTED *
68 ********************************************************************/
69 DWORD WINAPI
GetProcessHeaps(DWORD maxheaps
, PHANDLE phandles
)
72 return(ERROR_CALL_NOT_IMPLEMENTED
);
75 /*********************************************************************
76 * HeapLock -- KERNEL32 *
77 *********************************************************************/
78 BOOL WINAPI
HeapLock(HANDLE hheap
)
80 return(RtlLockHeap(hheap
));
83 /*********************************************************************
84 * HeapUnlock -- KERNEL32 *
85 *********************************************************************/
86 BOOL WINAPI
HeapUnlock(HANDLE hheap
)
88 return(RtlUnlockHeap(hheap
));
91 /*********************************************************************
92 * HeapCompact -- KERNEL32 *
94 * NT uses this function to compact moveable blocks and other things *
95 * Here it does not compact, but it finds the largest free region *
96 *********************************************************************/
98 HeapCompact(HANDLE hheap
,
101 return RtlCompactHeap(hheap
, flags
);
104 /*********************************************************************
105 * HeapValidate -- KERNEL32 *
107 * NOTE: only implemented in NT *
108 *********************************************************************/
109 BOOL WINAPI
HeapValidate(HANDLE hheap
, DWORD flags
, LPCVOID pmem
)
111 return(RtlValidateHeap(hheap
, flags
, (PVOID
)pmem
));