Manipulate also the C runtime's environment
Fixes fdo#33355.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#define UNICODE
|
||||
#include "system.h"
|
||||
#include <string.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push,1) /* disable warnings within system headers */
|
||||
#endif
|
||||
@@ -419,7 +420,15 @@ oslProcessError SAL_CALL osl_setEnvironment(rtl_uString *ustrVar, rtl_uString *u
|
||||
LPCWSTR lpName = reinterpret_cast<LPCWSTR>(ustrVar->buffer);
|
||||
LPCWSTR lpValue = reinterpret_cast<LPCWSTR>(ustrValue->buffer);
|
||||
if (SetEnvironmentVariableW(lpName, lpValue))
|
||||
{
|
||||
wchar_t *buffer = new wchar_t[wcslen(lpName) + 1 + wcslen(lpValue) + 1];
|
||||
wcscpy(buffer, lpName);
|
||||
wcscat(buffer, L"=");
|
||||
wcscat(buffer, lpValue);
|
||||
_wputenv(buffer);
|
||||
delete[] buffer;
|
||||
return osl_Process_E_None;
|
||||
}
|
||||
return osl_Process_E_Unknown;
|
||||
}
|
||||
|
||||
@@ -429,7 +438,14 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString *ustrVar)
|
||||
//process's environment.
|
||||
LPCWSTR lpName = reinterpret_cast<LPCWSTR>(ustrVar->buffer);
|
||||
if (SetEnvironmentVariableW(lpName, NULL))
|
||||
{
|
||||
wchar_t *buffer = new wchar_t[wcslen(lpName) + 1 + 1];
|
||||
wcscpy(buffer, lpName);
|
||||
wcscat(buffer, L"=");
|
||||
_wputenv(buffer);
|
||||
delete[] buffer;
|
||||
return osl_Process_E_None;
|
||||
}
|
||||
return osl_Process_E_Unknown;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user