Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ValveSoftware/Proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Eikum <aeikum@codeweavers.com>2019-03-28 19:10:45 +0300
committerAndrew Eikum <aeikum@codeweavers.com>2019-03-29 17:15:05 +0300
commita63d094dc01049e128c6a7657a1c33946c1d840b (patch)
treed3fc658cef0afe19f44ce3329b2c8ff3207b9356 /steam_helper
parent3004d37fa4f6a82d7973b8624461bce5435f8121 (diff)
steam_helper: Parse quote characters consistently with CommandLineToArgvW
Diffstat (limited to 'steam_helper')
-rw-r--r--steam_helper/steam.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/steam_helper/steam.cpp b/steam_helper/steam.cpp
index 4d5e5217..2ff2b44d 100644
--- a/steam_helper/steam.cpp
+++ b/steam_helper/steam.cpp
@@ -116,6 +116,26 @@ static void setup_steam_registry(void)
SteamAPI_Shutdown();
}
+static WCHAR *find_quote(WCHAR *str)
+{
+ WCHAR *end = strchrW(str, '"'), *ch;
+ int odd;
+ while (end)
+ {
+ odd = 0;
+ ch = end - 1;
+ while (ch >= str && *ch == '\\')
+ {
+ odd = !odd;
+ --ch;
+ }
+ if (!odd)
+ return end;
+ end = strchrW(end + 1, '"');
+ }
+ return NULL;
+}
+
static HANDLE run_process(void)
{
WCHAR *cmdline = GetCommandLineW();
@@ -125,7 +145,7 @@ static HANDLE run_process(void)
/* skip argv[0] */
if (*cmdline == '"')
{
- cmdline = strchrW(cmdline + 1, '"');
+ cmdline = find_quote(cmdline + 1);
if (cmdline) cmdline++;
}
else
@@ -156,7 +176,7 @@ static HANDLE run_process(void)
if (cmdline[0] == '"')
{
start = cmdline + 1;
- end = strchrW(start, '"');
+ end = find_quote(start);
if (!end)
{
WINE_ERR("Unmatched quote? %s\n", wine_dbgstr_w(cmdline));