diff --git a/reactos/ntoskrnl/cm/cm.h b/reactos/ntoskrnl/cm/cm.h index 5aa10af8c1b..add400d42b1 100644 --- a/reactos/ntoskrnl/cm/cm.h +++ b/reactos/ntoskrnl/cm/cm.h @@ -393,6 +393,12 @@ CmiObjectSecurity(PVOID ObjectBody, PSECURITY_DESCRIPTOR SecurityDescriptor, PULONG BufferLength); +NTSTATUS STDCALL +CmiObjectQueryName (PVOID ObjectBody, + POBJECT_NAME_INFORMATION ObjectNameInfo, + ULONG Length, + PULONG ReturnLength); + NTSTATUS CmiImportHiveBins(PREGISTRY_HIVE Hive, PUCHAR ChunkPtr); diff --git a/reactos/ntoskrnl/cm/registry.c b/reactos/ntoskrnl/cm/registry.c index d0f8e00ab7a..ccb06c8f980 100644 --- a/reactos/ntoskrnl/cm/registry.c +++ b/reactos/ntoskrnl/cm/registry.c @@ -1,4 +1,4 @@ -/* $Id: registry.c,v 1.101 2003/06/01 17:39:14 ekohl Exp $ +/* $Id: registry.c,v 1.102 2003/06/02 16:51:15 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -272,7 +272,7 @@ CmInitializeRegistry(VOID) CmiKeyType->Delete = CmiObjectDelete; CmiKeyType->Parse = CmiObjectParse; CmiKeyType->Security = CmiObjectSecurity; - CmiKeyType->QueryName = NULL; + CmiKeyType->QueryName = CmiObjectQueryName; CmiKeyType->OkayToClose = NULL; CmiKeyType->Create = CmiObjectCreate; CmiKeyType->DuplicationNotify = NULL; @@ -305,6 +305,7 @@ CmInitializeRegistry(VOID) RootKey->RegistryHive = CmiVolatileHive; RootKey->BlockOffset = CmiVolatileHive->HiveHeader->RootKeyCell; RootKey->KeyCell = CmiGetBlock(CmiVolatileHive, RootKey->BlockOffset, NULL); + RootKey->ParentKey = NULL; RootKey->Flags = 0; RootKey->NumberOfSubKeys = 0; RootKey->SubKeys = NULL; @@ -558,7 +559,6 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes, return Status; } - NewKey->ParentKey = ParentKey; NewKey->RegistryHive = RegistryHive; NewKey->BlockOffset = RegistryHive->HiveHeader->RootKeyCell; NewKey->KeyCell = CmiGetBlock(RegistryHive, NewKey->BlockOffset, NULL); @@ -656,6 +656,7 @@ CmiDisconnectHive (IN POBJECT_ATTRIBUTES KeyObjectAttributes, } Hive = KeyObject->RegistryHive; + CmiRemoveKeyFromList (KeyObject); /* Dereference KeyObject twice to delete it */ ObDereferenceObject (KeyObject); diff --git a/reactos/ntoskrnl/cm/regobj.c b/reactos/ntoskrnl/cm/regobj.c index 8d61e98cbfc..afbd4a5c69a 100644 --- a/reactos/ntoskrnl/cm/regobj.c +++ b/reactos/ntoskrnl/cm/regobj.c @@ -301,9 +301,74 @@ CmiObjectSecurity(PVOID ObjectBody, PSECURITY_DESCRIPTOR SecurityDescriptor, PULONG BufferLength) { - DPRINT1("CmiObjectSecurity() called\n"); + DPRINT1 ("CmiObjectSecurity() called\n"); - return(STATUS_SUCCESS); + return STATUS_SUCCESS; +} + + +NTSTATUS STDCALL +CmiObjectQueryName (PVOID ObjectBody, + POBJECT_NAME_INFORMATION ObjectNameInfo, + ULONG Length, + PULONG ReturnLength) +{ + POBJECT_NAME_INFORMATION LocalInfo; + PKEY_OBJECT KeyObject; + ULONG LocalReturnLength; + NTSTATUS Status; + + DPRINT ("CmiObjectQueryName() called\n"); + + KeyObject = (PKEY_OBJECT)ObjectBody; + + LocalInfo = ExAllocatePool (NonPagedPool, + sizeof(OBJECT_NAME_INFORMATION) + + MAX_PATH * sizeof(WCHAR)); + if (LocalInfo == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + if (KeyObject->ParentKey != NULL) + { + Status = ObQueryNameString (KeyObject->ParentKey, + LocalInfo, + MAX_PATH * sizeof(WCHAR), + &LocalReturnLength); + } + else + { + Status = ObQueryNameString (BODY_TO_HEADER(KeyObject)->Parent, + LocalInfo, + MAX_PATH * sizeof(WCHAR), + &LocalReturnLength); + } + + if (!NT_SUCCESS (Status)) + { + ExFreePool (LocalInfo); + return Status; + } + DPRINT ("Parent path: %wZ\n", &LocalInfo->Name); + + Status = RtlAppendUnicodeStringToString (&ObjectNameInfo->Name, + &LocalInfo->Name); + ExFreePool (LocalInfo); + if (!NT_SUCCESS (Status)) + return Status; + + Status = RtlAppendUnicodeToString (&ObjectNameInfo->Name, + L"\\"); + if (!NT_SUCCESS (Status)) + return Status; + + Status = RtlAppendUnicodeStringToString (&ObjectNameInfo->Name, + &KeyObject->Name); + if (NT_SUCCESS (Status)) + { + DPRINT ("Total path: %wZ\n", &ObjectNameInfo->Name); + } + + return Status; }