Misha Koshelev : setupapi: Simplify code as native setupapi does not handle quoted paths.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 25 07:28:12 CDT 2007


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

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Fri Jun 22 17:32:56 2007 -0500

setupapi: Simplify code as native setupapi does not handle quoted paths.

---

 dlls/setupapi/install.c       |   45 +++-------------------------------------
 dlls/setupapi/tests/install.c |    2 +-
 2 files changed, 5 insertions(+), 42 deletions(-)

diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c
index b53b266..ca17b64 100644
--- a/dlls/setupapi/install.c
+++ b/dlls/setupapi/install.c
@@ -1001,9 +1001,9 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, I
 #endif
     static const WCHAR nt_genericW[] = {'.','n','t',0};
 
-    WCHAR *s, *d, *path, section[MAX_PATH + sizeof(nt_platformW)/sizeof(WCHAR)];
+    WCHAR *s, *path, section[MAX_PATH + sizeof(nt_platformW)/sizeof(WCHAR)];
     void *callback_context;
-    UINT mode, in_quotes, bcount;
+    UINT mode;
     HINF hinf;
 
     TRACE("hwnd %p, handle %p, cmdline %s\n", hwnd, handle, debugstr_w(cmdline));
@@ -1015,47 +1015,10 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, I
     while (*s == ' ') s++;
     mode = atoiW( s );
 
+    /* quoted paths are not allowed on native, the rest of the command line is taken as the path */
     if (!(s = strchrW( s, ' ' ))) return;
     while (*s == ' ') s++;
-
-    /* The inf path may be quoted. Code adapted from CommandLineToArgvW() */
-    bcount=0;
-    in_quotes=0;
-    path=d=s;
-    while (*s)
-    {
-        if (*s==0) {
-            /* end of this command line argument */
-            break;
-        } else if (*s=='\\') {
-            /* '\\' */
-            *d++=*s++;
-            bcount++;
-        } else if (*s=='"') {
-            /* '"' */
-            if ((bcount & 1)==0) {
-                /* Preceded by an even number of '\', this is half that
-                 * number of '\', plus a quote which we erase.
-                 */
-                d-=bcount/2;
-                in_quotes=!in_quotes;
-                s++;
-            } else {
-                /* Preceded by an odd number of '\', this is half that
-                 * number of '\' followed by a '"'
-                 */
-                d=d-bcount/2-1;
-                *d++='"';
-                s++;
-            }
-            bcount=0;
-        } else {
-            /* a regular character */
-            *d++=*s++;
-            bcount=0;
-        }
-    }
-    *d=0;
+    path = s;
 
     hinf = SetupOpenInfFileW( path, NULL, INF_STYLE_WIN4, NULL );
     if (hinf == INVALID_HANDLE_VALUE) return;
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index 5cecd97..124f831 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -124,7 +124,7 @@ static void test_cmdline(void)
     ok_cmdline("DefaultInstall", 128, path, TRUE);
 
     sprintf(path, "\"%s\\%s\"", CURR_DIR, infwithspaces);
-    todo_wine ok_cmdline("DefaultInstall", 128, path, FALSE);
+    ok_cmdline("DefaultInstall", 128, path, FALSE);
 
     ok(DeleteFile(infwithspaces), "Expected source inf to exist, last error was %d\n", GetLastError());
 }




More information about the wine-cvs mailing list