WINMM: fix PlaySound

Mike McCormack mike at codeweavers.com
Tue Jun 8 07:32:30 CDT 2004


NetMeeting tries to play the sound of a phone ringing when receiving a 
call.  It stores the name of the file in user.reg as follows:

[AppEvents\\Schemes\\Apps\\Conf\\Receive Call\\.Current] 1086688326
@="C:\\Program Files\\NetMeeting\\RingIn.wav"

This patch makes PlaySound() work with the above configuration.

Mike


ChangeLog:
* fix PlaySound

-------------- next part --------------
Index: dlls/winmm/playsound.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/playsound.c,v
retrieving revision 1.10
diff -u -r1.10 playsound.c
--- dlls/winmm/playsound.c	19 May 2004 03:22:55 -0000	1.10
+++ dlls/winmm/playsound.c	8 Jun 2004 11:19:01 -0000
@@ -68,6 +68,7 @@
                                     'S','c','h','e','m','e','s','\\',
                                     'A','p','p','s',0};
     static const WCHAR  wszDotDefault[] = {'.','D','e','f','a','u','l','t',0};
+    static const WCHAR  wszDotCurrent[] = {'.','C','u','r','r','e','n','t',0};
     static const WCHAR  wszNull[] = {0};
 
     TRACE("searching in SystemSound list for %s\n", debugstr_w(lpszName));
@@ -101,7 +102,7 @@
                 if (*ptr == '.') *ptr = 0;
                 if (*ptr == '\\')
                 {
-                    err = RegOpenKeyW(hRegSnd, str, &hRegApp);
+                    err = RegOpenKeyW(hRegSnd, ptr+1, &hRegApp);
                     break;
                 }
             }
@@ -116,9 +117,15 @@
     err = RegOpenKeyW(hRegApp, lpszName, &hScheme);
     RegCloseKey(hRegApp);
     if (err != 0) goto none;
+    /* what's the difference between .Current and .Default ? */
     err = RegOpenKeyW(hScheme, wszDotDefault, &hSnd);
-    RegCloseKey(hScheme);
-    if (err != 0) goto none;
+    if (err != 0)
+    {
+        err = RegOpenKeyW(hScheme, wszDotCurrent, &hSnd);
+        RegCloseKey(hScheme);
+        if (err != 0)
+            goto none;
+    }
     count = sizeof(str)/sizeof(str[0]);
     err = RegQueryValueExW(hSnd, NULL, 0, &type, (LPBYTE)str, &count);
     RegCloseKey(hSnd);


More information about the wine-patches mailing list