Maarten Lankhorst : dsound: Increase dll refcount and disable thread calls.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 30 13:50:30 CDT 2007


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

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Thu Aug 30 14:50:32 2007 +0200

dsound: Increase dll refcount and disable thread calls.

---

 dlls/dsound/dsound_main.c  |    9 +++------
 dlls/dsound/tests/dsound.c |    8 ++++++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c
index 5f29ad4..770525c 100644
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -585,16 +585,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
             INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
             INIT_GUID(DSOUND_capture_guids[i],  0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i);
         }
+        DisableThreadLibraryCalls(hInstDLL);
+        /* Increase refcount on dsound by 1 */
+        GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)hInstDLL, &hInstDLL);
         break;
     case DLL_PROCESS_DETACH:
         TRACE("DLL_PROCESS_DETACH\n");
         break;
-    case DLL_THREAD_ATTACH:
-        TRACE("DLL_THREAD_ATTACH\n");
-        break;
-    case DLL_THREAD_DETACH:
-        TRACE("DLL_THREAD_DETACH\n");
-        break;
     default:
         TRACE("UNKNOWN REASON\n");
         break;
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index cbb6829..fe22064 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -970,6 +970,14 @@ START_TEST(dsound)
     hDsound = LoadLibrary("dsound.dll");
     if (hDsound)
     {
+        ok( FreeLibrary(hDsound), "FreeLibrary(1) returned %d\n", GetLastError());
+        ok( FreeLibrary(hDsound), "FreeLibrary(2) returned %d\n", GetLastError());
+        ok(!FreeLibrary(hDsound), "DirectSound DLL still loaded\n");
+    }
+
+    hDsound = LoadLibrary("dsound.dll");
+    if (hDsound)
+    {
         trace("DLL Version: %s\n", get_file_version("dsound.dll"));
 
         pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,




More information about the wine-cvs mailing list