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
33 #include "../include/debug.h"
35 /*********************************************************************
36 * HeapCreate -- KERNEL32 *
37 *********************************************************************/
41 HANDLE STDCALL
HeapCreate(DWORD flags
, DWORD dwInitialSize
, DWORD dwMaximumSize
)
44 DPRINT("HeapCreate( 0x%lX, 0x%lX, 0x%lX )\n", flags
, dwInitialSize
, dwMaximumSize
);
45 return(RtlCreateHeap(flags
, NULL
, dwMaximumSize
, dwInitialSize
, NULL
, NULL
));
48 /*********************************************************************
49 * HeapDestroy -- KERNEL32 *
50 *********************************************************************/
54 BOOL WINAPI
HeapDestroy(HANDLE hheap
)
56 if (hheap
== RtlGetProcessHeap())
61 if (RtlDestroyHeap( hheap
)==NULL
) return TRUE
;
62 SetLastError( ERROR_INVALID_HANDLE
);
66 /*********************************************************************
67 * GetProcessHeap -- KERNEL32 *
68 *********************************************************************/
72 HANDLE WINAPI
GetProcessHeap(VOID
)
74 DPRINT("GetProcessHeap()\n");
75 return(RtlGetProcessHeap());
78 /********************************************************************
79 * GetProcessHeaps -- KERNEL32 *
80 ********************************************************************/
84 DWORD WINAPI
GetProcessHeaps(DWORD maxheaps
, PHANDLE phandles
)
86 return(RtlGetProcessHeaps(maxheaps
, phandles
));
89 /*********************************************************************
90 * HeapLock -- KERNEL32 *
91 *********************************************************************/
95 BOOL WINAPI
HeapLock(HANDLE hheap
)
97 return(RtlLockHeap(hheap
));
100 /*********************************************************************
101 * HeapUnlock -- KERNEL32 *
102 *********************************************************************/
106 BOOL WINAPI
HeapUnlock(HANDLE hheap
)
108 return(RtlUnlockHeap(hheap
));
111 /*********************************************************************
112 * HeapCompact -- KERNEL32 *
114 * NT uses this function to compact moveable blocks and other things *
115 * Here it does not compact, but it finds the largest free region *
116 *********************************************************************/
120 SIZE_T WINAPI
HeapCompact(HANDLE hheap
, DWORD flags
)
122 return RtlCompactHeap(hheap
, flags
);
125 /*********************************************************************
126 * HeapValidate -- KERNEL32 *
127 *********************************************************************/
131 BOOL WINAPI
HeapValidate(HANDLE hheap
, DWORD flags
, LPCVOID pmem
)
133 return(RtlValidateHeap(hheap
, flags
, (PVOID
)pmem
));
149 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
169 Status
= RtlExtendHeap(Unknown1
, Unknown2
, Unknown3
, Unknown4
);
170 if (!NT_SUCCESS(Status
))
172 SetLastErrorByStatus(Status
);
178 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
196 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
212 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
230 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
242 LPPROCESS_HEAP_ENTRY lpEntry
245 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);