From 94208fcee505b9ac61c9ef4b63d45795cb33e484 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Tue, 24 Jan 2023 23:47:44 -0700 Subject: [PATCH] ntdll: Use RTL_CONSTANT_STRING instead of reimplementing it. --- dlls/ntdll/env.c | 7 ++----- dlls/ntdll/unix/registry.c | 2 +- dlls/ntdll/unix/virtual.c | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 6db6cee17cd..ab54a9ec563 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -54,12 +54,9 @@ static inline SIZE_T get_env_length( const WCHAR *env ) */ static void set_wow64_environment( WCHAR **env ) { - 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 }; - UNICODE_STRING arch6432_strW = { sizeof(arch6432W) - sizeof(WCHAR), sizeof(arch6432W), arch6432W }; + UNICODE_STRING arch_strW = RTL_CONSTANT_STRING( L"PROCESSOR_ARCHITECTURE" ); + UNICODE_STRING arch6432_strW = RTL_CONSTANT_STRING( L"PROCESSOR_ARCHITEW6432" ); UNICODE_STRING valW = { 0, sizeof(buf), buf }; UNICODE_STRING nameW; diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c index d183474b53f..a24d6e7c267 100644 --- a/dlls/ntdll/unix/registry.c +++ b/dlls/ntdll/unix/registry.c @@ -826,7 +826,7 @@ NTSTATUS WINAPI NtQueryLicenseValue( const UNICODE_STRING *name, ULONG *type, 'S','o','f','t','w','a','r','e','\\', 'W','i','n','e','\\','L','i','c','e','n','s','e', 'I','n','f','o','r','m','a','t','i','o','n',0}; - UNICODE_STRING keyW = { sizeof(nameW) - sizeof(WCHAR), sizeof(nameW), (WCHAR *)nameW }; + UNICODE_STRING keyW = RTL_CONSTANT_STRING( nameW ); KEY_VALUE_PARTIAL_INFORMATION *info; NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND; DWORD info_length, count; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 0f66429fc9d..f6e8793396c 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3192,7 +3192,7 @@ void virtual_map_user_shared_data(void) { static const WCHAR nameW[] = {'\\','K','e','r','n','e','l','O','b','j','e','c','t','s', '\\','_','_','w','i','n','e','_','u','s','e','r','_','s','h','a','r','e','d','_','d','a','t','a',0}; - UNICODE_STRING name_str = { sizeof(nameW) - sizeof(WCHAR), sizeof(nameW), (WCHAR *)nameW }; + UNICODE_STRING name_str = RTL_CONSTANT_STRING( nameW ); OBJECT_ATTRIBUTES attr = { sizeof(attr), 0, &name_str }; unsigned int status; HANDLE section; -- 2.11.4.GIT