Author: ekohl
Date: Thu Nov 29 22:02:22 2012
New Revision: 57784
URL:
http://svn.reactos.org/svn/reactos?rev=57784&view=rev
Log:
[LSASRV]
- 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.
Modified:
trunk/reactos/dll/win32/lsasrv/database.c
trunk/reactos/dll/win32/lsasrv/lsarpc.c
trunk/reactos/dll/win32/lsasrv/lsasrv.h
trunk/reactos/dll/win32/lsasrv/registry.c
Modified: trunk/reactos/dll/win32/lsasrv/database.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/database.…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] Thu Nov 29 22:02:22 2012
@@ -796,7 +796,6 @@
NewObject = RtlAllocateHeap(RtlGetProcessHeap(),
0,
-// sizeof(LSA_DB_OBJECT) + wcslen(ObjectName) +
sizeof(WCHAR));
sizeof(LSA_DB_OBJECT));
if (NewObject == NULL)
{
@@ -810,7 +809,6 @@
NewObject->Access = DesiredAccess;
NewObject->KeyHandle = ObjectKeyHandle;
NewObject->ParentObject = ParentObject;
-// wcscpy(NewObject->Name, ObjectName);
if (ParentObject != NULL)
ParentObject->RefCount++;
@@ -901,10 +899,8 @@
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 @@
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);
Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Thu Nov 29 22:02:22 2012
@@ -97,8 +97,7 @@
NTSTATUS WINAPI LsarDelete(
LSAPR_HANDLE ObjectHandle)
{
- /* Deprecated */
- return STATUS_NOT_SUPPORTED;
+ return LsarDeleteObject(&ObjectHandle);
}
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Thu Nov 29 22:02:22 2012
@@ -48,7 +48,6 @@
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 @@
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,
Modified: trunk/reactos/dll/win32/lsasrv/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/registry.…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/registry.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/registry.c [iso-8859-1] Thu Nov 29 22:02:22 2012
@@ -60,8 +60,8 @@
NTSTATUS
-LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
- IN LPCWSTR KeyName)
+LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
+ IN LPCWSTR KeyName)
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING SubKeyName;
@@ -86,6 +86,13 @@
NtClose(TargetKey);
return Status;
+}
+
+
+NTSTATUS
+LsapRegDeleteKey(IN HANDLE KeyHandle)
+{
+ return NtDeleteKey(KeyHandle);
}