From 98337141d9fc9ab6fee9712c90349833559fbeee Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 30 Sep 2014 20:00:35 +0000 Subject: [PATCH] [ADVAPI32] - Reimplement RegDeleteKeyA as a wrapper around RegDeleteKeyW CORE-8582 svn path=/trunk/; revision=64419 --- reactos/dll/win32/advapi32/reg/reg.c | 47 +++------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/reactos/dll/win32/advapi32/reg/reg.c b/reactos/dll/win32/advapi32/reg/reg.c index 92f8d315d70..b390f9c8be4 100644 --- a/reactos/dll/win32/advapi32/reg/reg.c +++ b/reactos/dll/win32/advapi32/reg/reg.c @@ -1182,55 +1182,16 @@ LONG WINAPI RegDeleteKeyA(HKEY hKey, LPCSTR lpSubKey) { - OBJECT_ATTRIBUTES ObjectAttributes; + LONG ErrorCode; UNICODE_STRING SubKeyName; - HANDLE ParentKey; - HANDLE TargetKey; - NTSTATUS Status; - /* Make sure we got a subkey */ - if (!lpSubKey) - { - /* Fail */ - return ERROR_INVALID_PARAMETER; - } + RtlCreateUnicodeStringFromAsciiz(&SubKeyName, (LPSTR)lpSubKey); - Status = MapDefaultKey(&ParentKey, - hKey); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } + ErrorCode = RegDeleteKeyW(hKey, SubKeyName.Buffer); - RtlCreateUnicodeStringFromAsciiz(&SubKeyName, - (LPSTR)lpSubKey); - InitializeObjectAttributes(&ObjectAttributes, - &SubKeyName, - OBJ_CASE_INSENSITIVE, - ParentKey, - NULL); - - Status = NtOpenKey(&TargetKey, - DELETE, - &ObjectAttributes); RtlFreeUnicodeString(&SubKeyName); - if (!NT_SUCCESS(Status)) - { - goto Cleanup; - } - - Status = NtDeleteKey(TargetKey); - NtClose (TargetKey); - -Cleanup: - ClosePredefKey(ParentKey); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - return ERROR_SUCCESS; + return ErrorCode; } -- 2.17.1