Helo :) This question is pretty basic... If I allocated lots of space and need to enlarge it I call GlobalReAlloc.. This goes like this: GlobalAlloc GlobalLock ... GlobalReAlloc GlobalLock $10 Question: can I move the eax returned by GlobalReAlloc into the same memory handle I got from GlobalAlloc? Or should I use two different handles? $20 Question: Can I call GlobalUnlock/GlobalFree with the pointer/handle returned by GlobalAlloc after calling GlobalReAlloc making the return value into another handle? Thanks - Jimmy
Posted on 2001-03-30 06:01:00 by JimmyClif
Well my $1 answer is do't use Globalxxx functions, they are obsolete, use Heap... functions instead :)


invoke GetProcessHeap
mov hHeap,eax
invoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,1024
mov DataPtr,eax
now DataPtr, points to 1024 bytes of zero'd RAM Umbongo
Posted on 2001-03-30 06:10:00 by umbongo
Invoking GlobalReAlloc will replace the old handle. In otherwords, the old handle is invalid, and the new one is the only one that can be used with other Global*** functions. Can I have my $30 now :P Mirno
Posted on 2001-03-30 06:13:00 by Mirno
the GlobalRealloc function is the only one, which preserves the contents of the memory block! If you need this feature, you must use the GlobalXXX API. By the way, also the HeapXXX API is not state of the (MS) art, the most common one is the VirtualXXX.
Posted on 2001-04-05 05:29:00 by beaster
Virtualxxx is the lowest level interface for memory management in the Win32 API. Heapxxx uses Virtualxxx. Globalxxx and Localxxx uses Heapxxx. Globalxxx and Localxxx were implemented primarily for source code compatibility with Win16 programs. Some versions of VC++ implement malloc as a call to HeapAlloc. This message was edited by tank, on 4/5/2001 7:00:18 PM
Posted on 2001-04-05 18:59:00 by tank