- Finish up implementation of NtQueryDirectoryObject by doing the final conversion.

svn path=/trunk/; revision=23113
This commit is contained in:
Alex Ionescu 2006-07-17 03:24:41 +00:00
parent 96722f7c02
commit 0957e22a49

View file

@ -411,8 +411,6 @@ NtQueryDirectoryObject(IN HANDLE DirectoryHandle,
POBJECT_DIRECTORY Directory; POBJECT_DIRECTORY Directory;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
ULONG SkipEntries = 0; ULONG SkipEntries = 0;
ULONG NextEntry = 0;
ULONG CopyBytes = 0;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
PVOID LocalBuffer; PVOID LocalBuffer;
POBJECT_DIRECTORY_INFORMATION DirectoryInfo; POBJECT_DIRECTORY_INFORMATION DirectoryInfo;
@ -423,6 +421,7 @@ NtQueryDirectoryObject(IN HANDLE DirectoryHandle,
POBJECT_HEADER ObjectHeader; POBJECT_HEADER ObjectHeader;
POBJECT_HEADER_NAME_INFO ObjectNameInfo; POBJECT_HEADER_NAME_INFO ObjectNameInfo;
UNICODE_STRING Name; UNICODE_STRING Name;
PWSTR p;
PAGED_CODE(); PAGED_CODE();
/* Check if we need to do any probing */ /* Check if we need to do any probing */
@ -573,9 +572,50 @@ Quickie:
/* Make sure we got success */ /* Make sure we got success */
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
/* We need to parse all the entries and convert absolute to relative */ /* Clear the current pointer and set it */
DPRINT1("NOT FULLY IMPLEMENTED\n"); RtlZeroMemory(DirectoryInfo, sizeof(OBJECT_DIRECTORY_INFORMATION));
Status = STATUS_INSUFFICIENT_RESOURCES; DirectoryInfo++;
/* Set the buffer here now and loop entries */
p = (PWSTR)DirectoryInfo;
DirectoryInfo = LocalBuffer;
while (Count--)
{
/* Copy the name buffer */
RtlMoveMemory(p,
DirectoryInfo->Name.Buffer,
DirectoryInfo->Name.Length);
/* Now fixup the pointers */
DirectoryInfo->Name.Buffer = (PVOID)((ULONG_PTR)Buffer +
((ULONG_PTR)p -
(ULONG_PTR)LocalBuffer));
/* Advance in buffer and NULL-terminate */
p = (PVOID)((ULONG_PTR)p + DirectoryInfo->Name.Length);
*p++ = UNICODE_NULL;
/* Now copy the type name buffer */
RtlMoveMemory(p,
DirectoryInfo->TypeName.Buffer,
DirectoryInfo->TypeName.Length);
/* Now fixup the pointers */
DirectoryInfo->TypeName.Buffer = (PVOID)((ULONG_PTR)Buffer +
((ULONG_PTR)p -
(ULONG_PTR)LocalBuffer));
/* Advance in buffer and NULL-terminate */
p = (PVOID)((ULONG_PTR)p + DirectoryInfo->TypeName.Length);
*p++ = UNICODE_NULL;
/* Move to the next entry */
DirectoryInfo++;
}
/* Set the key */
*Context = CurrentEntry;
}
/* Copy the buffer */ /* Copy the buffer */
RtlMoveMemory(Buffer, RtlMoveMemory(Buffer,
@ -585,7 +625,6 @@ Quickie:
/* Check if the caller requested the return length and return it*/ /* Check if the caller requested the return length and return it*/
if (ReturnLength) *ReturnLength = TotalLength; if (ReturnLength) *ReturnLength = TotalLength;
}
/* Dereference the directory and free our buffer */ /* Dereference the directory and free our buffer */
ObDereferenceObject(Directory); ObDereferenceObject(Directory);