mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 14:10:32 +00:00
Fixed GMEM_ZEROINIT in GlobalRealloc (thanks to Gerard Patel).
This commit is contained in:
parent
04699cca44
commit
d10ca9ce46
@ -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(
|
|||||||
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(
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user