Commit 74390cea authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add a global constant for the system directory.

parent 1d66a108
...@@ -76,6 +76,10 @@ static LANGID user_ui_language, system_ui_language; ...@@ -76,6 +76,10 @@ static LANGID user_ui_language, system_ui_language;
static char system_locale[LOCALE_NAME_MAX_LENGTH]; static char system_locale[LOCALE_NAME_MAX_LENGTH];
static char user_locale[LOCALE_NAME_MAX_LENGTH]; static char user_locale[LOCALE_NAME_MAX_LENGTH];
/* system directory with trailing backslash */
const WCHAR system_dir[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\',0};
static struct static struct
{ {
USHORT *data; USHORT *data;
...@@ -149,8 +153,6 @@ static void *read_nls_file( ULONG type, ULONG id ) ...@@ -149,8 +153,6 @@ static void *read_nls_file( ULONG type, ULONG id )
static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file ) static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
{ {
static const WCHAR systemdirW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\',0};
static const WCHAR sortdirW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\', static const WCHAR sortdirW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
'g','l','o','b','a','l','i','z','a','t','i','o','n','\\', 'g','l','o','b','a','l','i','z','a','t','i','o','n','\\',
's','o','r','t','i','n','g','\\',0}; 's','o','r','t','i','n','g','\\',0};
...@@ -165,7 +167,7 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file ) ...@@ -165,7 +167,7 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
if (!path) return STATUS_OBJECT_NAME_NOT_FOUND; if (!path) return STATUS_OBJECT_NAME_NOT_FOUND;
/* try to open file in system dir */ /* try to open file in system dir */
wcscpy( buffer, type == NLS_SECTION_SORTKEYS ? sortdirW : systemdirW ); wcscpy( buffer, type == NLS_SECTION_SORTKEYS ? sortdirW : system_dir );
p = strrchr( path, '/' ) + 1; p = strrchr( path, '/' ) + 1;
ascii_to_unicode( buffer + wcslen(buffer), p, strlen(p) + 1 ); ascii_to_unicode( buffer + wcslen(buffer), p, strlen(p) + 1 );
init_unicode_string( &valueW, buffer ); init_unicode_string( &valueW, buffer );
...@@ -1609,8 +1611,6 @@ static void run_wineboot( WCHAR *env, SIZE_T size ) ...@@ -1609,8 +1611,6 @@ static void run_wineboot( WCHAR *env, SIZE_T size )
static const WCHAR cmdlineW[] = {'"','C',':','\\','w','i','n','d','o','w','s','\\', static const WCHAR cmdlineW[] = {'"','C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\','w','i','n','e','b','o','o','t','.','e','x','e','"', 's','y','s','t','e','m','3','2','\\','w','i','n','e','b','o','o','t','.','e','x','e','"',
' ','-','-','i','n','i','t',0}; ' ','-','-','i','n','i','t',0};
static const WCHAR sysdirW[] = {'C',':','\\','w','i','n','d','o','w','s',
'\\','s','y','s','t','e','m','3','2',0};
RTL_USER_PROCESS_PARAMETERS params = { sizeof(params), sizeof(params) }; RTL_USER_PROCESS_PARAMETERS params = { sizeof(params), sizeof(params) };
PS_ATTRIBUTE_LIST ps_attr; PS_ATTRIBUTE_LIST ps_attr;
PS_CREATE_INFO create_info; PS_CREATE_INFO create_info;
...@@ -1635,8 +1635,8 @@ static void run_wineboot( WCHAR *env, SIZE_T size ) ...@@ -1635,8 +1635,8 @@ static void run_wineboot( WCHAR *env, SIZE_T size )
params.Flags = PROCESS_PARAMS_FLAG_NORMALIZED; params.Flags = PROCESS_PARAMS_FLAG_NORMALIZED;
params.Environment = env; params.Environment = env;
params.EnvironmentSize = size; params.EnvironmentSize = size;
init_unicode_string( &params.CurrentDirectory.DosPath, sysdirW ); init_unicode_string( &params.CurrentDirectory.DosPath, system_dir + 4 );
init_unicode_string( &params.DllPath, sysdirW ); init_unicode_string( &params.DllPath, system_dir + 4 );
init_unicode_string( &params.ImagePathName, appnameW + 4 ); init_unicode_string( &params.ImagePathName, appnameW + 4 );
init_unicode_string( &params.CommandLine, cmdlineW ); init_unicode_string( &params.CommandLine, cmdlineW );
init_unicode_string( &params.WindowTitle, appnameW + 4 ); init_unicode_string( &params.WindowTitle, appnameW + 4 );
......
...@@ -381,8 +381,6 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, WCHA ...@@ -381,8 +381,6 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, WCHA
enum loadorder CDECL get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_name ) enum loadorder CDECL get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_name )
{ {
static const WCHAR prefixW[] = {'\\','?','?','\\'}; static const WCHAR prefixW[] = {'\\','?','?','\\'};
static const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s',
'\\','s','y','s','t','e','m','3','2'};
enum loadorder ret = LO_INVALID; enum loadorder ret = LO_INVALID;
HANDLE std_key, app_key = 0; HANDLE std_key, app_key = 0;
const WCHAR *path = nt_name->Buffer; const WCHAR *path = nt_name->Buffer;
...@@ -398,9 +396,9 @@ enum loadorder CDECL get_load_order( const WCHAR *app_name, const UNICODE_STRING ...@@ -398,9 +396,9 @@ enum loadorder CDECL get_load_order( const WCHAR *app_name, const UNICODE_STRING
/* Strip path information if the module resides in the system directory /* Strip path information if the module resides in the system directory
*/ */
if (!wcsnicmp( system_dir, path, ARRAY_SIZE( system_dir ))) if (!wcsnicmp( system_dir + 4, path, wcslen(system_dir) - 4 ))
{ {
const WCHAR *p = path + ARRAY_SIZE( system_dir ); const WCHAR *p = path + wcslen( system_dir ) - 4;
while (*p == '\\' || *p == '/') p++; while (*p == '\\' || *p == '/') p++;
if (!wcschr( p, '\\' ) && !wcschr( p, '/' )) path = p; if (!wcschr( p, '\\' ) && !wcschr( p, '/' )) path = p;
} }
......
...@@ -281,13 +281,12 @@ static startup_info_t *create_startup_info( const RTL_USER_PROCESS_PARAMETERS *p ...@@ -281,13 +281,12 @@ static startup_info_t *create_startup_info( const RTL_USER_PROCESS_PARAMETERS *p
*/ */
static BOOL is_builtin_path( UNICODE_STRING *path, BOOL *is_64bit ) static BOOL is_builtin_path( UNICODE_STRING *path, BOOL *is_64bit )
{ {
static const WCHAR systemW[] = {'\\','?','?','\\','c',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\'};
static const WCHAR wow64W[] = {'\\','?','?','\\','c',':','\\','w','i','n','d','o','w','s','\\', static const WCHAR wow64W[] = {'\\','?','?','\\','c',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','w','o','w','6','4'}; 's','y','s','w','o','w','6','4'};
*is_64bit = is_win64; *is_64bit = is_win64;
if (path->Length > sizeof(systemW) && !wcsnicmp( path->Buffer, systemW, ARRAY_SIZE(systemW) )) if (path->Length > wcslen(system_dir) * sizeof(WCHAR) &&
!wcsnicmp( path->Buffer, system_dir, wcslen(system_dir) ))
{ {
#ifndef _WIN64 #ifndef _WIN64
if (NtCurrentTeb64() && NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR]) *is_64bit = TRUE; if (NtCurrentTeb64() && NtCurrentTeb64()->TlsSlots[WOW64_TLS_FILESYSREDIR]) *is_64bit = TRUE;
......
...@@ -122,6 +122,7 @@ extern int main_argc DECLSPEC_HIDDEN; ...@@ -122,6 +122,7 @@ extern int main_argc DECLSPEC_HIDDEN;
extern char **main_argv DECLSPEC_HIDDEN; extern char **main_argv DECLSPEC_HIDDEN;
extern char **main_envp DECLSPEC_HIDDEN; extern char **main_envp DECLSPEC_HIDDEN;
extern WCHAR **main_wargv DECLSPEC_HIDDEN; extern WCHAR **main_wargv DECLSPEC_HIDDEN;
extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
extern unsigned int server_cpus DECLSPEC_HIDDEN; extern unsigned int server_cpus DECLSPEC_HIDDEN;
extern BOOL is_wow64 DECLSPEC_HIDDEN; extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern BOOL process_exiting DECLSPEC_HIDDEN; extern BOOL process_exiting DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment