Fixed GlobalSize return value for zero size block.

This commit is contained in:
Guy Albertelli 1999-02-14 17:38:24 +00:00 committed by Alexandre Julliard
parent 3dbc7881ea
commit 3db8e19d22
2 changed files with 5 additions and 1 deletions

View File

@ -1370,6 +1370,8 @@ DWORD WINAPI GlobalSize32(
if(pintern->Magic==MAGIC_GLOBAL_USED)
{
if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */
return 0;
retval=HeapSize(GetProcessHeap(), 0,
(char *)(pintern->Pointer)-sizeof(HGLOBAL32))-4;
}
@ -1380,6 +1382,8 @@ DWORD WINAPI GlobalSize32(
}
/* HeapUnlock(GetProcessHeap()); */
}
/* HeapSize returns 0xffffffff on failure */
if (retval == 0xffffffff) retval = 0;
return retval;
}

View File

@ -1204,7 +1204,7 @@ BOOL32 WINAPI HeapUnlock(
* HeapSize (KERNEL32.341)
* RETURNS
* Size in bytes of allocated memory
* 0: Failure
* 0xffffffff: Failure
*/
DWORD WINAPI HeapSize(
HANDLE32 heap, /* [in] Handle of heap */