Does on all modern Win32 OS, HeapSize() return exactly the number of bytes requested during HeapAlloc() ?
I'm thinking of relying on this API function for some code of mine.
invoke HeapAlloc,pHeap1,0,107 ; request 107 bytes
invoke HeapSize,pHeap1,0,eax
; is EAX==107 ??
I'm thinking of relying on this API function for some code of mine.
Good question, PlatformSDK doesn't say anything 100% specific... It wouldn't surprise me if, at least on some windows versions, it could return a rounded number.
MSDN is fairly clear on this, HeapAlloc is the problem, it will not always allocate exactly the numbe rof bytes requested but will allocate "at least" the number requested. Heap size will always return the exact number of bytes allocated which may or may not match the number requested.
If HeapAlloc succeeds, it allocates at least the amount of memory requested. If the actual amount allocated is greater than the amount requested, the process can use the entire amount. To determine the actual size of the allocated block, use the HeapSize function.
Thanks,
shame on me for not noticing :oops:
shame on me for not noticing :oops: