[PATCH] ntdll: Use wide-char string literals.

Michael Stefaniuc mstefani at winehq.org
Thu Dec 3 17:36:32 CST 2020


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/ntdll/atom.c      |   3 +-
 dlls/ntdll/directory.c |   6 +-
 dlls/ntdll/env.c       | 138 +++++++++++++----------------------------
 dlls/ntdll/loader.c    | 107 +++++++++++---------------------
 dlls/ntdll/loadorder.c |  24 +++----
 dlls/ntdll/locale.c    |   8 +--
 dlls/ntdll/path.c      |  15 ++---
 dlls/ntdll/reg.c       |  31 ++-------
 dlls/ntdll/relay.c     |  32 +++-------
 dlls/ntdll/rtl.c       |   6 +-
 dlls/ntdll/rtlstr.c    |  20 ++----
 dlls/ntdll/sec.c       |   7 +--
 12 files changed, 123 insertions(+), 274 deletions(-)

diff --git a/dlls/ntdll/atom.c b/dlls/ntdll/atom.c
index fd1f17b6197..8facadbf8f6 100644
--- a/dlls/ntdll/atom.c
+++ b/dlls/ntdll/atom.c
@@ -102,11 +102,10 @@ NTSTATUS WINAPI RtlDeleteAtomFromAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom
  */
 static ULONG integral_atom_name(WCHAR* buffer, ULONG len, RTL_ATOM atom)
 {
-    static const WCHAR fmt[] = {'#','%','u',0};
     WCHAR tmp[16];
     int ret;
 
-    ret = swprintf( tmp, ARRAY_SIZE(tmp), fmt, atom );
+    ret = swprintf( tmp, ARRAY_SIZE(tmp), L"#%u", atom );
     if (!len) return ret * sizeof(WCHAR);
     if (len <= ret) ret = len - 1;
     memcpy( buffer, tmp, ret * sizeof(WCHAR) );
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 39641e9d4d5..cfb4595d457 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -50,8 +50,6 @@ static BOOL show_dot_files;
  */
 void init_directories(void)
 {
-    static const WCHAR WineW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
-    static const WCHAR ShowDotFilesW[] = {'S','h','o','w','D','o','t','F','i','l','e','s',0};
     char tmp[80];
     HANDLE root, hkey;
     DWORD dummy;
@@ -65,12 +63,12 @@ void init_directories(void)
     attr.Attributes = 0;
     attr.SecurityDescriptor = NULL;
     attr.SecurityQualityOfService = NULL;
-    RtlInitUnicodeString( &nameW, WineW );
+    RtlInitUnicodeString( &nameW, L"Software\\Wine" );
 
     /* @@ Wine registry key: HKCU\Software\Wine */
     if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
     {
-        RtlInitUnicodeString( &nameW, ShowDotFilesW );
+        RtlInitUnicodeString( &nameW, L"ShowDotFiles" );
         if (!NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, tmp, sizeof(tmp), &dummy ))
         {
             WCHAR *str = (WCHAR *)((KEY_VALUE_PARTIAL_INFORMATION *)tmp)->Data;
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c
index bf3fedcac67..5d1b6de5bba 100644
--- a/dlls/ntdll/env.c
+++ b/dlls/ntdll/env.c
@@ -33,7 +33,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(environ);
 
-static WCHAR empty[] = {0};
+static WCHAR empty[] = L"";
 static const UNICODE_STRING empty_str = { 0, sizeof(empty), empty };
 static const UNICODE_STRING null_str = { 0, 0, NULL };
 
@@ -76,7 +76,6 @@ static void set_env_var( WCHAR **env, const WCHAR *name, const WCHAR *val )
 static void set_registry_variables( WCHAR **env, HANDLE hkey, ULONG type )
 {
     static const WCHAR pathW[] = {'P','A','T','H'};
-    static const WCHAR sep[] = {';',0};
     UNICODE_STRING env_name, env_value;
     NTSTATUS status;
     DWORD size;
@@ -114,7 +113,7 @@ static void set_registry_variables( WCHAR **env, HANDLE hkey, ULONG type )
             !wcsnicmp( env_name.Buffer, pathW, ARRAY_SIZE( pathW )) &&
             !RtlQueryEnvironmentVariable_U( *env, &env_name, &tmp ))
         {
-            RtlAppendUnicodeToString( &tmp, sep );
+            RtlAppendUnicodeToString( &tmp, L";" );
             if (RtlAppendUnicodeStringToString( &tmp, &env_value )) continue;
             RtlCopyUnicodeString( &env_value, &tmp );
         }
@@ -137,16 +136,6 @@ static void set_registry_variables( WCHAR **env, HANDLE hkey, ULONG type )
  */
 static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
 {
-    static const WCHAR env_keyW[] = {'\\','R','e','g','i','s','t','r','y','\\',
-                                     'M','a','c','h','i','n','e','\\',
-                                     'S','y','s','t','e','m','\\',
-                                     'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
-                                     'C','o','n','t','r','o','l','\\',
-                                     'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
-                                     'E','n','v','i','r','o','n','m','e','n','t',0};
-    static const WCHAR envW[] = {'E','n','v','i','r','o','n','m','e','n','t',0};
-    static const WCHAR volatile_envW[] = {'V','o','l','a','t','i','l','e',' ','E','n','v','i','r','o','n','m','e','n','t',0};
-
     OBJECT_ATTRIBUTES attr;
     UNICODE_STRING nameW;
     HANDLE hkey;
@@ -154,7 +143,8 @@ static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
 
     /* first the system environment variables */
     InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL );
-    RtlInitUnicodeString( &nameW, env_keyW );
+    RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\"
+                          "Session Manager\\Environment" );
     if (first_time && !NtOpenKey( &hkey, KEY_READ, &attr ))
     {
         set_registry_variables( env, hkey, REG_SZ );
@@ -165,7 +155,7 @@ static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
 
     /* then the ones for the current user */
     if (RtlOpenCurrentUser( KEY_READ, &attr.RootDirectory ) != STATUS_SUCCESS) return ret;
-    RtlInitUnicodeString( &nameW, envW );
+    RtlInitUnicodeString( &nameW, L"Environment" );
     if (first_time && !NtOpenKey( &hkey, KEY_READ, &attr ))
     {
         set_registry_variables( env, hkey, REG_SZ );
@@ -173,7 +163,7 @@ static BOOL set_registry_environment( WCHAR **env, BOOL first_time )
         NtClose( hkey );
     }
 
-    RtlInitUnicodeString( &nameW, volatile_envW );
+    RtlInitUnicodeString( &nameW, L"Volatile Environment" );
     if (!NtOpenKey( &hkey, KEY_READ, &attr ))
     {
         set_registry_variables( env, hkey, REG_SZ );
@@ -237,26 +227,6 @@ static WCHAR *get_registry_value( WCHAR *env, HKEY hkey, const WCHAR *name )
  */
 static void set_additional_environment( WCHAR **env )
 {
-    static const WCHAR profile_keyW[] = {'\\','R','e','g','i','s','t','r','y','\\',
-                                         'M','a','c','h','i','n','e','\\',
-                                         'S','o','f','t','w','a','r','e','\\',
-                                         'M','i','c','r','o','s','o','f','t','\\',
-                                         'W','i','n','d','o','w','s',' ','N','T','\\',
-                                         'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
-                                         'P','r','o','f','i','l','e','L','i','s','t',0};
-    static const WCHAR computer_keyW[] = {'\\','R','e','g','i','s','t','r','y','\\',
-                                          'M','a','c','h','i','n','e','\\',
-                                          'S','y','s','t','e','m','\\',
-                                          'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
-                                          'C','o','n','t','r','o','l','\\',
-                                          'C','o','m','p','u','t','e','r','N','a','m','e','\\',
-                                          'A','c','t','i','v','e','C','o','m','p','u','t','e','r','N','a','m','e',0};
-    static const WCHAR computer_valueW[] = {'C','o','m','p','u','t','e','r','N','a','m','e',0};
-    static const WCHAR public_valueW[] = {'P','u','b','l','i','c',0};
-    static const WCHAR computernameW[] = {'C','O','M','P','U','T','E','R','N','A','M','E',0};
-    static const WCHAR allusersW[] = {'A','L','L','U','S','E','R','S','P','R','O','F','I','L','E',0};
-    static const WCHAR programdataW[] = {'P','r','o','g','r','a','m','D','a','t','a',0};
-    static const WCHAR publicW[] = {'P','U','B','L','I','C',0};
     OBJECT_ATTRIBUTES attr;
     UNICODE_STRING nameW;
     WCHAR *val;
@@ -265,18 +235,19 @@ static void set_additional_environment( WCHAR **env )
     /* set the user profile variables */
 
     InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL );
-    RtlInitUnicodeString( &nameW, profile_keyW );
+    RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\"
+                          "CurrentVersion\\ProfileList" );
     if (!NtOpenKey( &hkey, KEY_READ, &attr ))
     {
-        if ((val = get_registry_value( *env, hkey, programdataW )))
+        if ((val = get_registry_value( *env, hkey, L"ProgramData" )))
         {
-            set_env_var( env, allusersW, val );
-            set_env_var( env, programdataW, val );
+            set_env_var( env, L"ALLUSERSPROFILE", val );
+            set_env_var( env, L"ProgramData", val );
             RtlFreeHeap( GetProcessHeap(), 0, val );
         }
-        if ((val = get_registry_value( *env, hkey, public_valueW )))
+        if ((val = get_registry_value( *env, hkey, L"Public" )))
         {
-            set_env_var( env, publicW, val );
+            set_env_var( env, L"PUBLIC", val );
             RtlFreeHeap( GetProcessHeap(), 0, val );
         }
         NtClose( hkey );
@@ -284,12 +255,13 @@ static void set_additional_environment( WCHAR **env )
 
     /* set the computer name */
 
-    RtlInitUnicodeString( &nameW, computer_keyW );
+    RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\"
+                          "ComputerName\\ActiveComputerName" );
     if (!NtOpenKey( &hkey, KEY_READ, &attr ))
     {
-        if ((val = get_registry_value( *env, hkey, computer_valueW )))
+        if ((val = get_registry_value( *env, hkey, L"ComputerName" )))
         {
-            set_env_var( env, computernameW, val );
+            set_env_var( env, L"COMPUTERNAME", val );
             RtlFreeHeap( GetProcessHeap(), 0, val );
         }
         NtClose( hkey );
@@ -304,25 +276,8 @@ static void set_additional_environment( WCHAR **env )
  */
 static void set_wow64_environment( WCHAR **env )
 {
-    static WCHAR archW[]    = {'P','R','O','C','E','S','S','O','R','_','A','R','C','H','I','T','E','C','T','U','R','E',0};
-    static WCHAR arch6432W[] = {'P','R','O','C','E','S','S','O','R','_','A','R','C','H','I','T','E','W','6','4','3','2',0};
-    static const WCHAR x86W[] = {'x','8','6',0};
-    static const WCHAR versionW[] = {'\\','R','e','g','i','s','t','r','y','\\',
-                                     'M','a','c','h','i','n','e','\\',
-                                     'S','o','f','t','w','a','r','e','\\',
-                                     'M','i','c','r','o','s','o','f','t','\\',
-                                     'W','i','n','d','o','w','s','\\',
-                                     'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
-    static const WCHAR progdirW[]   = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',0};
-    static const WCHAR progdir86W[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0};
-    static const WCHAR progfilesW[] = {'P','r','o','g','r','a','m','F','i','l','e','s',0};
-    static const WCHAR progfiles86W[] = {'P','r','o','g','r','a','m','F','i','l','e','s','(','x','8','6',')',0};
-    static const WCHAR progw6432W[] = {'P','r','o','g','r','a','m','W','6','4','3','2',0};
-    static const WCHAR commondirW[]   = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',0};
-    static const WCHAR commondir86W[] = {'C','o','m','m','o','n','F','i','l','e','s','D','i','r',' ','(','x','8','6',')',0};
-    static const WCHAR commonfilesW[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','F','i','l','e','s',0};
-    static const WCHAR commonfiles86W[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','F','i','l','e','s','(','x','8','6',')',0};
-    static const WCHAR commonw6432W[] = {'C','o','m','m','o','n','P','r','o','g','r','a','m','W','6','4','3','2',0};
+    static WCHAR archW[]    = L"PROCESSOR_ARCHITECTURE";
+    static WCHAR arch6432W[] = L"PROCESSOR_ARCHITEW6432";
 
     WCHAR buf[256];
     UNICODE_STRING arch_strW = { sizeof(archW) - sizeof(WCHAR), sizeof(archW), archW };
@@ -363,42 +318,42 @@ static void set_wow64_environment( WCHAR **env )
         if (is_wow64)
         {
             RtlSetEnvironmentVariable( env, &arch6432_strW, &valW );
-            RtlInitUnicodeString( &nameW, x86W );
+            RtlInitUnicodeString( &nameW, L"x86" );
             RtlSetEnvironmentVariable( env, &arch_strW, &nameW );
         }
     }
 
     InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL );
-    RtlInitUnicodeString( &nameW, versionW );
+    RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion" );
     if (NtOpenKey( &hkey, KEY_READ | KEY_WOW64_64KEY, &attr )) return;
 
     /* set the ProgramFiles variables */
 
-    if ((val = get_registry_value( *env, hkey, progdirW )))
+    if ((val = get_registry_value( *env, hkey, L"ProgramFilesDir" )))
     {
-        if (is_win64 || is_wow64) set_env_var( env, progw6432W, val );
-        if (is_win64 || !is_wow64) set_env_var( env, progfilesW, val );
+        if (is_win64 || is_wow64) set_env_var( env, L"ProgramW6432", val );
+        if (is_win64 || !is_wow64) set_env_var( env, L"ProgramFiles", val );
         RtlFreeHeap( GetProcessHeap(), 0, val );
     }
-    if ((val = get_registry_value( *env, hkey, progdir86W )))
+    if ((val = get_registry_value( *env, hkey, L"ProgramFilesDir (x86)" )))
     {
-        if (is_win64 || is_wow64) set_env_var( env, progfiles86W, val );
-        if (is_wow64) set_env_var( env, progfilesW, val );
+        if (is_win64 || is_wow64) set_env_var( env, L"ProgramFiles(x86)", val );
+        if (is_wow64) set_env_var( env, L"ProgramFiles", val );
         RtlFreeHeap( GetProcessHeap(), 0, val );
     }
 
     /* set the CommonProgramFiles variables */
 
-    if ((val = get_registry_value( *env, hkey, commondirW )))
+    if ((val = get_registry_value( *env, hkey, L"CommonFilesDir" )))
     {
-        if (is_win64 || is_wow64) set_env_var( env, commonw6432W, val );
-        if (is_win64 || !is_wow64) set_env_var( env, commonfilesW, val );
+        if (is_win64 || is_wow64) set_env_var( env, L"CommonProgramW6432", val );
+        if (is_win64 || !is_wow64) set_env_var( env, L"CommonProgramFiles", val );
         RtlFreeHeap( GetProcessHeap(), 0, val );
     }
-    if ((val = get_registry_value( *env, hkey, commondir86W )))
+    if ((val = get_registry_value( *env, hkey, L"CommonFilesDir (x86)" )))
     {
-        if (is_win64 || is_wow64) set_env_var( env, commonfiles86W, val );
-        if (is_wow64) set_env_var( env, commonfilesW, val );
+        if (is_win64 || is_wow64) set_env_var( env, L"CommonProgramFiles(x86)", val );
+        if (is_wow64) set_env_var( env, L"CommonProgramFiles", val );
         RtlFreeHeap( GetProcessHeap(), 0, val );
     }
     NtClose( hkey );
@@ -469,7 +424,6 @@ static inline BOOL is_path_prefix( const WCHAR *prefix, const WCHAR *path, const
  */
 static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
 {
-    static const WCHAR exeW[] = {'.','e','x','e',0};
     WCHAR *load_path, *file_part, full_name[MAX_PATH];
     DWORD len;
 
@@ -482,7 +436,7 @@ static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
         if (RtlDoesFileExists_U( full_name )) goto done;
         if (len < (MAX_PATH - 4) * sizeof(WCHAR) && !wcschr( file_part, '.' ))
         {
-            wcscat( file_part, exeW );
+            wcscat( file_part, L".exe" );
             if (RtlDoesFileExists_U( full_name )) goto done;
         }
         /* check for builtin path inside system directory */
@@ -495,7 +449,7 @@ static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
     else
     {
         RtlGetExePath( name, &load_path );
-        len = RtlDosSearchPath_U( load_path, name, exeW, sizeof(full_name), full_name, &file_part );
+        len = RtlDosSearchPath_U( load_path, name, L".exe", sizeof(full_name), full_name, &file_part );
         RtlReleasePath( load_path );
         if (!len || len > sizeof(full_name))
         {
@@ -504,7 +458,7 @@ static void get_image_path( const WCHAR *name, UNICODE_STRING *path )
             if (wcslen( name ) >= MAX_PATH - 4 - len) goto failed;
             wcscpy( full_name, system_dir );
             wcscat( full_name, name );
-            if (!wcschr( name, '.' )) wcscat( full_name, exeW );
+            if (!wcschr( name, '.' )) wcscat( full_name, L".exe" );
         }
     }
 done:
@@ -1140,15 +1094,6 @@ static inline void get_unicode_string( UNICODE_STRING *str, WCHAR **src, UINT le
  */
 static void run_wineboot( WCHAR **env )
 {
-    static const WCHAR wineboot_eventW[] = {'\\','K','e','r','n','e','l','O','b','j','e','c','t','s',
-                                            '\\','_','_','w','i','n','e','b','o','o','t','_','e','v','e','n','t',0};
-    static const WCHAR wineboot[] = {'\\','?','?','\\','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',0};
-    static const WCHAR cmdline[] = {'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',' ',
-                                    '-','-','i','n','i','t',0};
     UNICODE_STRING nameW, cmdlineW, dllpathW;
     RTL_USER_PROCESS_PARAMETERS *params;
     RTL_USER_PROCESS_INFORMATION info;
@@ -1160,7 +1105,7 @@ static void run_wineboot( WCHAR **env )
     ULONG redir = 0;
     int count = 1;
 
-    RtlInitUnicodeString( &nameW, wineboot_eventW );
+    RtlInitUnicodeString( &nameW, L"\\KernelObjects\\__wineboot_event" );
     InitializeObjectAttributes( &attr, &nameW, OBJ_OPENIF, 0, NULL );
 
     status = NtCreateEvent( &handles[0], EVENT_ALL_ACCESS, &attr, NotificationEvent, 0 );
@@ -1170,17 +1115,18 @@ static void run_wineboot( WCHAR **env )
         ERR( "failed to create wineboot event, expect trouble\n" );
         return;
     }
-    LdrGetDllPath( wineboot + 4, LOAD_WITH_ALTERED_SEARCH_PATH, &load_path, &dummy );
-    RtlInitUnicodeString( &nameW, wineboot + 4 );
+    LdrGetDllPath( L"C:\\windows\\system32\\wineboot.exe", LOAD_WITH_ALTERED_SEARCH_PATH,
+                   &load_path, &dummy );
+    RtlInitUnicodeString( &nameW, L"C:\\windows\\system32\\wineboot.exe" );
     RtlInitUnicodeString( &dllpathW, load_path );
-    RtlInitUnicodeString( &cmdlineW, cmdline );
+    RtlInitUnicodeString( &cmdlineW, L"C:\\windows\\system32\\wineboot.exe --init" );
     RtlCreateProcessParametersEx( &params, &nameW, &dllpathW, NULL, &cmdlineW, *env, NULL, NULL,
                                   NULL, NULL, PROCESS_PARAMS_FLAG_NORMALIZED );
     params->hStdInput  = 0;
     params->hStdOutput = 0;
     params->hStdError  = NtCurrentTeb()->Peb->ProcessParameters->hStdError;
 
-    RtlInitUnicodeString( &nameW, wineboot );
+    RtlInitUnicodeString( &nameW, L"\\??\\C:\\windows\\system32\\wineboot.exe" );
     RtlWow64EnableFsRedirectionEx( TRUE, &redir );
     status = RtlCreateUserProcess( &nameW, OBJ_CASE_INSENSITIVE, params,
                                    NULL, NULL, 0, FALSE, 0, 0, &info );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index ff5a175027c..45ad496fd64 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -63,23 +63,16 @@ void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) = NUL
 const struct unix_funcs *unix_funcs = NULL;
 
 /* windows directory */
-const WCHAR windows_dir[] = {'C',':','\\','w','i','n','d','o','w','s',0};
+const WCHAR windows_dir[] = L"C:\\windows";
 /* 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};
-const WCHAR syswow64_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
-                              's','y','s','w','o','w','6','4','\\',0};
+const WCHAR system_dir[] = L"C:\\windows\\system32\\";
+const WCHAR syswow64_dir[] = L"C:\\windows\\syswow64\\";
 
 static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
 BOOL is_wow64 = FALSE;
 
 /* system search path */
-static const WCHAR system_path[] =
-    {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2',';',
-     'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m',';',
-     'C',':','\\','w','i','n','d','o','w','s',0};
-
-static const WCHAR dotW[] = {'.',0};
+static const WCHAR system_path[] = L"C:\\windows\\system32;C:\\windows\\system;C:\\windows";
 
 static BOOL imports_fixup_done = FALSE;  /* set once the imports have been fixed up, before attaching them */
 static BOOL process_detaching = FALSE;  /* set on process detach to avoid deadlocks with thread detach */
@@ -116,8 +109,6 @@ static const char * const reason_names[] =
     "WINE_PREATTACH"
 };
 
-static const WCHAR dllW[] = {'.','d','l','l',0};
-
 struct file_id
 {
     BYTE ObjectId[16];
@@ -613,20 +604,21 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
     FARPROC proc = NULL;
 
     if (!end) return NULL;
-    if ((end - forward) * sizeof(WCHAR) > sizeof(buffer) - sizeof(dllW))
+    if ((end - forward) * sizeof(WCHAR) > sizeof(buffer) - sizeof(L".dll"))
     {
-        if (!(mod_name = RtlAllocateHeap( GetProcessHeap(), 0, (end - forward + sizeof(dllW)) * sizeof(WCHAR) )))
+        if (!(mod_name = RtlAllocateHeap( GetProcessHeap(), 0,
+                                          (end - forward + sizeof(L".dll")) * sizeof(WCHAR) )))
             return NULL;
     }
     ascii_to_unicode( mod_name, forward, end - forward );
     mod_name[end - forward] = 0;
     if (!wcschr( mod_name, '.' ))
-        memcpy( mod_name + (end - forward), dllW, sizeof(dllW) );
+        memcpy( mod_name + (end - forward), L".dll", sizeof(L".dll") );
 
     if (!(wm = find_basename_module( mod_name )))
     {
         TRACE( "delay loading %s for '%s'\n", debugstr_w(mod_name), forward );
-        if (load_dll( load_path, mod_name, dllW, 0, &wm ) == STATUS_SUCCESS &&
+        if (load_dll( load_path, mod_name, L".dll", 0, &wm ) == STATUS_SUCCESS &&
             !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
         {
             if (!imports_fixup_done && current_modref)
@@ -789,7 +781,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
     {
         ascii_to_unicode( buffer, name, len );
         buffer[len] = 0;
-        status = load_dll( load_path, buffer, dllW, 0, &wmImp );
+        status = load_dll( load_path, buffer, L".dll", 0, &wmImp );
     }
     else  /* need to allocate a larger buffer */
     {
@@ -797,7 +789,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
         if (!ptr) return FALSE;
         ascii_to_unicode( ptr, name, len );
         ptr[len] = 0;
-        status = load_dll( load_path, ptr, dllW, 0, &wmImp );
+        status = load_dll( load_path, ptr, L".dll", 0, &wmImp );
         RtlFreeHeap( GetProcessHeap(), 0, ptr );
     }
 
@@ -930,8 +922,6 @@ static NTSTATUS create_module_activation_context( LDR_DATA_TABLE_ENTRY *module )
  */
 static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_HEADERS *nt, LPCWSTR filename )
 {
-    static const WCHAR ntdllW[]    = {'n','t','d','l','l','.','d','l','l',0};
-    static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
     const IMAGE_IMPORT_DESCRIPTOR *imports;
     DWORD i, size;
     WCHAR buffer[16];
@@ -949,7 +939,7 @@ static BOOL is_dll_native_subsystem( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_NT_H
             DWORD len = strlen(name);
             if (len * sizeof(WCHAR) >= sizeof(buffer)) continue;
             ascii_to_unicode( buffer, name, len + 1 );
-            if (!wcsicmp( buffer, ntdllW ) || !wcsicmp( buffer, kernel32W ))
+            if (!wcsicmp( buffer, L"ntdll.dll" ) || !wcsicmp( buffer, L"kernel32.dll" ))
             {
                 TRACE( "%s imports %s, assuming not native\n", debugstr_w(filename), debugstr_w(buffer) );
                 return FALSE;
@@ -1067,7 +1057,6 @@ static void free_tls_slot( LDR_DATA_TABLE_ENTRY *mod )
  */
 static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void **entry )
 {
-    static const WCHAR mscoreeW[] = {'m','s','c','o','r','e','e','.','d','l','l',0};
     IMAGE_EXPORT_DIRECTORY *exports;
     DWORD exp_size;
     NTSTATUS status;
@@ -1082,7 +1071,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void *
 
     prev = current_modref;
     current_modref = wm;
-    if (!(status = load_dll( load_path, mscoreeW, NULL, 0, &imp ))) wm->deps[0] = imp;
+    if (!(status = load_dll( load_path, L"mscoree.dll", NULL, 0, &imp ))) wm->deps[0] = imp;
     current_modref = prev;
     if (status)
     {
@@ -2099,8 +2088,6 @@ static inline WCHAR *append_path( WCHAR *p, const WCHAR *str, int len )
  */
 static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_mode, WCHAR **path )
 {
-    static const WCHAR pathW[] = {'P','A','T','H',0};
-
     const WCHAR *mod_end = module;
     UNICODE_STRING name, value;
     WCHAR *p, *ret;
@@ -2112,7 +2099,7 @@ static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_m
         len += (mod_end - module) + 1;
     }
 
-    RtlInitUnicodeString( &name, pathW );
+    RtlInitUnicodeString( &name, L"PATH" );
     value.Length = 0;
     value.MaximumLength = 0;
     value.Buffer = NULL;
@@ -2126,9 +2113,9 @@ static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_m
 
     p = append_path( p, module, mod_end - module );
     if (dll_dir) p = append_path( p, dll_dir, -1 );
-    else if (!safe_mode) p = append_path( p, dotW, -1 );
+    else if (!safe_mode) p = append_path( p, L".", -1 );
     p = append_path( p, system_path, -1 );
-    if (!dll_dir && safe_mode) p = append_path( p, dotW, -1 );
+    if (!dll_dir && safe_mode) p = append_path( p, L".", -1 );
 
     value.Buffer = p;
     value.MaximumLength = path_len;
@@ -2400,7 +2387,6 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_na
 static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
 {
     static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s','\\'};
-    static const WCHAR dotManifestW[] = {'.','m','a','n','i','f','e','s','t',0};
 
     ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info;
     ACTCTX_SECTION_KEYED_DATA data;
@@ -2446,7 +2432,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
         len = wcslen( p );
         if (!dirlen || len <= dirlen ||
             RtlCompareUnicodeStrings( p, dirlen, info->lpAssemblyDirectoryName, dirlen, TRUE ) ||
-            wcsicmp( p + dirlen, dotManifestW ))
+            wcsicmp( p + dirlen, L".manifest" ))
         {
             /* manifest name does not match directory name, so it's not a global
              * windows/winsxs manifest; use the manifest directory name instead */
@@ -2794,7 +2780,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags,
     RtlEnterCriticalSection( &loader_section );
 
     if (!path_name) path_name = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
-    nts = load_dll( path_name, libname->Buffer, dllW, flags, &wm );
+    nts = load_dll( path_name, libname->Buffer, L".dll", flags, &wm );
 
     if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
     {
@@ -2828,7 +2814,7 @@ NTSTATUS WINAPI LdrGetDllHandle( LPCWSTR load_path, ULONG flags, const UNICODE_S
 
     if (!load_path) load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
 
-    status = find_dll_file( load_path, name->Buffer, dllW, &nt_name, &wm, &module, &image_info, &id );
+    status = find_dll_file( load_path, name->Buffer, L".dll", &nt_name, &wm, &module, &image_info, &id );
 
     if (wm) *base = wm->ldr.DllBase;
     else
@@ -3574,20 +3560,6 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
  */
 static void load_global_options(void)
 {
-    static const WCHAR sessionW[] = {'M','a','c','h','i','n','e','\\',
-                                     'S','y','s','t','e','m','\\',
-                                     'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
-                                     'C','o','n','t','r','o','l','\\',
-                                     'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r',0};
-    static const WCHAR globalflagW[] = {'G','l','o','b','a','l','F','l','a','g',0};
-    static const WCHAR safesearchW[] = {'S','a','f','e','P','r','o','c','e','s','s','S','e','a','r','c','h','M','o','d','e',0};
-    static const WCHAR safedllmodeW[] = {'S','a','f','e','D','l','l','S','e','a','r','c','h','M','o','d','e',0};
-    static const WCHAR critsectW[] = {'C','r','i','t','i','c','a','l','S','e','c','t','i','o','n','T','i','m','e','o','u','t',0};
-    static const WCHAR heapresW[] = {'H','e','a','p','S','e','g','m','e','n','t','R','e','s','e','r','v','e',0};
-    static const WCHAR heapcommitW[] = {'H','e','a','p','S','e','g','m','e','n','t','C','o','m','m','i','t',0};
-    static const WCHAR decommittotalW[] = {'H','e','a','p','D','e','C','o','m','m','i','t','T','o','t','a','l','F','r','e','e','T','h','r','e','s','h','o','l','d',0};
-    static const WCHAR decommitfreeW[] = {'H','e','a','p','D','e','C','o','m','m','i','t','F','r','e','e','B','l','o','c','k','T','h','r','e','s','h','o','l','d',0};
-
     OBJECT_ATTRIBUTES attr;
     UNICODE_STRING name_str;
     HANDLE hkey;
@@ -3599,33 +3571,33 @@ static void load_global_options(void)
     attr.Attributes = OBJ_CASE_INSENSITIVE;
     attr.SecurityDescriptor = NULL;
     attr.SecurityQualityOfService = NULL;
-    RtlInitUnicodeString( &name_str, sessionW );
+    RtlInitUnicodeString( &name_str, L"Machine\\System\\CurrentControlSet\\Control\\Session Manager" );
 
     if (!NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr ))
     {
-        query_dword_option( hkey, globalflagW, &NtCurrentTeb()->Peb->NtGlobalFlag );
-        query_dword_option( hkey, safesearchW, &path_safe_mode );
-        query_dword_option( hkey, safedllmodeW, &dll_safe_mode );
+        query_dword_option( hkey, L"GlobalFlag", &NtCurrentTeb()->Peb->NtGlobalFlag );
+        query_dword_option( hkey, L"SafeProcessSearchMode", &path_safe_mode );
+        query_dword_option( hkey, L"SafeDllSearchMode", &dll_safe_mode );
 
-        if (!query_dword_option( hkey, critsectW, &value ))
+        if (!query_dword_option( hkey, L"CriticalSectionTimeout", &value ))
             NtCurrentTeb()->Peb->CriticalSectionTimeout.QuadPart = (ULONGLONG)value * -10000000;
 
-        if (!query_dword_option( hkey, heapresW, &value ))
+        if (!query_dword_option( hkey, L"HeapSegmentReserve", &value ))
             NtCurrentTeb()->Peb->HeapSegmentReserve = value;
 
-        if (!query_dword_option( hkey, heapcommitW, &value ))
+        if (!query_dword_option( hkey, L"HeapSegmentCommit", &value ))
             NtCurrentTeb()->Peb->HeapSegmentCommit = value;
 
-        if (!query_dword_option( hkey, decommittotalW, &value ))
+        if (!query_dword_option( hkey, L"HeapDeCommitTotalFreeThreshold", &value ))
             NtCurrentTeb()->Peb->HeapDeCommitTotalFreeThreshold = value;
 
-        if (!query_dword_option( hkey, decommitfreeW, &value ))
+        if (!query_dword_option( hkey, L"HeapDeCommitFreeBlockThreshold", &value ))
             NtCurrentTeb()->Peb->HeapDeCommitFreeBlockThreshold = value;
 
         NtClose( hkey );
     }
     LdrQueryImageFileExecutionOptions( &NtCurrentTeb()->Peb->ProcessParameters->ImagePathName,
-                                       globalflagW, REG_DWORD, &NtCurrentTeb()->Peb->NtGlobalFlag,
+                                       L"GlobalFlag", REG_DWORD, &NtCurrentTeb()->Peb->NtGlobalFlag,
                                        sizeof(DWORD), NULL );
     heap_set_debug_flags( GetProcessHeap() );
 }
@@ -3918,21 +3890,17 @@ NTSTATUS WINAPI RtlSetSearchPathMode( ULONG flags )
  */
 NTSTATUS WINAPI RtlGetExePath( PCWSTR name, PWSTR *path )
 {
-    static const WCHAR emptyW[1];
-    const WCHAR *dlldir = dotW;
+    const WCHAR *dlldir = L".";
     const WCHAR *module = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
 
     /* same check as NeedCurrentDirectoryForExePathW */
     if (!wcschr( name, '\\' ))
     {
-        static const WCHAR env_name[] = {'N','o','D','e','f','a','u','l','t','C','u','r','r','e','n','t',
-                                         'D','i','r','e','c','t','o','r','y','I','n',
-                                         'E','x','e','P','a','t','h',0};
         UNICODE_STRING name, value = { 0 };
 
-        RtlInitUnicodeString( &name, env_name );
+        RtlInitUnicodeString( &name, L"NoDefaultCurrentDirectoryInExePath" );
         if (RtlQueryEnvironmentVariable_U( NULL, &name, &value ) != STATUS_VARIABLE_NOT_FOUND)
-            dlldir = emptyW;
+            dlldir = L"";
     }
     return get_dll_load_path( module, dlldir, FALSE, path );
 }
@@ -3995,12 +3963,6 @@ static void restart_winevdm( RTL_USER_PROCESS_PARAMETERS *params )
  */
 static NTSTATUS process_init(void)
 {
-    static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
-                                   's','y','s','t','e','m','3','2','\\',
-                                   'n','t','d','l','l','.','d','l','l',0};
-    static const WCHAR kernel32W[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
-                                      's','y','s','t','e','m','3','2','\\',
-                                      'k','e','r','n','e','l','3','2','.','d','l','l',0};
     RTL_USER_PROCESS_PARAMETERS *params;
     WINE_MODREF *wm;
     NTSTATUS status;
@@ -4046,13 +4008,14 @@ static NTSTATUS process_init(void)
     version_init();
 
     /* setup the load callback and create ntdll modref */
-    RtlInitUnicodeString( &nt_name, ntdllW );
+    RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
     NtQueryVirtualMemory( GetCurrentProcess(), process_init, MemoryBasicInformation,
                           &meminfo, sizeof(meminfo), NULL );
     status = build_builtin_module( params->DllPath.Buffer, &nt_name, meminfo.AllocationBase, 0, &wm );
     assert( !status );
 
-    if ((status = load_dll( params->DllPath.Buffer, kernel32W, NULL, 0, &wm )) != STATUS_SUCCESS)
+    if ((status = load_dll( params->DllPath.Buffer, L"C:\\windows\\system32\\kernel32.dll",
+                            NULL, 0, &wm )) != STATUS_SUCCESS)
     {
         MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
         NtTerminateProcess( GetCurrentProcess(), status );
diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c
index c55806df2b8..e4aaf9dd74f 100644
--- a/dlls/ntdll/loadorder.c
+++ b/dlls/ntdll/loadorder.c
@@ -49,7 +49,7 @@ struct loadorder_list
     module_loadorder_t *order;
 };
 
-static const WCHAR separatorsW[] = {',',' ','\t',0};
+static const WCHAR separatorsW[] = L", \t";
 
 static BOOL init_done;
 static struct loadorder_list env_list;
@@ -89,10 +89,9 @@ static const WCHAR *get_basename( const WCHAR *name )
  */
 static inline void remove_dll_ext( WCHAR *name )
 {
-    static const WCHAR dllW[] = {'.','d','l','l',0};
     WCHAR *p = wcsrchr( name, '.' );
 
-    if (p && !wcsicmp( p, dllW )) *p = 0;
+    if (p && !wcsicmp( p, L".dll" )) *p = 0;
 }
 
 
@@ -224,7 +223,6 @@ static void add_load_order_set( WCHAR *entry )
  */
 static void init_load_order(void)
 {
-    static const WCHAR winedlloverridesW[] = {'W','I','N','E','D','L','L','O','V','E','R','R','I','D','E','S',0};
     WCHAR *entry, *next, *order;
     SIZE_T len = 1024;
     NTSTATUS status;
@@ -234,7 +232,7 @@ static void init_load_order(void)
     for (;;)
     {
         order = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) );
-        status = RtlQueryEnvironmentVariable( NULL, winedlloverridesW, wcslen(winedlloverridesW),
+        status = RtlQueryEnvironmentVariable( NULL, L"WINEDLLOVERRIDES", wcslen(L"WINEDLLOVERRIDES"),
                                               order, len - 1, &len );
         if (!status)
         {
@@ -290,8 +288,6 @@ static inline enum loadorder get_env_load_order( const WCHAR *module )
  */
 static HANDLE get_standard_key(void)
 {
-    static const WCHAR DllOverridesW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
-                                          'D','l','l','O','v','e','r','r','i','d','e','s',0};
     static HANDLE std_key = (HANDLE)-1;
 
     if (std_key == (HANDLE)-1)
@@ -307,7 +303,7 @@ static HANDLE get_standard_key(void)
         attr.Attributes = 0;
         attr.SecurityDescriptor = NULL;
         attr.SecurityQualityOfService = NULL;
-        RtlInitUnicodeString( &nameW, DllOverridesW );
+        RtlInitUnicodeString( &nameW, L"Software\\Wine\\DllOverrides" );
 
         /* @@ Wine registry key: HKCU\Software\Wine\DllOverrides */
         if (NtOpenKey( &std_key, KEY_ALL_ACCESS, &attr )) std_key = 0;
@@ -328,20 +324,17 @@ static HANDLE get_app_key( const WCHAR *app_name )
     UNICODE_STRING nameW;
     HANDLE root;
     WCHAR *str;
-    static const WCHAR AppDefaultsW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\',
-                                         'A','p','p','D','e','f','a','u','l','t','s','\\',0};
-    static const WCHAR DllOverridesW[] = {'\\','D','l','l','O','v','e','r','r','i','d','e','s',0};
     static HANDLE app_key = (HANDLE)-1;
 
     if (app_key != (HANDLE)-1) return app_key;
 
     str = RtlAllocateHeap( GetProcessHeap(), 0,
-                           sizeof(AppDefaultsW) + sizeof(DllOverridesW) +
+                           sizeof(L"Software\\Wine\\AppDefaults\\") + sizeof(L"\\DllOverrides") +
                            wcslen(app_name) * sizeof(WCHAR) );
     if (!str) return 0;
-    wcscpy( str, AppDefaultsW );
+    wcscpy( str, L"Software\\Wine\\AppDefaults\\" );
     wcscat( str, app_name );
-    wcscat( str, DllOverridesW );
+    wcscat( str, L"\\DllOverrides" );
 
     RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
     attr.Length = sizeof(attr);
@@ -425,7 +418,6 @@ static enum loadorder get_load_order_value( HANDLE std_key, HANDLE app_key, cons
  */
 enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_name )
 {
-    static const WCHAR nt_prefixW[] = {'\\','?','?','\\',0};
     enum loadorder ret = LO_INVALID;
     HANDLE std_key, app_key = 0;
     const WCHAR *path = nt_name->Buffer;
@@ -435,7 +427,7 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n
     if (!init_done) init_load_order();
     std_key = get_standard_key();
     if (app_name) app_key = get_app_key( app_name );
-    if (!wcsncmp( path, nt_prefixW, 4 )) path += 4;
+    if (!wcsncmp( path, L"\\??\\", 4 )) path += 4;
 
     TRACE("looking for %s\n", debugstr_w(path));
 
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index e3cc0d183c4..3979f41089b 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -1269,8 +1269,6 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
 {
     /* locale name format is: lang[-script][-country][_modifier] */
 
-    static const WCHAR sepW[] = {'-','_',0};
-
     const IMAGE_RESOURCE_DIRECTORY *resdir;
     const IMAGE_RESOURCE_DIRECTORY_ENTRY *et;
     LDR_RESOURCE_INFO info;
@@ -1291,16 +1289,16 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
     if (wcslen( name ) >= LOCALE_NAME_MAX_LENGTH) return STATUS_INVALID_PARAMETER_1;
     wcscpy( lang, name );
 
-    if ((p = wcspbrk( lang, sepW )) && *p == '-')
+    if ((p = wcspbrk( lang, L"-_" )) && *p == '-')
     {
         *p++ = 0;
         country = p;
-        if ((p = wcspbrk( p, sepW )) && *p == '-')
+        if ((p = wcspbrk( p, L"-_" )) && *p == '-')
         {
             *p++ = 0;
             script = country;
             country = p;
-            p = wcspbrk( p, sepW );
+            p = wcspbrk( p, L"-_" );
         }
         if (p) *p = 0;  /* FIXME: modifier is ignored */
         /* second value can be script or country, check length to resolve the ambiguity */
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 53470b4f357..86760f178e1 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -31,10 +31,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(file);
 
-static const WCHAR DeviceRootW[] = {'\\','\\','.','\\',0};
-static const WCHAR NTDosPrefixW[] = {'\\','?','?','\\',0};
-static const WCHAR UncPfxW[] = {'U','N','C','\\',0};
-
 #define IS_SEPARATOR(ch)  ((ch) == '\\' || (ch) == '/')
 
 /***********************************************************************
@@ -69,7 +65,6 @@ DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U( PCWSTR path )
  */
 ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
 {
-    static const WCHAR consoleW[] = {'\\','\\','.','\\','C','O','N',0};
     static const WCHAR auxW[] = {'A','U','X'};
     static const WCHAR comW[] = {'C','O','M'};
     static const WCHAR conW[] = {'C','O','N'};
@@ -87,7 +82,7 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
     case UNC_PATH:
         return 0;
     case DEVICE_PATH:
-        if (!wcsicmp( dos_name, consoleW ))
+        if (!wcsicmp( dos_name, L"\\\\.\\CON" ))
             return MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) );  /* 4 is length of \\.\ prefix */
         return 0;
     case ABSOLUTE_DRIVE_PATH:
@@ -207,12 +202,12 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
         return STATUS_NO_MEMORY;
     }
 
-    wcscpy(ntpath->Buffer, NTDosPrefixW);
+    wcscpy(ntpath->Buffer, L"\\??\\");
     switch (RtlDetermineDosPathNameType_U(ptr))
     {
     case UNC_PATH: /* \\foo */
         offset = 2;
-        wcscat(ntpath->Buffer, UncPfxW);
+        wcscat(ntpath->Buffer, L"UNC\\");
         break;
     case DEVICE_PATH: /* \\.\foo */
         offset = 4;
@@ -661,7 +656,7 @@ DWORD WINAPI RtlGetFullPathName_U(const WCHAR* name, ULONG size, WCHAR* buffer,
         DWORD   sz = LOWORD(dosdev); /* in bytes */
 
         if (8 + sz + 2 > size) return sz + 10;
-        wcscpy(buffer, DeviceRootW);
+        wcscpy(buffer, L"\\\\.\\");
         memmove(buffer + 4, name + offset, sz);
         buffer[4 + sz / sizeof(WCHAR)] = '\0';
         /* file_part isn't set in this case */
@@ -874,7 +869,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
     if (size && ptr[size - 1] != '\\') ptr[size++] = '\\';
 
     /* convert \??\UNC\ path to \\ prefix */
-    if (size >= 4 && !wcsnicmp(ptr, UncPfxW, 4))
+    if (size >= 4 && !wcsnicmp(ptr, L"UNC\\", 4))
     {
         ptr += 2;
         size -= 2;
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 5a54d7fee26..54f01049abf 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -402,49 +402,30 @@ static NTSTATUS RTL_KeyHandleCreateObject(ULONG RelativeTo, PCWSTR Path, POBJECT
     PCWSTR base;
     INT len;
 
-    static const WCHAR empty[] = {0};
-    static const WCHAR control[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e',
-    '\\','S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
-    'C','o','n','t','r','o','l','\\',0};
-
-    static const WCHAR devicemap[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
-    'H','a','r','d','w','a','r','e','\\','D','e','v','i','c','e','M','a','p','\\',0};
-
-    static const WCHAR services[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
-    'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
-    'S','e','r','v','i','c','e','s','\\',0};
-
-    static const WCHAR user[] = {'\\','R','e','g','i','s','t','r','y','\\','U','s','e','r','\\',
-    'C','u','r','r','e','n','t','U','s','e','r','\\',0};
-
-    static const WCHAR windows_nt[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\',
-    'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
-    'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',0};
-
     switch (RelativeTo & 0xff)
     {
     case RTL_REGISTRY_ABSOLUTE:
-        base = empty;
+        base = L"";
         break;
 
     case RTL_REGISTRY_CONTROL:
-        base = control;
+        base = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\";
         break;
 
     case RTL_REGISTRY_DEVICEMAP:
-        base = devicemap;
+        base = L"\\Registry\\Machine\\Hardware\\DeviceMap\\";
         break;
 
     case RTL_REGISTRY_SERVICES:
-        base = services;
+        base = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\";
         break;
 
     case RTL_REGISTRY_USER:
-        base = user;
+        base = L"\\Registry\\User\\CurrentUser\\";
         break;
 
     case RTL_REGISTRY_WINDOWS_NT:
-        base = windows_nt;
+        base = L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\";
         break;
 
     default:
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index e1596312491..ee7d9951c59 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -167,17 +167,6 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co
     OBJECT_ATTRIBUTES attr;
     UNICODE_STRING name;
     HANDLE root, hkey;
-    static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\',
-                                    'W','i','n','e','\\',
-                                    'D','e','b','u','g',0};
-    static const WCHAR RelayIncludeW[] = {'R','e','l','a','y','I','n','c','l','u','d','e',0};
-    static const WCHAR RelayExcludeW[] = {'R','e','l','a','y','E','x','c','l','u','d','e',0};
-    static const WCHAR SnoopIncludeW[] = {'S','n','o','o','p','I','n','c','l','u','d','e',0};
-    static const WCHAR SnoopExcludeW[] = {'S','n','o','o','p','E','x','c','l','u','d','e',0};
-    static const WCHAR RelayFromIncludeW[] = {'R','e','l','a','y','F','r','o','m','I','n','c','l','u','d','e',0};
-    static const WCHAR RelayFromExcludeW[] = {'R','e','l','a','y','F','r','o','m','E','x','c','l','u','d','e',0};
-    static const WCHAR SnoopFromIncludeW[] = {'S','n','o','o','p','F','r','o','m','I','n','c','l','u','d','e',0};
-    static const WCHAR SnoopFromExcludeW[] = {'S','n','o','o','p','F','r','o','m','E','x','c','l','u','d','e',0};
 
     RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
     attr.Length = sizeof(attr);
@@ -186,21 +175,21 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co
     attr.Attributes = 0;
     attr.SecurityDescriptor = NULL;
     attr.SecurityQualityOfService = NULL;
-    RtlInitUnicodeString( &name, configW );
+    RtlInitUnicodeString( &name, L"Software\\Wine\\Debug" );
 
     /* @@ Wine registry key: HKCU\Software\Wine\Debug */
     if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) hkey = 0;
     NtClose( root );
     if (!hkey) return TRUE;
 
-    debug_relay_includelist = load_list( hkey, RelayIncludeW );
-    debug_relay_excludelist = load_list( hkey, RelayExcludeW );
-    debug_snoop_includelist = load_list( hkey, SnoopIncludeW );
-    debug_snoop_excludelist = load_list( hkey, SnoopExcludeW );
-    debug_from_relay_includelist = load_list( hkey, RelayFromIncludeW );
-    debug_from_relay_excludelist = load_list( hkey, RelayFromExcludeW );
-    debug_from_snoop_includelist = load_list( hkey, SnoopFromIncludeW );
-    debug_from_snoop_excludelist = load_list( hkey, SnoopFromExcludeW );
+    debug_relay_includelist = load_list( hkey, L"RelayInclude" );
+    debug_relay_excludelist = load_list( hkey, L"RelayExclude" );
+    debug_snoop_includelist = load_list( hkey, L"SnoopInclude" );
+    debug_snoop_excludelist = load_list( hkey, L"SnoopExclude" );
+    debug_from_relay_includelist = load_list( hkey, L"RelayFromInclude" );
+    debug_from_relay_excludelist = load_list( hkey, L"RelayFromExclude" );
+    debug_from_snoop_includelist = load_list( hkey, L"SnoopFromInclude" );
+    debug_from_snoop_excludelist = load_list( hkey, L"SnoopFromExclude" );
 
     NtClose( hkey );
     return TRUE;
@@ -259,7 +248,6 @@ static BOOL check_relay_include( const WCHAR *module, int ordinal, const char *f
  */
 static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludelist, const WCHAR *module )
 {
-    static const WCHAR dllW[] = {'.','d','l','l',0 };
     const WCHAR **listitem;
     BOOL show;
 
@@ -281,7 +269,7 @@ static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludel
 
         if (!wcsicmp( *listitem, module )) return !show;
         len = wcslen( *listitem );
-        if (!wcsnicmp( *listitem, module, len ) && !wcsicmp( module + len, dllW ))
+        if (!wcsnicmp( *listitem, module, len ) && !wcsicmp( module + len, L".dll" ))
             return !show;
     }
     return show;
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 11dbc63a3b3..cf21c980a45 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -1314,8 +1314,6 @@ NTSTATUS WINAPI RtlIpv6StringToAddressA(const char *str, const char **terminator
 NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWSTR buffer, PULONG psize)
 {
     WCHAR tmp_ip[32];
-    static const WCHAR fmt_ip[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
-    static const WCHAR fmt_port[] = {':','%','u',0};
     ULONG needed;
 
     if (!pin || !buffer || !psize)
@@ -1323,11 +1321,11 @@ NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWST
 
     TRACE("(%p:0x%x, %d, %p, %p:%d)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
 
-    needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), fmt_ip,
+    needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), L"%u.%u.%u.%u",
                       pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
                       pin->S_un.S_un_b.s_b3, pin->S_un.S_un_b.s_b4);
 
-    if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, fmt_port, ntohs(port));
+    if (port) needed += swprintf(tmp_ip + needed, ARRAY_SIZE(tmp_ip) - needed, L":%u", ntohs(port));
 
     if (*psize > needed) {
         *psize = needed + 1;
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index d8ff81b8050..90f32ceecf0 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -1160,8 +1160,6 @@ NTSTATUS WINAPI RtlFindCharInUnicodeString(
  */
 BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
 {
-    static const WCHAR std_control_chars[] = {'\r','\n','\t',' ',0x3000,0};
-    static const WCHAR byterev_control_chars[] = {0x0d00,0x0a00,0x0900,0x2000,0};
     const WCHAR *s = buf;
     int i;
     unsigned int flags = ~0U, out_flags = 0;
@@ -1225,7 +1223,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
     {
         for (i = 0; i < len; i++)
         {
-            if (wcschr(std_control_chars, s[i]))
+            if (wcschr(L"\r\n\t \x3000", s[i]))
             {
                 out_flags |= IS_TEXT_UNICODE_CONTROLS;
                 break;
@@ -1237,7 +1235,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
     {
         for (i = 0; i < len; i++)
         {
-            if (wcschr(byterev_control_chars, s[i]))
+            if (wcschr(L"\x0d00\x0a00\x0900\x2000", s[i]))
             {
                 out_flags |= IS_TEXT_UNICODE_REVERSE_CONTROLS;
                 break;
@@ -1684,11 +1682,6 @@ NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING str, GUID* guid)
  */
 NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
 {
-  static const WCHAR szFormat[] = { '{','%','0','8','l','X','-',
-    '%','0','4','X','-',  '%','0','4','X','-','%','0','2','X','%','0','2','X',
-    '-',   '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
-    '%','0','2','X','%','0','2','X','}','\0' };
-
   TRACE("(%p,%p)\n", guid, str);
 
   str->Length = GUID_STRING_LENGTH * sizeof(WCHAR);
@@ -1699,7 +1692,8 @@ NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
     str->Length = str->MaximumLength = 0;
     return STATUS_NO_MEMORY;
   }
-  swprintf(str->Buffer, str->MaximumLength/sizeof(WCHAR), szFormat, guid->Data1, guid->Data2, guid->Data3,
+  swprintf(str->Buffer, str->MaximumLength/sizeof(WCHAR),
+          L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", guid->Data1, guid->Data2, guid->Data3,
           guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
           guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
 
@@ -1739,7 +1733,6 @@ static UINT64 get_arg( int nr, struct format_message_args *args_data, BOOL is64
 static NTSTATUS add_format( WCHAR **buffer, WCHAR *end, const WCHAR **src, int insert, BOOLEAN ansi,
                             struct format_message_args *args_data )
 {
-    static const WCHAR modifiers[] = {'0','1','2','3','4','5','6','7','8','9',' ','+','-','*','#','.',0};
     const WCHAR *format = *src;
     WCHAR *p, fmt[32];
     ULONG_PTR args[5] = { 0 };
@@ -1757,7 +1750,7 @@ static NTSTATUS add_format( WCHAR **buffer, WCHAR *end, const WCHAR **src, int i
         if (!end || end - format > ARRAY_SIZE(fmt) - 2) return STATUS_INVALID_PARAMETER;
         *src = end + 1;
 
-        while (wcschr( modifiers, *format ))
+        while (wcschr( L"0123456789 +-*#.", *format ))
         {
             if (*format == '*') stars++;
             *p++ = *format++;
@@ -1829,7 +1822,6 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
                                     BOOLEAN ansi, BOOLEAN is_array, __ms_va_list *args,
                                     WCHAR *buffer, ULONG size, ULONG *retsize, ULONG flags )
 {
-    static const WCHAR emptyW = 0;
     static const WCHAR spaceW = ' ';
     static const WCHAR crW    = '\r';
     static const WCHAR tabW   = '\t';
@@ -1945,7 +1937,7 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
         }
     }
 
-    if ((status = add_chars( &buffer, end, &emptyW, 1 ))) return status;
+    if ((status = add_chars( &buffer, end, L"", 1 ))) return status;
 
     *retsize = (buffer - start) * sizeof(WCHAR);
     return STATUS_SUCCESS;
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index c0f962f0562..0d45bbf02aa 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -1617,21 +1617,20 @@ NTSTATUS WINAPI RtlConvertSidToUnicodeString(
        PSID pSid,
        BOOLEAN AllocateString)
 {
-    static const WCHAR formatW[] = {'-','%','u',0};
     WCHAR buffer[2 + 10 + 10 + 10 * SID_MAX_SUB_AUTHORITIES];
     WCHAR *p = buffer;
     const SID *sid = pSid;
     DWORD i, len;
 
     *p++ = 'S';
-    p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW, sid->Revision );
-    p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW,
+    p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u", sid->Revision );
+    p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u",
                    MAKELONG( MAKEWORD( sid->IdentifierAuthority.Value[5],
                                        sid->IdentifierAuthority.Value[4] ),
                              MAKEWORD( sid->IdentifierAuthority.Value[3],
                                        sid->IdentifierAuthority.Value[2] )));
     for (i = 0; i < sid->SubAuthorityCount; i++)
-        p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), formatW, sid->SubAuthority[i] );
+        p += swprintf( p, ARRAY_SIZE(buffer) - (p - buffer), L"-%u", sid->SubAuthority[i] );
 
     len = (p + 1 - buffer) * sizeof(WCHAR);
 
-- 
2.26.2




More information about the wine-devel mailing list