mirror of
https://github.com/reactos/reactos.git
synced 2025-05-22 18:45:00 +00:00
[ADVAPI32]
- Reimplement RegDeleteKeyA as a wrapper around RegDeleteKeyW CORE-8582 svn path=/trunk/; revision=64419
This commit is contained in:
parent
0bcdd836f1
commit
98337141d9
1 changed files with 4 additions and 43 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue