Author: akhaldi
Date: Mon Aug 13 16:15:13 2012
New Revision: 57069
URL:
http://svn.reactos.org/svn/reactos?rev=57069&view=rev
Log:
[ADVAPI32]
* Implement and export RegDeleteKeyEx{A,W} (Thanks Alex).
Modified:
trunk/reactos/dll/win32/advapi32/advapi32.spec
trunk/reactos/dll/win32/advapi32/reg/reg.c
Modified: trunk/reactos/dll/win32/advapi32/advapi32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/advapi3…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] Mon Aug 13 16:15:13 2012
@@ -479,8 +479,8 @@
@ stdcall RegCreateKeyExW(long wstr long ptr long long ptr ptr ptr)
@ stdcall RegCreateKeyW(long wstr ptr)
@ stdcall RegDeleteKeyA(long str)
-;@ stdcall RegDeleteKeyExA(long str long long)
-;@ stdcall RegDeleteKeyExW(long wstr long long)
+@ stdcall RegDeleteKeyExA(long str long long)
+@ stdcall RegDeleteKeyExW(long wstr long long)
@ stdcall RegDeleteKeyW(long wstr)
@ stdcall RegDeleteKeyValueA(ptr str str)
@ stdcall RegDeleteKeyValueW(ptr wstr wstr)
Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Mon Aug 13 16:15:13 2012
@@ -1317,7 +1317,7 @@
/************************************************************************
* RegDeleteKeyExA
*
- * @unimplemented
+ * @implemented
*/
LONG
WINAPI
@@ -1326,15 +1326,68 @@
REGSAM samDesired,
DWORD Reserved)
{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return ERROR_CALL_NOT_IMPLEMENTED;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING SubKeyName;
+ HANDLE ParentKey;
+ HANDLE TargetKey;
+ NTSTATUS Status;
+
+ /* Make sure we got a subkey */
+ if (!lpSubKey)
+ {
+ /* Fail */
+ return ERROR_INVALID_PARAMETER;
+ }
+
+ Status = MapDefaultKey(&ParentKey,
+ hKey);
+ if (!NT_SUCCESS(Status))
+ {
+ return RtlNtStatusToDosError(Status);
+ }
+
+ if (samDesired & KEY_WOW64_32KEY)
+ ERR("Wow64 not yet supported!\n");
+
+ if (samDesired & KEY_WOW64_64KEY)
+ ERR("Wow64 not yet supported!\n");
+
+ 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;
}
/************************************************************************
* RegDeleteKeyExW
*
- * @unimplemented
+ * @implemented
*/
LONG
WINAPI
@@ -1343,8 +1396,60 @@
REGSAM samDesired,
DWORD Reserved)
{
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return ERROR_CALL_NOT_IMPLEMENTED;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING SubKeyName;
+ HANDLE ParentKey;
+ HANDLE TargetKey;
+ NTSTATUS Status;
+
+ /* Make sure we got a subkey */
+ if (!lpSubKey)
+ {
+ /* Fail */
+ return ERROR_INVALID_PARAMETER;
+ }
+
+ Status = MapDefaultKey(&ParentKey,
+ hKey);
+ if (!NT_SUCCESS(Status))
+ {
+ return RtlNtStatusToDosError(Status);
+ }
+
+ if (samDesired & KEY_WOW64_32KEY)
+ ERR("Wow64 not yet supported!\n");
+
+ if (samDesired & KEY_WOW64_64KEY)
+ ERR("Wow64 not yet supported!\n");
+
+
+ RtlInitUnicodeString(&SubKeyName,
+ (LPWSTR)lpSubKey);
+ InitializeObjectAttributes(&ObjectAttributes,
+ &SubKeyName,
+ OBJ_CASE_INSENSITIVE,
+ ParentKey,
+ NULL);
+ Status = NtOpenKey(&TargetKey,
+ DELETE,
+ &ObjectAttributes);
+ if (!NT_SUCCESS(Status))
+ {
+ goto Cleanup;
+ }
+
+ Status = NtDeleteKey(TargetKey);
+ NtClose(TargetKey);
+
+Cleanup:
+ ClosePredefKey(ParentKey);
+
+ if (!NT_SUCCESS(Status))
+ {
+ return RtlNtStatusToDosError(Status);
+ }
+
+ return ERROR_SUCCESS;
}