1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed environment issue

This commit is contained in:
Brian Fiete 2021-01-03 07:04:33 -08:00
parent 5fd037bc58
commit f928b93644

View file

@ -1645,8 +1645,12 @@ public:
}
UTF16String envW;
WCHAR* envPtrW = NULL;
void* envVoidPtr = NULL;
if ((env != NULL) && (env[0] != 0))
{
bool useUnicodeEnv = false;
if (useUnicodeEnv)
{
const char* envPtr = env;
while (true)
@ -1657,13 +1661,16 @@ public:
}
int envSize = (int)(envPtr - env) + 2;
String str8(env, envSize);
envW = UTF8Decode(str8);
envPtrW = (WCHAR*)envW.c_str();
envVoidPtr = (void*)envW.c_str();
startupInfo.dwFlags |= CREATE_UNICODE_ENVIRONMENT;
}
else
{
envVoidPtr = (void*)env;
}
}
retVal = ::CreateProcessW(
targetStrPtr,
@ -1672,7 +1679,7 @@ public:
NULL, // pointer to thread security attributes
true, // handle inheritance flag
creationFlags, // creation flags
envPtrW, // pointer to new environment block
envVoidPtr, // pointer to new environment block
dirStrPtr, // pointer to current directory name
&startupInfo, // pointer to STARTUPINFO
&processInfo // pointer to PROCESS_INFORMATION
@ -2757,6 +2764,7 @@ BFP_EXPORT BfpFile* BFP_CALLTYPE BfpFile_Create(const char* path, BfpFileCreateK
if (outResult != NULL)
{
int lastError = GetLastError();
switch (lastError)
{
case ERROR_SHARING_VIOLATION: