Stefan Dösinger : d3d8: Add a dll global critical section.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 6 07:41:56 CDT 2007


Module: wine
Branch: master
Commit: 193ccecaee9b4cf825009d05d48210c5cf8d0dad
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=193ccecaee9b4cf825009d05d48210c5cf8d0dad

Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date:   Tue May 22 23:57:30 2007 +0200

d3d8: Add a dll global critical section.

---

 dlls/d3d8/d3d8_main.c    |   18 ++++++++++++++++--
 dlls/d3d8/d3d8_private.h |    3 +++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d8/d3d8_main.c b/dlls/d3d8/d3d8_main.c
index 4abd940..4922b10 100644
--- a/dlls/d3d8/d3d8_main.c
+++ b/dlls/d3d8/d3d8_main.c
@@ -24,6 +24,15 @@
 #include "d3d8_private.h"
 #include "wine/debug.h"
 
+static CRITICAL_SECTION_DEBUG d3d8_cs_debug =
+{
+    0, 0, &d3d8_cs,
+    { &d3d8_cs_debug.ProcessLocksList,
+      &d3d8_cs_debug.ProcessLocksList },
+    0, 0, { (DWORD_PTR)(__FILE__ ": d3d8_cs") }
+};
+CRITICAL_SECTION d3d8_cs = { &d3d8_cs_debug, -1, 0, 0, 0, 0 };
+
 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
 
 HRESULT WINAPI D3D8GetSWInfo(void) {
@@ -36,13 +45,18 @@ void WINAPI DebugSetMute(void) {
 }
 
 IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion) {
-    IDirect3D8Impl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
+    IDirect3D8Impl* object;
+    TRACE("SDKVersion = %x\n", SDKVersion);
+
+    EnterCriticalSection(&d3d8_cs);
+    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
 
     object->lpVtbl = &Direct3D8_Vtbl;
     object->ref = 1;
     object->WineD3D = WineDirect3DCreate(SDKVersion, 8, (IUnknown *)object);
 
-    TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
+    TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D);
+    LeaveCriticalSection(&d3d8_cs);
 
     return (IDirect3D8*) object;
 }
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index f41b7ed..3182427 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -123,6 +123,9 @@ typedef struct IDirect3DVertexShaderDeclarationImpl IDirect3DVertexShaderDeclara
 /* Advance declaration of structures to satisfy compiler */
 typedef struct IDirect3DVertexShader8Impl IDirect3DVertexShader8Impl;
 
+/* Global critical section */
+extern CRITICAL_SECTION d3d8_cs;
+
 /* ===========================================================================
     The interfactes themselves
    =========================================================================== */




More information about the wine-cvs mailing list