mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
- deleting a registry value requires the KEY_SET_VALUE right
- capture the value name svn path=/trunk/; revision=18851
This commit is contained in:
parent
f4d5030a94
commit
e63b48188e
1 changed files with 24 additions and 6 deletions
|
@ -1616,7 +1616,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("ObReferenceObjectByHandle() failed with status %x\n", Status);
|
||||
DPRINT1("ObReferenceObjectByHandle() failed with status %x %p\n", Status, KeyHandle);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -2038,27 +2038,42 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
|
|||
NTSTATUS Status;
|
||||
REG_DELETE_VALUE_KEY_INFORMATION DeleteValueKeyInfo;
|
||||
REG_POST_OPERATION_INFORMATION PostOperationInfo;
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
UNICODE_STRING CapturedValueName;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
PreviousMode = KeGetPreviousMode();
|
||||
|
||||
/* Verify that the handle is valid and is a registry key */
|
||||
Status = ObReferenceObjectByHandle(KeyHandle,
|
||||
KEY_QUERY_VALUE,
|
||||
KEY_SET_VALUE,
|
||||
CmiKeyType,
|
||||
UserMode,
|
||||
PreviousMode,
|
||||
(PVOID *)&KeyObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
DeleteValueKeyInfo.Object = (PVOID)KeyObject;
|
||||
DeleteValueKeyInfo.ValueName = ValueName;
|
||||
|
||||
Status = ProbeAndCaptureUnicodeString(&CapturedValueName,
|
||||
PreviousMode,
|
||||
ValueName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
goto Fail;
|
||||
}
|
||||
DeleteValueKeyInfo.Object = (PVOID)KeyObject;
|
||||
DeleteValueKeyInfo.ValueName = &CapturedValueName;
|
||||
|
||||
/* FIXME - check if value exists before calling the callbacks? */
|
||||
Status = CmiCallRegisteredCallbacks(RegNtPreDeleteValueKey, &DeleteValueKeyInfo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ReleaseCapturedUnicodeString(&CapturedValueName,
|
||||
PreviousMode);
|
||||
Fail:
|
||||
ObDereferenceObject(KeyObject);
|
||||
return Status;
|
||||
}
|
||||
|
@ -2081,6 +2096,9 @@ NtDeleteValueKey (IN HANDLE KeyHandle,
|
|||
ExReleaseResourceLite(&CmiRegistryLock);
|
||||
KeLeaveCriticalRegion();
|
||||
|
||||
ReleaseCapturedUnicodeString(&CapturedValueName,
|
||||
PreviousMode);
|
||||
|
||||
PostOperationInfo.Object = (PVOID)KeyObject;
|
||||
PostOperationInfo.Status = Status;
|
||||
|
||||
|
|
Loading…
Reference in a new issue