[ADVAPI32]

- Rewrite RegOpenKeyExA as a wrapper around RegOpenKeyExW
CORE-8582

svn path=/trunk/; revision=64414
This commit is contained in:
Jérôme Gardou 2014-09-30 19:59:35 +00:00
parent de0f394751
commit ef18d16459

View file

@ -3452,54 +3452,25 @@ RegOpenKeyW(HKEY hKey,
* @implemented * @implemented
*/ */
LONG WINAPI LONG WINAPI
RegOpenKeyExA(HKEY hKey, RegOpenKeyExA(
LPCSTR lpSubKey, _In_ HKEY hKey,
DWORD ulOptions, _In_ LPCSTR lpSubKey,
REGSAM samDesired, _In_ DWORD ulOptions,
PHKEY phkResult) _In_ REGSAM samDesired,
_Out_ PHKEY phkResult)
{ {
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyString; UNICODE_STRING SubKeyString;
HANDLE KeyHandle; LONG ErrorCode;
NTSTATUS Status;
ULONG Attributes = OBJ_CASE_INSENSITIVE;
LONG ErrorCode = ERROR_SUCCESS;
TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n",
hKey, lpSubKey, ulOptions, samDesired, phkResult); 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, RtlCreateUnicodeStringFromAsciiz(&SubKeyString,
(LPSTR)lpSubKey); (LPSTR)lpSubKey);
InitializeObjectAttributes(&ObjectAttributes,
&SubKeyString,
Attributes,
KeyHandle,
NULL);
Status = NtOpenKey((PHANDLE)phkResult, ErrorCode = RegOpenKeyExW(hKey, SubKeyString.Buffer, ulOptions, samDesired, phkResult);
samDesired,
&ObjectAttributes);
RtlFreeUnicodeString(&SubKeyString); RtlFreeUnicodeString(&SubKeyString);
if (!NT_SUCCESS(Status))
{
ErrorCode = RtlNtStatusToDosError(Status);
}
ClosePredefKey(KeyHandle);
return ErrorCode; return ErrorCode;
} }