kernel32: Fix some 64-bit issues in GlobalSize().
This commit is contained in:
parent
fed025fd42
commit
4b12e9c5a0
|
@ -808,7 +808,7 @@ HGLOBAL WINAPI GlobalFree(HGLOBAL hmem)
|
|||
*/
|
||||
SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
|
||||
{
|
||||
DWORD retval;
|
||||
SIZE_T retval;
|
||||
PGLOBAL32_INTERN pintern;
|
||||
|
||||
if (!((ULONG_PTR)hmem >> 16))
|
||||
|
@ -821,10 +821,10 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
|
|||
{
|
||||
retval=HeapSize(GetProcessHeap(), 0, hmem);
|
||||
|
||||
if (retval == (DWORD)-1) /* It might be a GMEM_MOVEABLE data pointer */
|
||||
if (retval == ~0ul) /* It might be a GMEM_MOVEABLE data pointer */
|
||||
{
|
||||
retval = HeapSize(GetProcessHeap(), 0, (char*)(hmem) - HGLOBAL_STORAGE);
|
||||
if (retval != (DWORD)-1) retval -= HGLOBAL_STORAGE;
|
||||
retval = HeapSize(GetProcessHeap(), 0, (char*)hmem - HGLOBAL_STORAGE);
|
||||
if (retval != ~0ul) retval -= HGLOBAL_STORAGE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -838,9 +838,8 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
|
|||
retval = 0;
|
||||
else
|
||||
{
|
||||
retval = HeapSize(GetProcessHeap(), 0,
|
||||
(char *)(pintern->Pointer) - HGLOBAL_STORAGE );
|
||||
if (retval != (DWORD)-1) retval -= HGLOBAL_STORAGE;
|
||||
retval = HeapSize(GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE );
|
||||
if (retval != ~0ul) retval -= HGLOBAL_STORAGE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -851,8 +850,7 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
|
|||
}
|
||||
RtlUnlockHeap(GetProcessHeap());
|
||||
}
|
||||
/* HeapSize returns 0xffffffff on failure */
|
||||
if (retval == 0xffffffff) retval = 0;
|
||||
if (retval == ~0ul) retval = 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue