RtlpCreateUnicodeString(&FoundObject->Name,
KeyName.Buffer, NonPagedPool);
CmiAddKeyToList(ParsedKey, FoundObject);
- DPRINT("Created object 0x%x\n", FoundObject);
+ DPRINT("Created object 0x%p\n", FoundObject);
}
else
{
static NTSTATUS
CmiQuerySecurityDescriptor(PKEY_OBJECT KeyObject,
SECURITY_INFORMATION SecurityInformation,
- PSECURITY_DESCRIPTOR SecurityDescriptor,
+ PISECURITY_DESCRIPTOR SecurityDescriptor,
PULONG BufferLength)
{
ULONG_PTR Current;
SECURITY_OPERATION_CODE OperationCode,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR SecurityDescriptor,
- PULONG BufferLength)
+ PULONG BufferLength,
+ PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
+ POOL_TYPE PoolType,
+ PGENERIC_MAPPING GenericMapping)
{
DPRINT("CmiObjectSecurity() called\n");
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 != KeyObject)
{
Status = ObQueryNameString (KeyObject->ParentKey,
- LocalInfo,
- MAX_PATH * sizeof(WCHAR),
- &LocalReturnLength);
+ ObjectNameInfo,
+ Length,
+ ReturnLength);
}
else
{
/* KeyObject is the root key */
Status = ObQueryNameString (HEADER_TO_OBJECT_NAME(BODY_TO_HEADER(KeyObject))->Directory,
- LocalInfo,
- MAX_PATH * sizeof(WCHAR),
- &LocalReturnLength);
+ ObjectNameInfo,
+ Length,
+ ReturnLength);
}
- if (!NT_SUCCESS (Status))
+ if (!NT_SUCCESS(Status) && Status != STATUS_INFO_LENGTH_MISMATCH)
{
- ExFreePool (LocalInfo);
return Status;
}
- DPRINT ("Parent path: %wZ\n", &LocalInfo->Name);
+ (*ReturnLength) += sizeof(WCHAR) + KeyObject->Name.Length;
- Status = RtlAppendUnicodeStringToString (&ObjectNameInfo->Name,
- &LocalInfo->Name);
- ExFreePool (LocalInfo);
- if (!NT_SUCCESS (Status))
- return Status;
+ if (Status == STATUS_INFO_LENGTH_MISMATCH || *ReturnLength > Length)
+ {
+ return STATUS_INFO_LENGTH_MISMATCH;
+ }
+
+ if (ObjectNameInfo->Name.Buffer == NULL)
+ {
+ ObjectNameInfo->Name.Buffer = (PWCHAR)(ObjectNameInfo + 1);
+ ObjectNameInfo->Name.Length = 0;
+ ObjectNameInfo->Name.MaximumLength = Length - sizeof(OBJECT_NAME_INFORMATION);
+ }
+
+
+ DPRINT ("Parent path: %wZ\n", ObjectNameInfo->Name);
Status = RtlAppendUnicodeToString (&ObjectNameInfo->Name,
L"\\");
/* to allow a dichotomic search */
ParentKey->SubKeys[ParentKey->NumberOfSubKeys++] = NewKey;
- DPRINT("Reference parent key: 0x%x\n", ParentKey);
+ DPRINT("Reference parent key: 0x%p\n", ParentKey);
ObReferenceObjectByPointer(ParentKey,
STANDARD_RIGHTS_REQUIRED,
PKEY_CELL KeyCell,
PUNICODE_STRING TargetPath)
{
- UNICODE_STRING LinkName = ROS_STRING_INITIALIZER(L"SymbolicLinkValue");
+ UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"SymbolicLinkValue");
PVALUE_CELL ValueCell;
PDATA_CELL DataCell;
NTSTATUS Status;