DDraw: Use HEAP_ZERO_MEMORY
Stefan Dösinger
stefandoesinger at gmx.at
Sun Aug 20 02:51:39 CDT 2006
When I wrote the new ddraw lib I thought HEAP_ZERO_MEMORY == 0 and HeapAlloc
always intializes the alllocated mem. Apparently This isn't the case, so
games crash after extending the structures(e.g. multithreading patches). Use
the HEAP_ZERO_MEMORY flag when allocating object implementation structures.
-------------- next part --------------
From nobody Mon Sep 17 00:00:00 2001
From: Stefan Dösinger <stefan at codeweavers.com>
Date: Sun Aug 20 09:47:19 2006 +0200
Subject: [PATCH] Coalescing 9ac4b340120f88ac10b912703d5ffe3d6edd6a03 and a432af4055b2865ba769957065c29878e1314878
First commit:
DDraw: Use HEAP_ZERO_MEMORY
Second commit:
foobar
DDraw: Use HEAP_ZERO_MEMORY
---
dlls/ddraw/ddraw.c | 4 ++--
dlls/ddraw/direct3d.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
e243e4aa3ed31815725d8974b35bb4dbbc348cf2
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index ac9952c..2dab71d 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1932,7 +1932,7 @@ IDirectDrawImpl_CreateNewSurface(IDirect
* because WineD3D will destroy them when the swapchain
* is released
*/
- parImpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IParentImpl));
+ parImpl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IParentImpl));
if(!parImpl)
{
ERR("Out of memory when allocating memory for a IParent implementation\n");
@@ -3085,7 +3085,7 @@ IDirectDrawImpl_CreatePalette(IDirectDra
return DDERR_NOCOOPERATIVELEVELSET;
}
- object = HeapAlloc(GetProcessHeap(), 0, sizeof(IDirectDrawPaletteImpl));
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawPaletteImpl));
if(!object)
{
ERR("Out of memory when allocating memory for a palette implementation\n");
diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c
index 3d8418a..ce255e0 100644
--- a/dlls/ddraw/direct3d.c
+++ b/dlls/ddraw/direct3d.c
@@ -780,7 +780,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7
return DDERR_INVALIDPARAMS;
}
- object = HeapAlloc(GetProcessHeap(), 0, sizeof(IDirect3DDeviceImpl));
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDeviceImpl));
if(!object)
{
DDOBJ_UNLOCK(This);
@@ -813,7 +813,7 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7
object->wineD3DDevice = This->wineD3DDevice;
/* Create an index buffer, it's needed for indexed drawing */
- IndexBufferParent = HeapAlloc(GetProcessHeap(), 0, sizeof(IParentImpl *));
+ IndexBufferParent = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IParentImpl *));
if(!IndexBufferParent)
{
DDOBJ_UNLOCK(This);
@@ -1005,7 +1005,7 @@ IDirect3DImpl_7_CreateVertexBuffer(IDire
return DDERR_INVALIDPARAMS;
/* Now create the vertex buffer */
- object = HeapAlloc(GetProcessHeap(), 0, sizeof(IDirect3DVertexBufferImpl));
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVertexBufferImpl));
if(!object)
{
ERR("(%p) Out of memory when allocating a IDirect3DVertexBufferImpl structure\n", This);
--
1.2.4
More information about the wine-patches
mailing list