diff options
author | Christopher Faylor <me@cgf.cx> | 2010-05-18 18:30:51 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2010-05-18 18:30:51 +0400 |
commit | d3258e063cb0a4fc77a76df3c91ba9841ca4971c (patch) | |
tree | 2921ded7329f12667d439c207fa81f15575dba14 /winsup/cygwin/environ.cc | |
parent | c8bd391c328c8650a93388f5cb3409c3740ee963 (diff) |
* environ.cc (regopt): Change the first argument to wide char string.
(environ_init): Accommodate change to the first argument of regopt.
* exception.cc (open_stackdumpfile): Accommodate change to the type of progname
in _pinfo.
* external.cc (fillout_pinfo): Ditto.
* fhandler_process.cc (format_process_winexename): Ditto.
(format_process_stat): Ditto.
* fork.cc (fork::parent): Ditto.
* pinfo.cc (pinfo_basic::pinfo_basic): Call GetModuleFileNameW instead of
GetModuleFileName.
(pinfo::thisproc): Accommodate change to the type of progname in _pinfo.
(pinfo_init): Ditto.
* pinfo.h (_pinfo): Change the type of progname to a wide char array.
* registry.h (reg_key::get_int): Change the first argument from constant point
to pointer to constant.
(reg_key::get_string): Ditto. Change the last argument likewise.
* registry.cc (reg_key::get_int): Accommodate change to the declaration.
(reg_key::get_string): Ditto.
* strace.cc (strace::hello): Accommodate change to the type of progname in
_pinfo.
(strace::vsprntf): Ditto.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r-- | winsup/cygwin/environ.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 4935bc815..9d1544429 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -29,6 +29,7 @@ details. */ #include "registry.h" #include "environ.h" #include "child_info.h" +#include "ntdll.h" extern bool dos_file_warning; extern bool ignore_case_with_glob; @@ -698,18 +699,24 @@ parse_options (char *buf) /* Set options from the registry. */ static bool __stdcall -regopt (const char *name, char *buf) +regopt (const WCHAR *name, char *buf) { bool parsed_something = false; - char lname[strlen (name) + 1]; - strlwr (strcpy (lname, name)); + UNICODE_STRING lname; + size_t len = (wcslen(name) + 1) * sizeof (WCHAR); + RtlInitEmptyUnicodeString(&lname, (PWCHAR) alloca (len), len); + wcscpy(lname.Buffer, name); + RtlDowncaseUnicodeString(&lname, &lname, FALSE); for (int i = 0; i < 2; i++) { reg_key r (i, KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL); - if (r.get_string (lname, buf, NT_MAX_PATH, "") == ERROR_SUCCESS) + if (r.get_string (lname.Buffer, (PWCHAR) buf, NT_MAX_PATH, L"") == ERROR_SUCCESS) { + char *newp; + sys_wcstombs_alloc(&newp, HEAP_NOTHEAP, (PWCHAR) buf); + strcpy(buf, newp); parse_options (buf); parsed_something = true; break; @@ -747,7 +754,7 @@ environ_init (char **envp, int envc) } char *tmpbuf = tp.t_get (); - got_something_from_registry = regopt ("default", tmpbuf); + got_something_from_registry = regopt (L"default", tmpbuf); if (myself->progname[0]) got_something_from_registry = regopt (myself->progname, tmpbuf) || got_something_from_registry; |