ntdll: Fix RtlSizeHeap() error value for 64-bit.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-15 12:06:32 +02:00
parent 82dc024a35
commit 704d0662be
3 changed files with 11 additions and 11 deletions

View File

@ -333,10 +333,10 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
{
retval=HeapSize(GetProcessHeap(), 0, hmem);
if (retval == ~0ul) /* It might be a GMEM_MOVEABLE data pointer */
if (retval == ~(SIZE_T)0) /* It might be a GMEM_MOVEABLE data pointer */
{
retval = HeapSize(GetProcessHeap(), 0, (char*)hmem - HGLOBAL_STORAGE);
if (retval != ~0ul) retval -= HGLOBAL_STORAGE;
if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
@ -351,7 +351,7 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
else
{
retval = HeapSize(GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE );
if (retval != ~0ul) retval -= HGLOBAL_STORAGE;
if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
@ -362,7 +362,7 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
}
RtlUnlockHeap(GetProcessHeap());
}
if (retval == ~0ul) retval = 0;
if (retval == ~(SIZE_T)0) retval = 0;
return retval;
}

View File

@ -116,7 +116,7 @@ C_ASSERT( HEAP_MAX_SMALL_FREE_LIST % ALIGNMENT == 0 );
/* Max size of the blocks on the free lists above HEAP_MAX_SMALL_FREE_LIST */
static const SIZE_T HEAP_freeListSizes[] =
{
0x200, 0x400, 0x1000, ~0UL
0x200, 0x400, 0x1000, ~(SIZE_T)0
};
#define HEAP_NB_FREE_LISTS (ARRAY_SIZE( HEAP_freeListSizes ) + HEAP_NB_SMALL_FREE_LISTS)
@ -2007,7 +2007,7 @@ SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, const void *ptr )
if (!heapPtr)
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE );
return ~0UL;
return ~(SIZE_T)0;
}
flags &= HEAP_NO_SERIALIZE;
flags |= heapPtr->flags;
@ -2017,7 +2017,7 @@ SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, const void *ptr )
if (!validate_block_pointer( heapPtr, &subheap, pArena ))
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
ret = ~0UL;
ret = ~(SIZE_T)0;
}
else if (!subheap)
{

View File

@ -386,7 +386,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, params );
ok( size != ~0UL, "not a heap block %p\n", params );
ok( size != ~(SIZE_T)0, "not a heap block %p\n", params );
ok( params->AllocationSize == params->Size,
"wrong AllocationSize %x/%x\n", params->AllocationSize, params->Size );
}
@ -456,7 +456,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, params );
ok( size != ~0UL, "not a heap block %p\n", params );
ok( size != ~(SIZE_T)0, "not a heap block %p\n", params );
ok( params->AllocationSize == params->Size,
"wrong AllocationSize %x/%x\n", params->AllocationSize, params->Size );
}
@ -509,7 +509,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, cur_params );
ok( size != ~0UL, "not a heap block %p\n", cur_params );
ok( size != ~(SIZE_T)0, "not a heap block %p\n", cur_params );
ok( cur_params->AllocationSize == cur_params->Size,
"wrong AllocationSize %x/%x\n", cur_params->AllocationSize, cur_params->Size );
ok( cur_params->Size == size, "wrong Size %x/%lx\n", cur_params->Size, size );
@ -548,7 +548,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, initial_env );
ok( size != ~0UL, "env is not a heap block %p / %p\n", cur_params, initial_env );
ok( size != ~(SIZE_T)0, "env is not a heap block %p / %p\n", cur_params, initial_env );
}
}