diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2021-05-07 23:05:24 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2021-05-07 23:05:24 +0200 |
commit | 44eb4163234089e8830b018dbcf6a08333eab202 (patch) | |
tree | 84e801105b6f9e4297f7f2735e69f03ce79206fe /winsup/cygwin/dcrt0.cc | |
parent | 19d59ce75d5301ae167b421111d77615eb307aa7 (diff) | |
download | newlib-44eb4163234089e8830b018dbcf6a08333eab202.zip newlib-44eb4163234089e8830b018dbcf6a08333eab202.tar.gz newlib-44eb4163234089e8830b018dbcf6a08333eab202.tar.bz2 |
Cygwin: fetch Windows directory on all platforms and use throughout
Rather than fetching the system Windows directory at dll init time
only on 32 bit, fetch it on all platforms. Store as WCHAR and
UNICODE_STRING. Use where appropriate to simplify code.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 3bbee4d..6f4723b 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -722,20 +722,23 @@ init_windows_system_directory () api_fatal ("can't find windows system directory"); windows_system_directory[windows_system_directory_length++] = L'\\'; windows_system_directory[windows_system_directory_length] = L'\0'; + /* We need the Windows dir with NT prefix in path.cc. Note that we + don't append a backslash, because we need the dir without backslash + for the environment. */ + wcpcpy (windows_directory_buf, L"\\??\\"); + windows_directory_length = + GetSystemWindowsDirectoryW (windows_directory, MAX_PATH - 4); + RtlInitCountedUnicodeString (&windows_directory_path, + windows_directory_buf, + (windows_directory_length + 4) * sizeof (WCHAR)); #ifdef __i386__ system_wow64_directory_length = - GetSystemWow64DirectoryW (system_wow64_directory, MAX_PATH); + GetSystemWow64DirectoryW (system_wow64_directory, MAX_PATH); if (system_wow64_directory_length) { system_wow64_directory[system_wow64_directory_length++] = L'\\'; system_wow64_directory[system_wow64_directory_length] = L'\0'; } - /* We need the Windows dir in path.cc. */ - wcscpy (windows_directory, windows_system_directory); - windows_directory_length = windows_system_directory_length - 1; - windows_directory[windows_directory_length] = L'\0'; - while (windows_directory[windows_directory_length - 1] != L'\\') - windows_directory[--windows_directory_length] = L'\0'; #endif /* __i386__ */ } } |