wow64: Avoid calling RtlInitUnicodeString on a static constant.

This commit is contained in:
Alex Henrie 2023-02-14 19:58:28 -07:00 committed by Alexandre Julliard
parent 956005d338
commit 1798bcd540
2 changed files with 5 additions and 6 deletions

View file

@ -59,12 +59,12 @@ static inline ULONG starts_with_path( const WCHAR *name, ULONG name_len, const W
void init_file_redirects(void)
{
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
UNICODE_STRING windows = RTL_CONSTANT_STRING( L"\\??\\C:\\windows" );
UNICODE_STRING system32 = RTL_CONSTANT_STRING( L"\\??\\C:\\windows\\system32" );
IO_STATUS_BLOCK io;
HANDLE handle;
InitializeObjectAttributes( &attr, &nameW, OBJ_CASE_INSENSITIVE, 0, NULL );
RtlInitUnicodeString( &nameW, L"\\??\\C:\\windows" );
InitializeObjectAttributes( &attr, &windows, OBJ_CASE_INSENSITIVE, 0, NULL );
if (!NtOpenFile( &handle, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io,
FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT |
FILE_OPEN_FOR_BACKUP_INTENT | FILE_DIRECTORY_FILE ))
@ -72,7 +72,7 @@ void init_file_redirects(void)
get_file_id( handle, &windir_id );
NtClose( handle );
}
RtlInitUnicodeString( &nameW, L"\\??\\C:\\windows\\system32" );
attr.ObjectName = &system32;
if (!NtOpenFile( &handle, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io,
FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT |
FILE_OPEN_FOR_BACKUP_INTENT | FILE_DIRECTORY_FILE ))

View file

@ -696,7 +696,7 @@ static const WCHAR *get_cpu_dll_name(void)
static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **context )
{
HMODULE module;
UNICODE_STRING str;
UNICODE_STRING str = RTL_CONSTANT_STRING( L"ntdll.dll" );
SYSTEM_BASIC_INFORMATION info;
RtlWow64GetProcessMachines( GetCurrentProcess(), &current_machine, &native_machine );
@ -708,7 +708,6 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex
#define GET_PTR(name) p ## name = RtlFindExportedRoutineByName( module, #name )
RtlInitUnicodeString( &str, L"ntdll.dll" );
LdrGetDllHandle( NULL, 0, &str, &module );
GET_PTR( LdrSystemDllInitBlock );