diff options
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 5dfad7c10..12e84f42e 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -36,6 +36,7 @@ details. */ #include "tls_pbuf.h" #include "exception.h" #include "cygxdr.h" +#include "ntdll.h" #define MAX_AT_FILE_LEVEL 10 @@ -679,9 +680,23 @@ disable_dep () } #endif +/* Retrieve and store system directory for later use. Note that the + directory is stored with a trailing backslash! */ +static void +init_windows_system_directory () +{ + windows_system_directory_length = + GetSystemDirectoryW (windows_system_directory, MAX_PATH); + if (windows_system_directory_length == 0) + 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'; +} + void __stdcall dll_crt0_0 () { + init_windows_system_directory (); init_global_security (); initial_env (); |