[dsound] DllCanUnloadNow

Christian Gmeiner christian.gmeiner at students.fh-vorarlberg.ac.at
Mon Mar 6 04:31:11 CST 2006


This patch
+ implements LockServer
+ implements DllCanUnloadNow

-- 
Christian Gmeiner - student of computer science

http://dxr3plugin.sf.net
http://itb04.ath.cx
http://javamill.ath.cx
-------------- next part --------------
Index: dlls/dsound/dsound_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.130
diff -u -r1.130 dsound_main.c
--- dlls/dsound/dsound_main.c   10 Nov 2005 12:14:59 -0000      1.130
+++ dlls/dsound/dsound_main.c   6 Mar 2006 00:46:46 -0000
@@ -73,6 +73,22 @@
 GUID                    DSOUND_renderer_guids[MAXWAVEDRIVERS];
 GUID                    DSOUND_capture_guids[MAXWAVEDRIVERS];

+static LONG dll_count;
+
+/*
+ * Dll lifetime tracking declaration
+ */
+static void LockModule(void)
+{
+    InterlockedIncrement(&dll_count);
+}
+
+static void UnlockModule(void)
+{
+    InterlockedDecrement(&dll_count);
+}
+
+
 HRESULT mmErr(UINT err)
 {
        switch(err) {
@@ -466,9 +482,13 @@
 }

 static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
-       IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
-       FIXME("(%p)->(%d),stub!\n",This,dolock);
-       return S_OK;
+
+    if (dolock)
+        LockModule();
+    else
+        UnlockModule();
+
+    return S_OK;
 }

 static const IClassFactoryVtbl DSCF_Vtbl = {
@@ -638,8 +658,7 @@
  */
 HRESULT WINAPI DllCanUnloadNow(void)
 {
-    FIXME("(void): stub\n");
-    return S_FALSE;
+    return dll_count == 0 ? S_OK : S_FALSE;
 }

 #define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)      \



More information about the wine-patches mailing list