From: Jérôme Gardou Date: Tue, 30 Sep 2014 19:59:35 +0000 (+0000) Subject: [ADVAPI32] X-Git-Tag: backups/0.3.17@66124~334 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=ef18d164591c5b1ef2789dc1334d079fd1e71966;hp=de0f3947516395387df363643939385a50b03090 [ADVAPI32] - Rewrite RegOpenKeyExA as a wrapper around RegOpenKeyExW CORE-8582 svn path=/trunk/; revision=64414 --- diff --git a/reactos/dll/win32/advapi32/reg/reg.c b/reactos/dll/win32/advapi32/reg/reg.c index bd9ae62c9f0..4606653b528 100644 --- a/reactos/dll/win32/advapi32/reg/reg.c +++ b/reactos/dll/win32/advapi32/reg/reg.c @@ -3452,54 +3452,25 @@ RegOpenKeyW(HKEY hKey, * @implemented */ LONG WINAPI -RegOpenKeyExA(HKEY hKey, - LPCSTR lpSubKey, - DWORD ulOptions, - REGSAM samDesired, - PHKEY phkResult) +RegOpenKeyExA( + _In_ HKEY hKey, + _In_ LPCSTR lpSubKey, + _In_ DWORD ulOptions, + _In_ REGSAM samDesired, + _Out_ PHKEY phkResult) { - OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING SubKeyString; - HANDLE KeyHandle; - NTSTATUS Status; - ULONG Attributes = OBJ_CASE_INSENSITIVE; - LONG ErrorCode = ERROR_SUCCESS; + LONG ErrorCode; TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", hKey, lpSubKey, ulOptions, samDesired, phkResult); - if (!phkResult) - { - return ERROR_INVALID_PARAMETER; - } - - Status = MapDefaultKey(&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - if (ulOptions & REG_OPTION_OPEN_LINK) - Attributes |= OBJ_OPENLINK; RtlCreateUnicodeStringFromAsciiz(&SubKeyString, (LPSTR)lpSubKey); - InitializeObjectAttributes(&ObjectAttributes, - &SubKeyString, - Attributes, - KeyHandle, - NULL); - Status = NtOpenKey((PHANDLE)phkResult, - samDesired, - &ObjectAttributes); - RtlFreeUnicodeString(&SubKeyString); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError(Status); - } + ErrorCode = RegOpenKeyExW(hKey, SubKeyString.Buffer, ulOptions, samDesired, phkResult); - ClosePredefKey(KeyHandle); + RtlFreeUnicodeString(&SubKeyString); return ErrorCode; }