mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
implemented RegDeleteKeyValueA/W()
svn path=/trunk/; revision=17527
This commit is contained in:
parent
519f1108ad
commit
bc8811f677
2 changed files with 115 additions and 0 deletions
|
@ -473,6 +473,8 @@ RegCreateKeyExW@36
|
|||
RegCreateKeyW@12
|
||||
RegDeleteKeyA@8
|
||||
RegDeleteKeyW@8
|
||||
RegDeleteKeyValueA@12
|
||||
RegDeleteKeyValueW@12
|
||||
RegDeleteValueA@8
|
||||
RegDeleteValueW@8
|
||||
;RegDisablePredefinedCache
|
||||
|
|
|
@ -689,6 +689,119 @@ RegDeleteKeyW (HKEY hKey,
|
|||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* RegDeleteKeyValueW
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
LONG STDCALL
|
||||
RegDeleteKeyValueW(IN HKEY hKey,
|
||||
IN LPCWSTR lpSubKey OPTIONAL,
|
||||
IN LPCWSTR lpValueName OPTIONAL)
|
||||
{
|
||||
UNICODE_STRING ValueName;
|
||||
HANDLE KeyHandle, SubKeyHandle = NULL;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = MapDefaultKey(&KeyHandle,
|
||||
hKey);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return RtlNtStatusToDosError(Status);
|
||||
}
|
||||
|
||||
if (lpSubKey != NULL)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING SubKeyName;
|
||||
|
||||
RtlInitUnicodeString(&SubKeyName,
|
||||
(LPWSTR)lpSubKey);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&SubKeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
KeyHandle,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenKey(&SubKeyHandle,
|
||||
KEY_SET_VALUE,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return RtlNtStatusToDosError(Status);
|
||||
}
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&ValueName,
|
||||
(LPWSTR)lpValueName);
|
||||
|
||||
Status = NtDeleteValueKey((SubKeyHandle != NULL) ? SubKeyHandle : KeyHandle,
|
||||
&ValueName);
|
||||
|
||||
if (SubKeyHandle != NULL)
|
||||
{
|
||||
NtClose(SubKeyHandle);
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return RtlNtStatusToDosError(Status);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* RegDeleteKeyValueA
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
LONG STDCALL
|
||||
RegDeleteKeyValueA(IN HKEY hKey,
|
||||
IN LPCSTR lpSubKey OPTIONAL,
|
||||
IN LPCSTR lpValueName OPTIONAL)
|
||||
{
|
||||
UNICODE_STRING SubKey, ValueName;
|
||||
LONG Ret;
|
||||
|
||||
if (lpSubKey != NULL)
|
||||
{
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&SubKey,
|
||||
(LPSTR)lpSubKey))
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
}
|
||||
else
|
||||
RtlInitUnicodeString(&SubKey,
|
||||
NULL);
|
||||
|
||||
if (lpValueName != NULL)
|
||||
{
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&ValueName,
|
||||
(LPSTR)lpValueName))
|
||||
{
|
||||
RtlFreeUnicodeString(&SubKey);
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
}
|
||||
else
|
||||
RtlInitUnicodeString(&ValueName,
|
||||
NULL);
|
||||
|
||||
Ret = RegDeleteKeyValueW(hKey,
|
||||
SubKey.Buffer,
|
||||
SubKey.Buffer);
|
||||
|
||||
RtlFreeUnicodeString(&SubKey);
|
||||
RtlFreeUnicodeString(&ValueName);
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* RegDeleteValueA
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue