Commit d10ca9ce authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed GMEM_ZEROINIT in GlobalRealloc (thanks to Gerard Patel).

parent 04699cca
...@@ -1175,6 +1175,7 @@ HGLOBAL WINAPI GlobalReAlloc( ...@@ -1175,6 +1175,7 @@ HGLOBAL WINAPI GlobalReAlloc(
HGLOBAL hnew; HGLOBAL hnew;
PGLOBAL32_INTERN pintern; PGLOBAL32_INTERN pintern;
HANDLE heap = GLOBAL_GetHeap( hmem ); HANDLE heap = GLOBAL_GetHeap( hmem );
DWORD heap_flags = (flags & GMEM_ZEROINIT) ? HEAP_ZERO_MEMORY : 0;
hnew = 0; hnew = 0;
/* HeapLock(heap); */ /* HeapLock(heap); */
...@@ -1216,7 +1217,7 @@ HGLOBAL WINAPI GlobalReAlloc( ...@@ -1216,7 +1217,7 @@ HGLOBAL WINAPI GlobalReAlloc(
if(ISPOINTER(hmem)) if(ISPOINTER(hmem))
{ {
/* reallocate fixed memory */ /* reallocate fixed memory */
hnew=(HGLOBAL)HeapReAlloc(heap, 0, (LPVOID) hmem, size); hnew=(HGLOBAL)HeapReAlloc(heap, heap_flags, (LPVOID) hmem, size);
} }
else else
{ {
...@@ -1230,14 +1231,14 @@ HGLOBAL WINAPI GlobalReAlloc( ...@@ -1230,14 +1231,14 @@ HGLOBAL WINAPI GlobalReAlloc(
hnew=hmem; hnew=hmem;
if(pintern->Pointer) if(pintern->Pointer)
{ {
palloc=HeapReAlloc(heap, 0, palloc=HeapReAlloc(heap, heap_flags,
(char *) pintern->Pointer-sizeof(HGLOBAL), (char *) pintern->Pointer-sizeof(HGLOBAL),
size+sizeof(HGLOBAL) ); size+sizeof(HGLOBAL) );
pintern->Pointer=(char *) palloc+sizeof(HGLOBAL); pintern->Pointer=(char *) palloc+sizeof(HGLOBAL);
} }
else else
{ {
palloc=HeapAlloc(heap, 0, size+sizeof(HGLOBAL)); palloc=HeapAlloc(heap, heap_flags, size+sizeof(HGLOBAL));
*(HGLOBAL *)palloc=hmem; *(HGLOBAL *)palloc=hmem;
pintern->Pointer=(char *) palloc+sizeof(HGLOBAL); pintern->Pointer=(char *) palloc+sizeof(HGLOBAL);
} }
......
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