[ADVAPI32]

* Implement and export RegDeleteKeyEx{A,W} (Thanks Alex).

svn path=/trunk/; revision=57069
This commit is contained in:
Amine Khaldi 2012-08-13 16:15:13 +00:00
parent 02f891a26d
commit d73b1daf7f
2 changed files with 113 additions and 8 deletions

View file

@ -479,8 +479,8 @@
@ stdcall RegCreateKeyExW(long wstr long ptr long long ptr ptr ptr) @ stdcall RegCreateKeyExW(long wstr long ptr long long ptr ptr ptr)
@ stdcall RegCreateKeyW(long wstr ptr) @ stdcall RegCreateKeyW(long wstr ptr)
@ stdcall RegDeleteKeyA(long str) @ stdcall RegDeleteKeyA(long str)
;@ stdcall RegDeleteKeyExA(long str long long) @ stdcall RegDeleteKeyExA(long str long long)
;@ stdcall RegDeleteKeyExW(long wstr long long) @ stdcall RegDeleteKeyExW(long wstr long long)
@ stdcall RegDeleteKeyW(long wstr) @ stdcall RegDeleteKeyW(long wstr)
@ stdcall RegDeleteKeyValueA(ptr str str) @ stdcall RegDeleteKeyValueA(ptr str str)
@ stdcall RegDeleteKeyValueW(ptr wstr wstr) @ stdcall RegDeleteKeyValueW(ptr wstr wstr)

View file

@ -1317,7 +1317,7 @@ Cleanup:
/************************************************************************ /************************************************************************
* RegDeleteKeyExA * RegDeleteKeyExA
* *
* @unimplemented * @implemented
*/ */
LONG LONG
WINAPI WINAPI
@ -1326,15 +1326,68 @@ RegDeleteKeyExA(HKEY hKey,
REGSAM samDesired, REGSAM samDesired,
DWORD Reserved) DWORD Reserved)
{ {
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); OBJECT_ATTRIBUTES ObjectAttributes;
return ERROR_CALL_NOT_IMPLEMENTED; 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 * RegDeleteKeyExW
* *
* @unimplemented * @implemented
*/ */
LONG LONG
WINAPI WINAPI
@ -1343,8 +1396,60 @@ RegDeleteKeyExW(HKEY hKey,
REGSAM samDesired, REGSAM samDesired,
DWORD Reserved) DWORD Reserved)
{ {
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); OBJECT_ATTRIBUTES ObjectAttributes;
return ERROR_CALL_NOT_IMPLEMENTED; 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;
} }