/* INCLUDES ***************************************************************/
-#include <ddk/ntddk.h>
+#define NTOS_MODE_KERNEL
+#include <ntos.h>
#include <internal/ob.h>
#include <internal/io.h>
* NOTES
* Undocumented.
*/
-NTSTATUS STDCALL NtOpenDirectoryObject(PHANDLE DirectoryHandle,
- ACCESS_MASK DesiredAccess,
- POBJECT_ATTRIBUTES ObjectAttributes)
+NTSTATUS STDCALL
+NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes)
{
PVOID Object;
NTSTATUS Status;
* Reads information from a directory in the system namespace.
*
* ARGUMENTS
- * DirObjHandle
+ * DirectoryHandle
* Handle, obtained with NtOpenDirectoryObject(), which
* must grant DIRECTORY_QUERY access to the directory
* object.
*
- * DirObjInformation (OUT)
+ * Buffer (OUT)
* Buffer to hold the data read.
*
* BufferLength
* If FALSE start reading at the index specified
* by object index *ObjectIndex.
*
- * ObjectIndex
+ * Context
* Zero based index into the directory, interpretation
* depends on RestartScan.
*
- * DataWritten (OUT)
+ * ReturnLength (OUT)
* Caller supplied storage for the number of bytes
* written (or NULL).
*
* G.Nebbett "WNT/W2k Native API Reference".
* Mostly rewritten.
*/
-NTSTATUS STDCALL NtQueryDirectoryObject (IN HANDLE DirObjHandle,
- OUT POBJDIR_INFORMATION
- DirObjInformation,
- IN ULONG BufferLength,
- IN BOOLEAN ReturnSingleEntry,
- IN BOOLEAN RestartScan,
- IN OUT PULONG ObjectIndex,
- OUT PULONG DataWritten OPTIONAL)
+NTSTATUS STDCALL
+NtQueryDirectoryObject (IN HANDLE DirectoryHandle,
+ OUT PVOID Buffer,
+ IN ULONG BufferLength,
+ IN BOOLEAN ReturnSingleEntry,
+ IN BOOLEAN RestartScan,
+ IN OUT PULONG Context,
+ OUT PULONG ReturnLength OPTIONAL)
{
PDIRECTORY_OBJECT dir = NULL;
PLIST_ENTRY current_entry = NULL;
POBJECT_HEADER current = NULL;
ULONG i = 0;
NTSTATUS Status = STATUS_SUCCESS;
- DWORD DirectoryCount = 0;
- DWORD DirectorySize = 0;
+ ULONG DirectoryCount = 0;
+ ULONG DirectorySize = 0;
ULONG SpaceLeft = BufferLength;
ULONG SpaceRequired = 0;
ULONG NameLength = 0;
ULONG TypeNameLength = 0;
- POBJDIR_INFORMATION current_odi = DirObjInformation;
- PBYTE FirstFree = (PBYTE) DirObjInformation;
+ PDIRECTORY_BASIC_INFORMATION current_odi = (PDIRECTORY_BASIC_INFORMATION) Buffer;
+ PUCHAR FirstFree = (PUCHAR) Buffer;
DPRINT("NtQueryDirectoryObject(DirObjHandle %x)\n", DirObjHandle);
* on user params. */
/* Reference the DIRECTORY_OBJECT */
- Status = ObReferenceObjectByHandle(DirObjHandle,
+ Status = ObReferenceObjectByHandle(DirectoryHandle,
DIRECTORY_QUERY,
ObDirectoryType,
UserMode,
{
return (Status);
}
- /* Check ObjectIndex is not NULL */
- if (NULL == ObjectIndex)
+ /* Check Context is not NULL */
+ if (NULL == Context)
{
return (STATUS_INVALID_PARAMETER);
}
DirectoryCount = 1;
}
// count is DirectoryCount + one null entry
- DirectorySize = (DirectoryCount + 1) * sizeof (OBJDIR_INFORMATION);
+ DirectorySize = (DirectoryCount + 1) * sizeof (DIRECTORY_BASIC_INFORMATION);
if (DirectorySize > SpaceLeft)
{
return (STATUS_BUFFER_TOO_SMALL);
if (FALSE == RestartScan)
{
/* RestartScan == FALSE */
- register ULONG EntriesToSkip = *ObjectIndex;
+ register ULONG EntriesToSkip = *Context;
CHECKPOINT;
} while (FALSE == ReturnSingleEntry);
/*
- * Store current index in ObjectIndex
+ * Store current index in Context
*/
- *ObjectIndex += DirectoryCount;
+ *Context += DirectoryCount;
/*
* Report to the caller how much bytes
* we wrote in the user buffer.
*/
- if (NULL != DataWritten)
+ if (NULL != ReturnLength)
{
- *DataWritten = (BufferLength - SpaceLeft);
+ *ReturnLength = (BufferLength - SpaceLeft);
}
return (STATUS_SUCCESS);
}
* Status.
*/
NTSTATUS STDCALL
-NtCreateDirectoryObject(PHANDLE DirectoryHandle,
- ACCESS_MASK DesiredAccess,
- POBJECT_ATTRIBUTES ObjectAttributes)
+NtCreateDirectoryObject (OUT PHANDLE DirectoryHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes)
{
PDIRECTORY_OBJECT dir;
DPRINT("NtCreateDirectoryObject(DirectoryHandle %x, "
"DesiredAccess %x, ObjectAttributes %x, "
- "ObjectAttributes->ObjectName %S)\n",
+ "ObjectAttributes->ObjectName %wZ)\n",
DirectoryHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes->ObjectName);
- return(ObCreateObject(DirectoryHandle,
+ return(ObRosCreateObject(DirectoryHandle,
DesiredAccess,
ObjectAttributes,
ObDirectoryType,