mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 20:03:37 +00:00
kernelbase: Avoid moving locked HLOCAL pointer without LMEM_MOVEABLE.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474
This commit is contained in:
parent
c2c6536926
commit
f43fc5121b
|
@ -2451,17 +2451,17 @@ static void test_LocalAlloc(void)
|
|||
|
||||
tmp_mem = LocalReAlloc( mem, 512, flags );
|
||||
if (!(flags & LMEM_MODIFY) && ((flags & LMEM_DISCARDABLE) || !(flags & LMEM_MOVEABLE)))
|
||||
todo_wine_if(flags == LMEM_FIXED) ok( !tmp_mem, "LocalReAlloc succeeded\n" );
|
||||
ok( !tmp_mem, "LocalReAlloc succeeded\n" );
|
||||
else
|
||||
ok( tmp_mem == mem, "LocalReAlloc returned %p, error %lu\n", tmp_mem, GetLastError() );
|
||||
entry = *mem_entry_from_HANDLE( mem );
|
||||
if ((flags & LMEM_DISCARDABLE) && (flags & LMEM_MODIFY)) expect_entry.flags |= 4;
|
||||
if (flags == LMEM_MOVEABLE) ok( entry.ptr != expect_entry.ptr, "got unexpected ptr %p\n", entry.ptr );
|
||||
else todo_wine_if(flags == LMEM_FIXED) ok( entry.ptr == expect_entry.ptr, "got ptr %p\n", entry.ptr );
|
||||
else ok( entry.ptr == expect_entry.ptr, "got ptr %p\n", entry.ptr );
|
||||
ok( entry.flags == expect_entry.flags, "got flags %#Ix was %#Ix\n", entry.flags, expect_entry.flags );
|
||||
size = LocalSize( mem );
|
||||
if (flags == LMEM_MOVEABLE) ok( size == 512, "LocalSize returned %Iu\n", size );
|
||||
else todo_wine_if(flags == LMEM_FIXED) ok( size == 10, "LocalSize returned %Iu\n", size );
|
||||
else ok( size == 10, "LocalSize returned %Iu\n", size );
|
||||
|
||||
ret = LocalUnlock( mem );
|
||||
ok( !ret, "LocalUnlock succeeded\n" );
|
||||
|
|
|
@ -1011,6 +1011,7 @@ HLOCAL WINAPI DECLSPEC_HOTPATCH LocalReAlloc( HLOCAL handle, SIZE_T size, UINT f
|
|||
{
|
||||
if (size)
|
||||
{
|
||||
if (mem->lock && !(flags & LMEM_MOVEABLE)) heap_flags |= HEAP_REALLOC_IN_PLACE_ONLY;
|
||||
if (!mem->ptr) ptr = HeapAlloc( heap, heap_flags, size );
|
||||
else ptr = HeapReAlloc( heap, heap_flags, mem->ptr, size );
|
||||
|
||||
|
|
Loading…
Reference in a new issue