Module: wine Branch: master Commit: 1798bcd5406e36dca5cb924f256e61d499e5da3e URL: https://gitlab.winehq.org/wine/wine/-/commit/1798bcd5406e36dca5cb924f256e61d...
Author: Alex Henrie alexhenrie24@gmail.com Date: Tue Feb 14 19:58:28 2023 -0700
wow64: Avoid calling RtlInitUnicodeString on a static constant.
---
dlls/wow64/file.c | 8 ++++---- dlls/wow64/syscall.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/wow64/file.c b/dlls/wow64/file.c index 3254d69d14a..d32ef0b5455 100644 --- a/dlls/wow64/file.c +++ b/dlls/wow64/file.c @@ -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 )) diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index 9323bae296e..8caf06ec013 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -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(), ¤t_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 );