mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed environment issue
This commit is contained in:
parent
5fd037bc58
commit
f928b93644
1 changed files with 24 additions and 16 deletions
|
@ -1645,24 +1645,31 @@ public:
|
|||
}
|
||||
|
||||
UTF16String envW;
|
||||
WCHAR* envPtrW = NULL;
|
||||
void* envVoidPtr = NULL;
|
||||
|
||||
if ((env != NULL) && (env[0] != 0))
|
||||
{
|
||||
const char* envPtr = env;
|
||||
while (true)
|
||||
{
|
||||
if ((envPtr[0] == 0) && (envPtr[1] == 0))
|
||||
break;
|
||||
envPtr++;
|
||||
bool useUnicodeEnv = false;
|
||||
if (useUnicodeEnv)
|
||||
{
|
||||
const char* envPtr = env;
|
||||
while (true)
|
||||
{
|
||||
if ((envPtr[0] == 0) && (envPtr[1] == 0))
|
||||
break;
|
||||
envPtr++;
|
||||
}
|
||||
|
||||
int envSize = (int)(envPtr - env) + 2;
|
||||
String str8(env, envSize);
|
||||
envW = UTF8Decode(str8);
|
||||
envVoidPtr = (void*)envW.c_str();
|
||||
startupInfo.dwFlags |= CREATE_UNICODE_ENVIRONMENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
envVoidPtr = (void*)env;
|
||||
}
|
||||
|
||||
int envSize = (int)(envPtr - env) + 2;
|
||||
|
||||
String str8(env, envSize);
|
||||
envW = UTF8Decode(str8);
|
||||
|
||||
envPtrW = (WCHAR*)envW.c_str();
|
||||
startupInfo.dwFlags |= CREATE_UNICODE_ENVIRONMENT;
|
||||
}
|
||||
|
||||
retVal = ::CreateProcessW(
|
||||
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue