Re: g_getenv() encoding on Windows
- From: Tor Lillqvist <tml iki fi>
- To: "J. Ali Harlow" <ali juiblex co uk>
- Cc: gtk-devel-list gnome org
- Subject: Re: g_getenv() encoding on Windows
- Date: Fri, 31 Dec 2004 16:15:53 +0000
J. Ali Harlow writes:
> If we just call SetEnvironmentVariableW() then MSVCRT's environment
> will be out of date. This might matter if the application (or a
> library) calls getenv () or if MSVCRT itself depends on the value
> of the variable. If we just call putenv() then the system value
> might be corrupted if the value can't be represented in the system
> codepage. I think we're going to have to call both to be safe
Yup, that's what the code I have been tinkering with for some hours
now does... First call _wputenv(), to update MSVCRT's environ (and
_wenviron). _wputenv() also calls SetEnvironmentVariableW() but I
don't trust it necessarily gets it right (reading the C runtime's
source to figure out what happens is rather hairy with all the
ifdefs), so then g_setenv() calls SetEnvironmentVariableW() itself.
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]