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>2020-02-26 20:08:35 +0300
committerAndrew Eikum <aeikum@codeweavers.com>2020-03-05 19:03:11 +0300
commita4b8a51d4a0a8b01534103177c6700b17e79c209 (patch)
treedd04fc5ad7311a0ed1fde6b9919dc25f235b8c52 /steam_helper
parent6364369ad9267489989925a531e6b4169bb877e4 (diff)
steam_helper: Don't use msvcrt
We need access to linux crt functions (like getenv()), so disallow use of msvcrt. Notably, linux crt wchar functions are _not_ compatible with Windows WCHAR strings.
Diffstat (limited to 'steam_helper')
-rw-r--r--steam_helper/steam.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/steam_helper/steam.cpp b/steam_helper/steam.cpp
index 8e5b9777..9dcc8914 100644
--- a/steam_helper/steam.cpp
+++ b/steam_helper/steam.cpp
@@ -117,9 +117,20 @@ static void setup_steam_registry(void)
SteamAPI_Shutdown();
}
+static WCHAR *strchrW(WCHAR *h, WCHAR n)
+{
+ do
+ {
+ if(*h == n)
+ return h;
+ } while (*h++);
+
+ return NULL;
+}
+
static WCHAR *find_quote(WCHAR *str)
{
- WCHAR *end = wcschr(str, '"'), *ch;
+ WCHAR *end = strchrW(str, '"'), *ch;
int odd;
while (end)
{
@@ -132,7 +143,7 @@ static WCHAR *find_quote(WCHAR *str)
}
if (!odd)
return end;
- end = wcschr(end + 1, '"');
+ end = strchrW(end + 1, '"');
}
return NULL;
}
@@ -157,7 +168,7 @@ static HANDLE run_process(void)
}
else
{
- cmdline = wcschr(cmdline, ' ');
+ cmdline = strchrW(cmdline, ' ');
}
if (!cmdline)
{
@@ -196,9 +207,9 @@ static HANDLE run_process(void)
else
{
start = cmdline;
- end = wcschr(start, ' ');
+ end = strchrW(start, ' ');
if (!end)
- end = wcschr(start, '\0');
+ end = strchrW(start, '\0');
remainder = end;
}