Commit 9939fd60 authored by Andrey Turkin's avatar Andrey Turkin Committed by Alexandre Julliard

extrac32: Enhance command-line parsing.

parent b4173d7d
...@@ -105,10 +105,14 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho ...@@ -105,10 +105,14 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
for(i = 0; i < argc; i++) for(i = 0; i < argc; i++)
{ {
/* Get cabfile */ /* Get cabfile */
if ((argv[i][0] != '/') && !cabfile) if (argv[i][0] != '/')
{ {
cabfile = argv[i]; if (!cabfile)
continue; {
cabfile = argv[i];
continue;
} else
break;
} }
/* Get parameters for commands */ /* Get parameters for commands */
check = toupperW( argv[i][1] ); check = toupperW( argv[i][1] );
...@@ -127,11 +131,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho ...@@ -127,11 +131,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
break; break;
case 'C': case 'C':
if (cmd) return 0; if (cmd) return 0;
if ((i + 2) >= argc) return 0;
cmd = check; cmd = check;
cabfile = argv[++i];
if (!GetFullPathNameW(argv[++i], MAX_PATH, path, NULL))
return 0;
break; break;
case 'E': case 'E':
case 'D': case 'D':
...@@ -146,6 +146,13 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho ...@@ -146,6 +146,13 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
if (!cabfile) if (!cabfile)
return 0; return 0;
if (cmd == 'C')
{
if ((i + 1) != argc) return 0;
if (!GetFullPathNameW(argv[i], MAX_PATH, path, NULL))
return 0;
}
if (!path[0]) if (!path[0])
GetCurrentDirectoryW(MAX_PATH, path); GetCurrentDirectoryW(MAX_PATH, path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment