Bruno Jesus : winmm: Cope with empty string in mciSendString.

Alexandre Julliard julliard at winehq.org
Thu Mar 2 16:09:55 CST 2017


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

Author: Bruno Jesus <bjesus at codeweavers.com>
Date:   Wed Mar  1 01:18:20 2017 -0300

winmm: Cope with empty string in mciSendString.

Signed-off-by: Bruno Jesus <bjesus at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winmm/mci.c       | 3 +++
 dlls/winmm/tests/mci.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
index b8adea6..f772388 100644
--- a/dlls/winmm/mci.c
+++ b/dlls/winmm/mci.c
@@ -1343,6 +1343,9 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
           debugstr_w(lpstrCommand), lpstrRet, uRetLen, hwndCallback);
     if (lpstrRet && uRetLen) *lpstrRet = '\0';
 
+    if (!lpstrCommand[0])
+        return MCIERR_MISSING_COMMAND_STRING;
+
     /* format is <command> <device> <optargs> */
     if (!(verb = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpstrCommand)+1) * sizeof(WCHAR))))
 	return MCIERR_OUT_OF_MEMORY;
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index 9ff6c58..52790c8 100644
--- a/dlls/winmm/tests/mci.c
+++ b/dlls/winmm/tests/mci.c
@@ -198,7 +198,7 @@ static void test_mciParser(HWND hwnd)
 
     buf[0]='z';
     err = mciSendStringA("", buf, sizeof(buf), NULL);
-    todo_wine ok(err==MCIERR_MISSING_COMMAND_STRING,"empty string: %s\n", dbg_mcierr(err));
+    ok(err==MCIERR_MISSING_COMMAND_STRING,"empty string: %s\n", dbg_mcierr(err));
     ok(!buf[0], "error buffer %s\n", buf);
 
     buf[0]='d';




More information about the wine-cvs mailing list