Peter Åstrand : winmm: Add support for "open new" commands.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jun 15 07:12:45 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 2585e1a6fdabe038772cfd909cc72be66bfe7eda
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=2585e1a6fdabe038772cfd909cc72be66bfe7eda

Author: Peter Åstrand <astrand at cendio.se>
Date:   Mon Jun 12 16:19:06 2006 +0200

winmm: Add support for "open new" commands.

---

 dlls/winmm/mci.c |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
index 6c26535..156cbaf 100644
--- a/dlls/winmm/mci.c
+++ b/dlls/winmm/mci.c
@@ -1260,6 +1260,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpst
     BOOL		bAutoOpen = FALSE;
     static const WCHAR  wszNew[] = {'n','e','w',0};
     static const WCHAR  wszSAliasS[] = {' ','a','l','i','a','s',' ',0};
+    static const WCHAR wszTypeS[] = {'t','y','p','e',' ',0};
 
     TRACE("(%s, %p, %d, %p)\n", 
           debugstr_w(lpstrCommand), lpstrRet, uRetLen, hwndCallback);
@@ -1281,18 +1282,26 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpst
 	goto errCleanUp;
     }
 
-    /* case dev == 'new' has to be handled */
-    if (!strcmpW(dev, wszNew)) {
-	FIXME("'new': NIY as device name\n");
-	dwRet = MCIERR_MISSING_DEVICE_NAME;
-	goto errCleanUp;
-    }
-
-    /* otherwise, try to grab devType from open */
+    /* Determine devType from open */
     if (!strcmpW(verb, wszOpen)) {
 	LPWSTR	devType, tmp;
 
-	if ((devType = strchrW(dev, '!')) != NULL) {
+	/* case dev == 'new' has to be handled */
+	if (!strcmpW(dev, wszNew)) {
+	    dev = 0;
+	    if ((devType = strstrW(args, wszTypeS)) != NULL) {
+		devType += 5;
+		tmp = strchrW(devType, ' ');
+		if (tmp) *tmp = '\0';
+		devType = str_dup_upper(devType);
+		if (tmp) *tmp = ' ';
+		/* dwFlags and data[2] will be correctly set in ParseOpt loop */
+	    } else {
+		WARN("open new requires device type\n");
+		dwRet = MCIERR_MISSING_DEVICE_NAME;
+		goto errCleanUp;
+	    }
+	} else if ((devType = strchrW(dev, '!')) != NULL) {
 	    *devType++ = '\0';
 	    tmp = devType; devType = dev; dev = tmp;
 
@@ -1309,7 +1318,6 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpst
 	    if (tmp) *tmp = ' ';
 	    dwFlags |= MCI_OPEN_TYPE;
 	} else {
-            static const WCHAR wszTypeS[] = {'t','y','p','e',' ',0};
 	    if ((devType = strstrW(args, wszTypeS)) != NULL) {
 		devType += 5;
 		tmp = strchrW(devType, ' ');
@@ -1338,6 +1346,10 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpst
             data[4] = (DWORD)tmp2;
 	    /* should be done in regular options parsing */
 	    /* dwFlags |= MCI_OPEN_ALIAS; */
+	} else if (dev == 0) {
+	    /* "open new" requires alias */
+	    dwRet = MCIERR_NEW_REQUIRES_ALIAS;
+	    goto errCleanUp;
 	}
 
 	dwRet = MCI_LoadMciDriver(devType, &wmd);




More information about the wine-cvs mailing list