- Fix object deletion.
- Add a registry wrapper function that enables us to delete registry keys which have already been opened.
- Make LsarDelete call LsarDeleteObject because otherwise object deletion would not be possible.

svn path=/trunk/; revision=57784
This commit is contained in:
Eric Kohl 2012-11-29 22:02:22 +00:00
parent 24abb04676
commit 9b5490c235
4 changed files with 27 additions and 27 deletions

View file

@ -796,7 +796,6 @@ LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject,
NewObject = RtlAllocateHeap(RtlGetProcessHeap(),
0,
// sizeof(LSA_DB_OBJECT) + wcslen(ObjectName) + sizeof(WCHAR));
sizeof(LSA_DB_OBJECT));
if (NewObject == NULL)
{
@ -810,7 +809,6 @@ LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject,
NewObject->Access = DesiredAccess;
NewObject->KeyHandle = ObjectKeyHandle;
NewObject->ParentObject = ParentObject;
// wcscpy(NewObject->Name, ObjectName);
if (ParentObject != NULL)
ParentObject->RefCount++;
@ -901,10 +899,8 @@ NTSTATUS
LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject)
{
PLSA_DB_OBJECT ParentObject = NULL;
#if 0
WCHAR KeyName[64];
ULONG EnumIndex;
#endif
ULONG Index;
NTSTATUS Status = STATUS_SUCCESS;
DbObject->RefCount--;
@ -914,40 +910,36 @@ LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject)
if (DbObject->KeyHandle != NULL)
{
#if 0
EnumIndex = 0;
Index = 0;
while (TRUE)
{
Status = LsapRegEnumerateSubKey(DbObject->KeyHandle,
EnumIndex,
Index,
64 * sizeof(WCHAR),
KeyName);
if (!NT_SUCCESS(Status))
break;
TRACE("EnumIndex: %lu\n", EnumIndex);
TRACE("Index: %lu\n", Index);
TRACE("Key name: %S\n", KeyName);
Status = LsapRegDeleteKey(DbObject->KeyHandle,
KeyName);
Status = LsapRegDeleteSubKey(DbObject->KeyHandle,
KeyName);
if (!NT_SUCCESS(Status))
break;
// EnumIndex++;
}
#endif
if (Status == STATUS_NO_MORE_ENTRIES)
Status = STATUS_SUCCESS;
LsapRegDeleteKey(DbObject->KeyHandle);
NtClose(DbObject->KeyHandle);
}
if (DbObject->ParentObject != NULL)
{
ParentObject = DbObject->ParentObject;
#if 0
LsapRegDeleteKey(ParentObject->KeyHandle,
DbObject->Name);
#endif
}
RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject);

View file

@ -97,8 +97,7 @@ NTSTATUS WINAPI LsarClose(
NTSTATUS WINAPI LsarDelete(
LSAPR_HANDLE ObjectHandle)
{
/* Deprecated */
return STATUS_NOT_SUPPORTED;
return LsarDeleteObject(&ObjectHandle);
}

View file

@ -48,7 +48,6 @@ typedef struct _LSA_DB_OBJECT
ACCESS_MASK Access;
HANDLE KeyHandle;
struct _LSA_DB_OBJECT *ParentObject;
WCHAR Name[0];
} LSA_DB_OBJECT, *PLSA_DB_OBJECT;
#define LSAP_DB_SIGNATURE 0x12345678
@ -282,8 +281,11 @@ LsapRegCreateKey(IN HANDLE ParentKeyHandle,
OUT HANDLE KeyHandle);
NTSTATUS
LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
IN LPCWSTR KeyName);
LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
IN LPCWSTR KeyName);
NTSTATUS
LsapRegDeleteKey(IN HANDLE KeyHandle);
NTSTATUS
LsapRegEnumerateSubKey(IN HANDLE KeyHandle,

View file

@ -60,8 +60,8 @@ LsapRegCreateKey(IN HANDLE ParentKeyHandle,
NTSTATUS
LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
IN LPCWSTR KeyName)
LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
IN LPCWSTR KeyName)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyName;
@ -89,6 +89,13 @@ LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
}
NTSTATUS
LsapRegDeleteKey(IN HANDLE KeyHandle)
{
return NtDeleteKey(KeyHandle);
}
NTSTATUS
LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
IN ULONG Index,