Andrew Eikum : winmm: Don' t mask out SND_ALIAS_ID or SND_FILENAME in sndPlaySound.

Alexandre Julliard julliard at winehq.org
Tue Dec 4 13:48:54 CST 2012


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Tue Dec  4 11:41:10 2012 -0600

winmm: Don't mask out SND_ALIAS_ID or SND_FILENAME in sndPlaySound.

---

 dlls/winmm/playsound.c  |    4 ++--
 dlls/winmm/tests/wave.c |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c
index 0d32274..64db333 100644
--- a/dlls/winmm/playsound.c
+++ b/dlls/winmm/playsound.c
@@ -560,7 +560,7 @@ BOOL WINAPI PlaySoundW(LPCWSTR pszSoundW, HMODULE hmod, DWORD fdwSound)
  */
 BOOL WINAPI sndPlaySoundA(LPCSTR pszSoundA, UINT uFlags)
 {
-    uFlags &= SND_ASYNC|SND_LOOP|SND_MEMORY|SND_NODEFAULT|SND_NOSTOP|SND_SYNC;
+    uFlags &= SND_ALIAS_ID|SND_FILENAME|SND_ASYNC|SND_LOOP|SND_MEMORY|SND_NODEFAULT|SND_NOSTOP|SND_SYNC;
     return MULTIMEDIA_PlaySound(pszSoundA, 0, uFlags, FALSE);
 }
 
@@ -569,7 +569,7 @@ BOOL WINAPI sndPlaySoundA(LPCSTR pszSoundA, UINT uFlags)
  */
 BOOL WINAPI sndPlaySoundW(LPCWSTR pszSound, UINT uFlags)
 {
-    uFlags &= SND_ASYNC|SND_LOOP|SND_MEMORY|SND_NODEFAULT|SND_NOSTOP|SND_SYNC;
+    uFlags &= SND_ALIAS_ID|SND_FILENAME|SND_ASYNC|SND_LOOP|SND_MEMORY|SND_NODEFAULT|SND_NOSTOP|SND_SYNC;
     return MULTIMEDIA_PlaySound(pszSound, 0, uFlags, TRUE);
 }
 
diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c
index 28b4145..97849f5 100644
--- a/dlls/winmm/tests/wave.c
+++ b/dlls/winmm/tests/wave.c
@@ -1443,8 +1443,41 @@ static void wave_out_tests(void)
         wave_out_test_device(WAVE_MAPPER);
 }
 
+static void test_sndPlaySound(void)
+{
+    BOOL br;
+
+    static const WCHAR not_existW[] = {'C',':','\\','n','o','t','_','e','x','i','s','t','.','w','a','v',0};
+    static const WCHAR SystemAsteriskW[] = {'S','y','s','t','e','m','A','s','t','e','r','i','s','k',0};
+
+    br = sndPlaySoundA((LPCSTR)SND_ALIAS_SYSTEMASTERISK, SND_ALIAS_ID|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+
+    br = sndPlaySoundW((LPCWSTR)SND_ALIAS_SYSTEMASTERISK, SND_ALIAS_ID|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+
+    br = sndPlaySoundA((LPCSTR)sndAlias('X','Y'), SND_ALIAS_ID|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+
+    br = sndPlaySoundW((LPCWSTR)sndAlias('X','Y'), SND_ALIAS_ID|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+
+    br = sndPlaySoundA("SystemAsterisk", SND_ALIAS|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+
+    br = sndPlaySoundW(SystemAsteriskW, SND_ALIAS|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+
+    br = sndPlaySoundA("C:\not_exist.wav", SND_FILENAME|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+
+    br = sndPlaySoundW(not_existW, SND_FILENAME|SND_SYNC);
+    ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
+}
+
 START_TEST(wave)
 {
     test_multiple_waveopens();
     wave_out_tests();
+    test_sndPlaySound();
 }




More information about the wine-cvs mailing list