Ntdll implements the user heaps. Don't try to handle this yourself.

svn path=/trunk/; revision=7847
This commit is contained in:
Eric Kohl 2004-01-23 19:59:15 +00:00
parent c6651faa5f
commit a27a41929d

View file

@ -1,31 +1,12 @@
#include <windows.h>
#include <kernel32/heap.h>
#include <msvcrt/malloc.h>
#include <msvcrt/stdlib.h>
/*
* @implemented
*/
void* _expand(void* pold, size_t size)
{
PHEAP_BUCKET pbucket;
PHEAP_SUBALLOC psub;
PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE);
/* sanity checks */
if (pfrag->Magic != HEAP_FRAG_MAGIC)
return NULL;
/* get bucket size */
psub = pfrag->Sub;
pbucket = psub->Bucket;
if(size <= pbucket->Size) {
pfrag->Size=size;
return pold;
}
else
return NULL;
return NULL;
return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, pold, size);
}
/*
@ -33,16 +14,5 @@ void* _expand(void* pold, size_t size)
*/
size_t _msize(void* pBlock)
{
PHEAP_BUCKET pbucket;
PHEAP_SUBALLOC psub;
PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pBlock-HEAP_FRAG_ADMIN_SIZE);
/* sanity checks */
if (pfrag->Magic != HEAP_FRAG_MAGIC)
return 0;
/* get bucket size */
psub = pfrag->Sub;
pbucket = psub->Bucket;
return pbucket->Size;
return HeapSize (GetProcessHeap(), 0, pBlock);
}