Commit 9ab603b0 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

kernel32: Don't move fixed memory area in GlobalReAlloc.

parent 4874b806
...@@ -646,6 +646,8 @@ HGLOBAL WINAPI GlobalReAlloc( ...@@ -646,6 +646,8 @@ HGLOBAL WINAPI GlobalReAlloc(
if(ISPOINTER(hmem)) if(ISPOINTER(hmem))
{ {
/* reallocate fixed memory */ /* reallocate fixed memory */
if (!(flags & GMEM_MOVEABLE))
heap_flags |= HEAP_REALLOC_IN_PLACE_ONLY;
hnew=HeapReAlloc(GetProcessHeap(), heap_flags, hmem, size); hnew=HeapReAlloc(GetProcessHeap(), heap_flags, hmem, size);
} }
else else
......
...@@ -251,17 +251,9 @@ static void test_heap(void) ...@@ -251,17 +251,9 @@ static void test_heap(void)
gbl = GlobalAlloc(GMEM_FIXED, init_size); gbl = GlobalAlloc(GMEM_FIXED, init_size);
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
hsecond = GlobalReAlloc(gbl, size + init_size, 0); hsecond = GlobalReAlloc(gbl, size + init_size, 0);
if (hsecond != gbl) { ok(hsecond == gbl || (hsecond == NULL && GetLastError() == ERROR_NOT_ENOUGH_MEMORY),
todo_wine "got %p with %x (expected %p or NULL) @%ld\n", hsecond, GetLastError(), gbl, size);
ok(hsecond == gbl || (hsecond == NULL && GetLastError() == ERROR_NOT_ENOUGH_MEMORY), GlobalFree(gbl);
"got %p with %x (expected %p or NULL) @%ld\n", hsecond, GetLastError(), gbl, size);
GlobalFree(hsecond);
}
else {
ok(hsecond == gbl || (hsecond == NULL && GetLastError() == ERROR_NOT_ENOUGH_MEMORY),
"got %p with %x (expected %p or NULL) @%ld\n", hsecond, GetLastError(), gbl, size);
GlobalFree(gbl);
}
} }
/* GMEM_FIXED block can be relocated with GMEM_MOVEABLE */ /* GMEM_FIXED block can be relocated with GMEM_MOVEABLE */
...@@ -418,17 +410,9 @@ static void test_heap(void) ...@@ -418,17 +410,9 @@ static void test_heap(void)
gbl = LocalAlloc(LMEM_FIXED, init_size); gbl = LocalAlloc(LMEM_FIXED, init_size);
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
hsecond = LocalReAlloc(gbl, size + init_size, 0); hsecond = LocalReAlloc(gbl, size + init_size, 0);
if (hsecond != gbl) { ok(hsecond == gbl || (hsecond == NULL && GetLastError() == ERROR_NOT_ENOUGH_MEMORY),
todo_wine "got %p with %x (expected %p or NULL) @%ld\n", hsecond, GetLastError(), gbl, size);
ok(hsecond == gbl || (hsecond == NULL && GetLastError() == ERROR_NOT_ENOUGH_MEMORY), LocalFree(gbl);
"got %p with %x (expected %p or NULL) @%ld\n", hsecond, GetLastError(), gbl, size);
LocalFree(hsecond);
}
else {
ok(hsecond == gbl || (hsecond == NULL && GetLastError() == ERROR_NOT_ENOUGH_MEMORY),
"got %p with %x (expected %p or NULL) @%ld\n", hsecond, GetLastError(), gbl, size);
LocalFree(gbl);
}
} }
/* LMEM_FIXED memory can be relocated with LMEM_MOVEABLE */ /* LMEM_FIXED memory can be relocated with LMEM_MOVEABLE */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment