From: Alex Henrie alexhenrie24@gmail.com
--- dlls/ntdll/loader.c | 33 +++++++++++++++------------------ dlls/ntdll/relay.c | 3 +-- 2 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 61aeb25898b..0e4387f8594 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2189,10 +2189,9 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name, */ static void build_ntdll_module( HMODULE module ) { - UNICODE_STRING nt_name; + UNICODE_STRING nt_name = RTL_CONSTANT_STRING( L"\??\C:\windows\system32\ntdll.dll" ); WINE_MODREF *wm;
- RtlInitUnicodeString( &nt_name, L"\??\C:\windows\system32\ntdll.dll" ); wm = alloc_module( module, &nt_name, TRUE ); assert( wm ); wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS; @@ -2364,7 +2363,7 @@ 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 ) { const WCHAR *mod_end = module; - UNICODE_STRING name, value; + UNICODE_STRING name = RTL_CONSTANT_STRING( L"PATH" ), value; WCHAR *p, *ret; int len = ARRAY_SIZE(system_path) + 1, path_len = 0;
@@ -2374,7 +2373,6 @@ static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_m len += (mod_end - module) + 1; }
- RtlInitUnicodeString( &name, L"PATH" ); value.Length = 0; value.MaximumLength = 0; value.Buffer = NULL; @@ -3945,20 +3943,22 @@ static void process_breakpoint(void) static void load_global_options(void) { OBJECT_ATTRIBUTES attr; - UNICODE_STRING name_str, val_str; + UNICODE_STRING bootstrap_mode_str = RTL_CONSTANT_STRING( L"WINEBOOTSTRAPMODE" ); + UNICODE_STRING session_manager_str = + RTL_CONSTANT_STRING( L"\Registry\Machine\System\CurrentControlSet\Control\Session Manager" ); + UNICODE_STRING val_str; HANDLE hkey;
- RtlInitUnicodeString( &name_str, L"WINEBOOTSTRAPMODE" ); val_str.MaximumLength = 0; - is_prefix_bootstrap = RtlQueryEnvironmentVariable_U( NULL, &name_str, &val_str ) != STATUS_VARIABLE_NOT_FOUND; + is_prefix_bootstrap = + RtlQueryEnvironmentVariable_U( NULL, &bootstrap_mode_str, &val_str ) != STATUS_VARIABLE_NOT_FOUND;
attr.Length = sizeof(attr); attr.RootDirectory = 0; - attr.ObjectName = &name_str; + attr.ObjectName = &session_manager_str; attr.Attributes = OBJ_CASE_INSENSITIVE; attr.SecurityDescriptor = NULL; attr.SecurityQualityOfService = NULL; - RtlInitUnicodeString( &name_str, L"\Registry\Machine\System\CurrentControlSet\Control\Session Manager" );
if (!NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr )) { @@ -4013,12 +4013,11 @@ static void map_wow64cpu(void) { SIZE_T size = 0; OBJECT_ATTRIBUTES attr; - UNICODE_STRING string; + UNICODE_STRING string = RTL_CONSTANT_STRING( L"\??\C:\windows\sysnative\wow64cpu.dll" ); HANDLE file, section; IO_STATUS_BLOCK io; NTSTATUS status;
- RtlInitUnicodeString( &string, L"\??\C:\windows\sysnative\wow64cpu.dll" ); InitializeObjectAttributes( &attr, &string, 0, NULL, NULL ); if ((status = NtOpenFile( &file, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE ))) @@ -4108,7 +4107,8 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR if (!imports_fixup_done) { MEMORY_BASIC_INFORMATION meminfo; - ANSI_STRING func_name; + ANSI_STRING base_thread_init_thunk = RTL_CONSTANT_STRING( "BaseThreadInitThunk" ); + ANSI_STRING ctrl_routine = RTL_CONSTANT_STRING( "CtrlRoutine" ); WINE_MODREF *kernel32; PEB *peb = NtCurrentTeb()->Peb;
@@ -4148,15 +4148,13 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR NtTerminateProcess( GetCurrentProcess(), status ); } node_kernel32 = kernel32->ldr.DdagNode; - RtlInitAnsiString( &func_name, "BaseThreadInitThunk" ); - if ((status = LdrGetProcedureAddress( kernel32->ldr.DllBase, &func_name, + if ((status = LdrGetProcedureAddress( kernel32->ldr.DllBase, &base_thread_init_thunk, 0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS) { MESSAGE( "wine: could not find BaseThreadInitThunk in kernel32.dll, status %lx\n", status ); NtTerminateProcess( GetCurrentProcess(), status ); } - RtlInitAnsiString( &func_name, "CtrlRoutine" ); - LdrGetProcedureAddress( kernel32->ldr.DllBase, &func_name, 0, (void **)&pCtrlRoutine ); + LdrGetProcedureAddress( kernel32->ldr.DllBase, &ctrl_routine, 0, (void **)&pCtrlRoutine );
actctx_init(); locale_init(); @@ -4526,9 +4524,8 @@ NTSTATUS WINAPI RtlGetExePath( PCWSTR name, PWSTR *path ) /* same check as NeedCurrentDirectoryForExePathW */ if (!wcschr( name, '\' )) { - UNICODE_STRING name, value = { 0 }; + UNICODE_STRING name = RTL_CONSTANT_STRING( L"NoDefaultCurrentDirectoryInExePath" ), value = { 0 };
- RtlInitUnicodeString( &name, L"NoDefaultCurrentDirectoryInExePath" ); if (RtlQueryEnvironmentVariable_U( NULL, &name, &value ) != STATUS_VARIABLE_NOT_FOUND) dlldir = L""; } diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c index 7dbff3c0727..afa4085fb33 100644 --- a/dlls/ntdll/relay.c +++ b/dlls/ntdll/relay.c @@ -165,7 +165,7 @@ static const WCHAR **load_list( HKEY hkey, const WCHAR *value ) static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **context ) { OBJECT_ATTRIBUTES attr; - UNICODE_STRING name; + UNICODE_STRING name = RTL_CONSTANT_STRING( L"Software\Wine\Debug" ); HANDLE root, hkey;
RtlOpenCurrentUser( KEY_ALL_ACCESS, &root ); @@ -175,7 +175,6 @@ 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, L"Software\Wine\Debug" );
/* @@ Wine registry key: HKCU\Software\Wine\Debug */ if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) hkey = 0;