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.
This commit is contained in:
Andrew Eikum 2020-02-26 11:08:35 -06:00
parent 6364369ad9
commit a4b8a51d4a
2 changed files with 17 additions and 7 deletions

View File

@ -1127,12 +1127,11 @@ $(STEAMEXE_CONFIGURE_FILES): $(STEAMEXE_SYN) $(MAKEFILE_DEP) | $(STEAMEXE_OBJ) $
-I"../$(TOOLS_DIR32)"/include/ \ -I"../$(TOOLS_DIR32)"/include/ \
-I"../$(TOOLS_DIR32)"/include/wine/ \ -I"../$(TOOLS_DIR32)"/include/wine/ \
-I"../$(TOOLS_DIR32)"/include/wine/windows/ \ -I"../$(TOOLS_DIR32)"/include/wine/windows/ \
-I"../$(TOOLS_DIR32)"/include/wine/msvcrt/ \
-I"../$(SRCDIR)"/lsteamclient/steamworks_sdk_142/ \ -I"../$(SRCDIR)"/lsteamclient/steamworks_sdk_142/ \
-L"../$(TOOLS_DIR32)"/lib/ \ -L"../$(TOOLS_DIR32)"/lib/ \
-L"../$(TOOLS_DIR32)"/lib/wine/ \ -L"../$(TOOLS_DIR32)"/lib/wine/ \
-L"../$(SRCDIR)"/steam_helper/ \ -L"../$(SRCDIR)"/steam_helper/ \
--guiexe ../$(STEAMEXE_SYN) && \ --guiexe --nomsvcrt ../$(STEAMEXE_SYN) && \
cp ../$(STEAMEXE_SYN)/Makefile . && \ cp ../$(STEAMEXE_SYN)/Makefile . && \
echo >> ./Makefile 'SRCDIR := ../$(STEAMEXE_SYN)' && \ echo >> ./Makefile 'SRCDIR := ../$(STEAMEXE_SYN)' && \
echo >> ./Makefile 'vpath % $$(SRCDIR)' && \ echo >> ./Makefile 'vpath % $$(SRCDIR)' && \

View File

@ -117,9 +117,20 @@ static void setup_steam_registry(void)
SteamAPI_Shutdown(); 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) static WCHAR *find_quote(WCHAR *str)
{ {
WCHAR *end = wcschr(str, '"'), *ch; WCHAR *end = strchrW(str, '"'), *ch;
int odd; int odd;
while (end) while (end)
{ {
@ -132,7 +143,7 @@ static WCHAR *find_quote(WCHAR *str)
} }
if (!odd) if (!odd)
return end; return end;
end = wcschr(end + 1, '"'); end = strchrW(end + 1, '"');
} }
return NULL; return NULL;
} }
@ -157,7 +168,7 @@ static HANDLE run_process(void)
} }
else else
{ {
cmdline = wcschr(cmdline, ' '); cmdline = strchrW(cmdline, ' ');
} }
if (!cmdline) if (!cmdline)
{ {
@ -196,9 +207,9 @@ static HANDLE run_process(void)
else else
{ {
start = cmdline; start = cmdline;
end = wcschr(start, ' '); end = strchrW(start, ' ');
if (!end) if (!end)
end = wcschr(start, '\0'); end = strchrW(start, '\0');
remainder = end; remainder = end;
} }