2 * reactos memory pools emulation of libcaptive
3 * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "captive/mm.h" /* self */
23 #include "reactos/internal/mm.h" /* self */
24 #include "reactos/ntos/types.h" /* for PVOID etc. */
25 #include <glib/gmessages.h>
26 #include <glib/gmem.h>
30 * ExAllocatePoolWithTag:
31 * @PoolType: Type of memory to allocate. Safely ignored by libcaptive as it is
32 * too low level for it.
33 * @NumberOfBytes: Size of the requested allocation. Value 0 permitted (returns %NULL).
34 * @Tag: 4-bytes of block identification for debugging purposes.
35 * Ignored by libcaptive.
37 * Allocates the specified memory block. libcaptive passes the allocation to
38 * g_malloc(). @Tag is no longer trackable for the allocated memory block.
39 * @Tag is ignored by libcaptive.
41 * Returns: Memory block base if successfuly allocated. %NULL otherwise.
42 * The allocated memory block is not cleared.
44 PVOID ExAllocatePoolWithTag(ULONG PoolType,ULONG NumberOfBytes,ULONG Tag)
49 return g_malloc(NumberOfBytes);
54 * @PoolType: Type of memory to allocate. Safely ignored by libcaptive as it is
55 * too low level for it.
56 * @NumberOfBytes: Size of the requested allocation. Value 0 permitted (returns %NULL).
58 * Allocates the specified memory block. Calls ExAllocatePoolWithTag() with
59 * undeterministic @Tag value.
61 * Returns: Memory block base if successfuly allocated. %NULL otherwise.
62 * The allocated memory block is not cleared.
64 PVOID ExAllocatePool(POOL_TYPE PoolType,ULONG NumberOfBytes)
66 return ExAllocatePoolWithTag(PoolType,NumberOfBytes,
67 0); /* Tag; reactos uses TAG_NONE ('None') but it is not documented for W32 */
72 * @Block: Base address of the memory block. %NULL value is forbidden.
74 * Deallocate the given memory block. Block must be already successfuly
75 * allocated by a previous ExAllocatePool() or ExAllocatePoolWithTag() call.
76 * You can no longer assume anything about this base address / memory block.
78 VOID ExFreePool(IN PVOID Block)
80 g_return_if_fail(Block!=NULL);