diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 70527425b60..d008f08530d 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -629,8 +629,18 @@ void BuildSpec32File( FILE *outfile ) " extern char **__wine_main_argv;\n" " STARTUPINFOA info;\n" " char *cmdline = GetCommandLineA();\n" - " while (*cmdline && *cmdline != ' ') cmdline++;\n" - " if (*cmdline) cmdline++;\n" + " int bcount=0, in_quotes=0;\n" + " while (*cmdline) {\n" + " if ((*cmdline=='\\t' || *cmdline==' ') && !in_quotes) break;\n" + " else if (*cmdline=='\\\\') bcount++;\n" + " else if (*cmdline=='\\\"') {\n" + " if ((bcount & 1)==0) in_quotes=!in_quotes;\n" + " bcount=0;\n" + " }\n" + " else bcount=0;\n" + " cmdline++;\n" + " }\n" + " while (*cmdline=='\\t' || *cmdline==' ') cmdline++;\n" " GetStartupInfoA( &info );\n" " if (!(info.dwFlags & 1)) info.wShowWindow = 1;\n" " _ARGC = __wine_main_argc;\n" @@ -666,8 +676,18 @@ void BuildSpec32File( FILE *outfile ) " extern WCHAR **__wine_main_wargv;\n" " STARTUPINFOA info;\n" " char *cmdline = GetCommandLineA();\n" - " while (*cmdline && *cmdline != ' ') cmdline++;\n" - " if (*cmdline) cmdline++;\n" + " int bcount=0, in_quotes=0;\n" + " while (*cmdline) {\n" + " if ((*cmdline=='\\t' || *cmdline==' ') && !in_quotes) break;\n" + " else if (*cmdline=='\\\\') bcount++;\n" + " else if (*cmdline=='\\\"') {\n" + " if ((bcount & 1)==0) in_quotes=!in_quotes;\n" + " bcount=0;\n" + " }\n" + " else bcount=0;\n" + " cmdline++;\n" + " }\n" + " while (*cmdline=='\\t' || *cmdline==' ') cmdline++;\n" " GetStartupInfoA( &info );\n" " if (!(info.dwFlags & 1)) info.wShowWindow = 1;\n" " _ARGC = __wine_main_argc;\n"