Implemented 'QueryName' method for key objects.

svn path=/trunk/; revision=4826
This commit is contained in:
Eric Kohl 2003-06-02 16:51:15 +00:00
parent f05c47fa29
commit 642d896c7b
3 changed files with 77 additions and 5 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;
}