mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-01-13 23:28:16 +03:00
lsteamclient: Sync important environment variables before calling CreateInterface.
This commit is contained in:
parent
349df9c436
commit
a33e3d105d
@ -19,6 +19,8 @@
|
||||
|
||||
#include "steamclient_private.h"
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
|
||||
|
||||
char g_tmppath[PATH_MAX];
|
||||
@ -41,6 +43,33 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sync_environment(void)
|
||||
{
|
||||
static const char *steamapi_envs[] =
|
||||
{
|
||||
"SteamAppId",
|
||||
"IgnoreChildProcesses",
|
||||
};
|
||||
|
||||
char value[32767];
|
||||
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(steamapi_envs); i++)
|
||||
{
|
||||
if (!GetEnvironmentVariableA(steamapi_envs[i], value, ARRAY_SIZE(value)))
|
||||
{
|
||||
if (GetLastError() == ERROR_ENVVAR_NOT_FOUND)
|
||||
{
|
||||
TRACE("unsetenv(\"%s\")\n", steamapi_envs[i]);
|
||||
unsetenv(steamapi_envs[i]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
TRACE("setenv(\"%s\", \"%s\", 1)\n", steamapi_envs[i], value);
|
||||
setenv(steamapi_envs[i], value, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* returns the number of bytes written to dst, not including the NUL terminator */
|
||||
unsigned int steamclient_unix_path_to_dos_path(bool api_result, const char *src, char *dst, uint32 dst_bytes, int is_url)
|
||||
{
|
||||
@ -423,6 +452,8 @@ static int load_steamclient(void)
|
||||
{
|
||||
char path[PATH_MAX], resolved_path[PATH_MAX];
|
||||
|
||||
sync_environment();
|
||||
|
||||
if(steamclient_lib)
|
||||
return 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user