mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
[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. svn path=/trunk/; revision=57784
This commit is contained in:
parent
24abb04676
commit
9b5490c235
4 changed files with 27 additions and 27 deletions
|
@ -796,7 +796,6 @@ LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject,
|
||||||
|
|
||||||
NewObject = RtlAllocateHeap(RtlGetProcessHeap(),
|
NewObject = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
// sizeof(LSA_DB_OBJECT) + wcslen(ObjectName) + sizeof(WCHAR));
|
|
||||||
sizeof(LSA_DB_OBJECT));
|
sizeof(LSA_DB_OBJECT));
|
||||||
if (NewObject == NULL)
|
if (NewObject == NULL)
|
||||||
{
|
{
|
||||||
|
@ -810,7 +809,6 @@ LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject,
|
||||||
NewObject->Access = DesiredAccess;
|
NewObject->Access = DesiredAccess;
|
||||||
NewObject->KeyHandle = ObjectKeyHandle;
|
NewObject->KeyHandle = ObjectKeyHandle;
|
||||||
NewObject->ParentObject = ParentObject;
|
NewObject->ParentObject = ParentObject;
|
||||||
// wcscpy(NewObject->Name, ObjectName);
|
|
||||||
|
|
||||||
if (ParentObject != NULL)
|
if (ParentObject != NULL)
|
||||||
ParentObject->RefCount++;
|
ParentObject->RefCount++;
|
||||||
|
@ -901,10 +899,8 @@ NTSTATUS
|
||||||
LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject)
|
LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject)
|
||||||
{
|
{
|
||||||
PLSA_DB_OBJECT ParentObject = NULL;
|
PLSA_DB_OBJECT ParentObject = NULL;
|
||||||
#if 0
|
|
||||||
WCHAR KeyName[64];
|
WCHAR KeyName[64];
|
||||||
ULONG EnumIndex;
|
ULONG Index;
|
||||||
#endif
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
DbObject->RefCount--;
|
DbObject->RefCount--;
|
||||||
|
@ -914,40 +910,36 @@ LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject)
|
||||||
|
|
||||||
if (DbObject->KeyHandle != NULL)
|
if (DbObject->KeyHandle != NULL)
|
||||||
{
|
{
|
||||||
#if 0
|
Index = 0;
|
||||||
EnumIndex = 0;
|
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
Status = LsapRegEnumerateSubKey(DbObject->KeyHandle,
|
Status = LsapRegEnumerateSubKey(DbObject->KeyHandle,
|
||||||
EnumIndex,
|
Index,
|
||||||
64 * sizeof(WCHAR),
|
64 * sizeof(WCHAR),
|
||||||
KeyName);
|
KeyName);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
TRACE("EnumIndex: %lu\n", EnumIndex);
|
TRACE("Index: %lu\n", Index);
|
||||||
TRACE("Key name: %S\n", KeyName);
|
TRACE("Key name: %S\n", KeyName);
|
||||||
|
|
||||||
Status = LsapRegDeleteKey(DbObject->KeyHandle,
|
Status = LsapRegDeleteSubKey(DbObject->KeyHandle,
|
||||||
KeyName);
|
KeyName);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// EnumIndex++;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
if (Status == STATUS_NO_MORE_ENTRIES)
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
LsapRegDeleteKey(DbObject->KeyHandle);
|
||||||
|
|
||||||
NtClose(DbObject->KeyHandle);
|
NtClose(DbObject->KeyHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DbObject->ParentObject != NULL)
|
if (DbObject->ParentObject != NULL)
|
||||||
{
|
|
||||||
ParentObject = DbObject->ParentObject;
|
ParentObject = DbObject->ParentObject;
|
||||||
#if 0
|
|
||||||
LsapRegDeleteKey(ParentObject->KeyHandle,
|
|
||||||
DbObject->Name);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject);
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,7 @@ NTSTATUS WINAPI LsarClose(
|
||||||
NTSTATUS WINAPI LsarDelete(
|
NTSTATUS WINAPI LsarDelete(
|
||||||
LSAPR_HANDLE ObjectHandle)
|
LSAPR_HANDLE ObjectHandle)
|
||||||
{
|
{
|
||||||
/* Deprecated */
|
return LsarDeleteObject(&ObjectHandle);
|
||||||
return STATUS_NOT_SUPPORTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ typedef struct _LSA_DB_OBJECT
|
||||||
ACCESS_MASK Access;
|
ACCESS_MASK Access;
|
||||||
HANDLE KeyHandle;
|
HANDLE KeyHandle;
|
||||||
struct _LSA_DB_OBJECT *ParentObject;
|
struct _LSA_DB_OBJECT *ParentObject;
|
||||||
WCHAR Name[0];
|
|
||||||
} LSA_DB_OBJECT, *PLSA_DB_OBJECT;
|
} LSA_DB_OBJECT, *PLSA_DB_OBJECT;
|
||||||
|
|
||||||
#define LSAP_DB_SIGNATURE 0x12345678
|
#define LSAP_DB_SIGNATURE 0x12345678
|
||||||
|
@ -282,9 +281,12 @@ LsapRegCreateKey(IN HANDLE ParentKeyHandle,
|
||||||
OUT HANDLE KeyHandle);
|
OUT HANDLE KeyHandle);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
|
LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
|
||||||
IN LPCWSTR KeyName);
|
IN LPCWSTR KeyName);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
LsapRegDeleteKey(IN HANDLE KeyHandle);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
|
LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
|
||||||
IN ULONG Index,
|
IN ULONG Index,
|
||||||
|
|
|
@ -60,7 +60,7 @@ LsapRegCreateKey(IN HANDLE ParentKeyHandle,
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
|
LsapRegDeleteSubKey(IN HANDLE ParentKeyHandle,
|
||||||
IN LPCWSTR KeyName)
|
IN LPCWSTR KeyName)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
@ -89,6 +89,13 @@ LsapRegDeleteKey(IN HANDLE ParentKeyHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
LsapRegDeleteKey(IN HANDLE KeyHandle)
|
||||||
|
{
|
||||||
|
return NtDeleteKey(KeyHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
|
LsapRegEnumerateSubKey(IN HANDLE KeyHandle,
|
||||||
IN ULONG Index,
|
IN ULONG Index,
|
||||||
|
|
Loading…
Reference in a new issue