Fixed signature of [Nt/Zw]QueryDirectoryObject().

svn path=/trunk/; revision=5968
This commit is contained in:
Eric Kohl 2003-09-03 20:16:06 +00:00
parent a1f144f35b
commit 89fc578c5f
5 changed files with 63 additions and 61 deletions

View file

@ -1,4 +1,4 @@
/* $Id: objdir.c,v 1.11 2003/06/07 16:16:38 chorns Exp $ /* $Id: objdir.c,v 1.12 2003/09/03 20:16:06 ekohl Exp $
* *
* DESCRIPTION: Object Manager Simple Explorer * DESCRIPTION: Object Manager Simple Explorer
* PROGRAMMER: David Welch * PROGRAMMER: David Welch
@ -171,8 +171,8 @@ ListDirectory (
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status; NTSTATUS Status;
HANDLE DirectoryHandle; HANDLE DirectoryHandle;
BYTE DirectoryEntry [MAX_DIR_ENTRY * sizeof(OBJDIR_INFORMATION)]; BYTE DirectoryEntry [MAX_DIR_ENTRY * sizeof(DIRECTORY_BASIC_INFORMATION)];
POBJDIR_INFORMATION pDirectoryEntry = (POBJDIR_INFORMATION) DirectoryEntry; PDIRECTORY_BASIC_INFORMATION pDirectoryEntry = (PDIRECTORY_BASIC_INFORMATION) DirectoryEntry;
ULONG Context = 0; ULONG Context = 0;
ULONG ReturnLength = 0; ULONG ReturnLength = 0;
ULONG EntryCount = 0; ULONG EntryCount = 0;
@ -294,7 +294,7 @@ ListDirectory (
*/ */
if (FALSE != Recurse) if (FALSE != Recurse)
{ {
pDirectoryEntry = (POBJDIR_INFORMATION) DirectoryEntry; pDirectoryEntry = (PDIRECTORY_BASIC_INFORMATION) DirectoryEntry;
while (0 != pDirectoryEntry->ObjectTypeName.Length) while (0 != pDirectoryEntry->ObjectTypeName.Length)
{ {
if (0 == wcscmp (L"Directory", pDirectoryEntry->ObjectTypeName.Buffer)) if (0 == wcscmp (L"Directory", pDirectoryEntry->ObjectTypeName.Buffer))

View file

@ -1,5 +1,5 @@
/* $Id: zw.h,v 1.15 2003/08/19 23:59:08 dwelch Exp $ /* $Id: zw.h,v 1.16 2003/09/03 20:14:22 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -4575,25 +4575,26 @@ NtProtectVirtualMemory(
/* /*
* FUNCTION: Query information about the content of a directory object * FUNCTION: Query information about the content of a directory object
* ARGUMENTS: * ARGUMENTS:
DirObjInformation = Buffer must be large enough to hold the name strings too DirectoryHandle =
GetNextIndex = If TRUE :return the index of the next object in this directory in ObjectIndex Buffer = Buffer must be large enough to hold the name strings too
If FALSE: return the number of objects in this directory in ObjectIndex ReturnSingleEntry = If TRUE :return the index of the next object in this directory in ObjectIndex
IgnoreInputIndex= If TRUE: ignore input value of ObjectIndex always start at index 0 If FALSE: return the number of objects in this directory in ObjectIndex
If FALSE use input value of ObjectIndex RestartScan = If TRUE: ignore input value of ObjectIndex always start at index 0
ObjectIndex = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex If FALSE use input value of ObjectIndex
DataWritten = Actual size of the ObjectIndex ??? Context = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
ReturnLength = Actual size of the ObjectIndex ???
* RETURNS: Status * RETURNS: Status
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
NtQueryDirectoryObject( NtQueryDirectoryObject(
IN HANDLE DirObjHandle, IN HANDLE DirectoryHandle,
OUT POBJDIR_INFORMATION DirObjInformation, OUT PVOID Buffer,
IN ULONG BufferLength, IN ULONG BufferLength,
IN BOOLEAN GetNextIndex, IN BOOLEAN ReturnSingleEntry,
IN BOOLEAN IgnoreInputIndex, IN BOOLEAN RestartScan,
IN OUT PULONG ObjectIndex, IN OUT PULONG Context,
OUT PULONG DataWritten OPTIONAL OUT PULONG ReturnLength OPTIONAL
); );
/* /*
@ -5212,25 +5213,26 @@ ZwQueryInformationAtom(
/* /*
* FUNCTION: Query information about the content of a directory object * FUNCTION: Query information about the content of a directory object
* ARGUMENTS: * ARGUMENTS:
DirObjInformation = Buffer must be large enough to hold the name strings too DirectoryHandle =
GetNextIndex = If TRUE :return the index of the next object in this directory in ObjectIndex Buffer = Buffer must be large enough to hold the name strings too
If FALSE: return the number of objects in this directory in ObjectIndex ReturnSingleEntry = If TRUE :return the index of the next object in this directory in ObjectIndex
IgnoreInputIndex= If TRUE: ignore input value of ObjectIndex always start at index 0 If FALSE: return the number of objects in this directory in ObjectIndex
If FALSE use input value of ObjectIndex RestartScan = If TRUE: ignore input value of ObjectIndex always start at index 0
ObjectIndex = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex If FALSE use input value of ObjectIndex
DataWritten = Actual size of the ObjectIndex ??? Context = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
ReturnLength = Actual size of the ObjectIndex ???
* RETURNS: Status * RETURNS: Status
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
ZwQueryDirectoryObject( ZwQueryDirectoryObject(
IN HANDLE DirObjHandle, IN HANDLE DirectoryHandle,
OUT POBJDIR_INFORMATION DirObjInformation, OUT PVOID Buffer,
IN ULONG BufferLength, IN ULONG BufferLength,
IN BOOLEAN GetNextIndex, IN BOOLEAN ReturnSingleEntry,
IN BOOLEAN IgnoreInputIndex, IN BOOLEAN RestartScan,
IN OUT PULONG ObjectIndex, IN OUT PULONG Context,
OUT PULONG DataWritten OPTIONAL OUT PULONG ReturnLength OPTIONAL
); );
/* /*

View file

@ -1599,11 +1599,11 @@ typedef struct _OBJECT_TYPE_INFORMATION
// directory information // directory information
typedef struct _OBJDIR_INFORMATION { typedef struct _DIRECTORY_BASIC_INFORMATION
{
UNICODE_STRING ObjectName; UNICODE_STRING ObjectName;
UNICODE_STRING ObjectTypeName; // Directory, Device ... UNICODE_STRING ObjectTypeName; // Directory, Device ...
UCHAR Data[0]; } DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
} OBJDIR_INFORMATION, *POBJDIR_INFORMATION;
/* /*

View file

@ -1,4 +1,4 @@
/* $Id: dirobj.c,v 1.18 2003/06/07 12:23:14 chorns Exp $ /* $Id: dirobj.c,v 1.19 2003/09/03 20:15:02 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -86,12 +86,12 @@ NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle,
* Reads information from a directory in the system namespace. * Reads information from a directory in the system namespace.
* *
* ARGUMENTS * ARGUMENTS
* DirObjHandle * DirectoryHandle
* Handle, obtained with NtOpenDirectoryObject(), which * Handle, obtained with NtOpenDirectoryObject(), which
* must grant DIRECTORY_QUERY access to the directory * must grant DIRECTORY_QUERY access to the directory
* object. * object.
* *
* DirObjInformation (OUT) * Buffer (OUT)
* Buffer to hold the data read. * Buffer to hold the data read.
* *
* BufferLength * BufferLength
@ -106,11 +106,11 @@ NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle,
* If FALSE start reading at the index specified * If FALSE start reading at the index specified
* by object index *ObjectIndex. * by object index *ObjectIndex.
* *
* ObjectIndex * Context
* Zero based index into the directory, interpretation * Zero based index into the directory, interpretation
* depends on RestartScan. * depends on RestartScan.
* *
* DataWritten (OUT) * ReturnLength (OUT)
* Caller supplied storage for the number of bytes * Caller supplied storage for the number of bytes
* written (or NULL). * written (or NULL).
* *
@ -124,27 +124,27 @@ NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle,
* Mostly rewritten. * Mostly rewritten.
*/ */
NTSTATUS STDCALL NTSTATUS STDCALL
NtQueryDirectoryObject (IN HANDLE DirObjHandle, NtQueryDirectoryObject (IN HANDLE DirectoryHandle,
OUT POBJDIR_INFORMATION DirObjInformation, OUT PVOID Buffer,
IN ULONG BufferLength, IN ULONG BufferLength,
IN BOOLEAN ReturnSingleEntry, IN BOOLEAN ReturnSingleEntry,
IN BOOLEAN RestartScan, IN BOOLEAN RestartScan,
IN OUT PULONG ObjectIndex, IN OUT PULONG Context,
OUT PULONG DataWritten OPTIONAL) OUT PULONG ReturnLength OPTIONAL)
{ {
PDIRECTORY_OBJECT dir = NULL; PDIRECTORY_OBJECT dir = NULL;
PLIST_ENTRY current_entry = NULL; PLIST_ENTRY current_entry = NULL;
POBJECT_HEADER current = NULL; POBJECT_HEADER current = NULL;
ULONG i = 0; ULONG i = 0;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
DWORD DirectoryCount = 0; ULONG DirectoryCount = 0;
DWORD DirectorySize = 0; ULONG DirectorySize = 0;
ULONG SpaceLeft = BufferLength; ULONG SpaceLeft = BufferLength;
ULONG SpaceRequired = 0; ULONG SpaceRequired = 0;
ULONG NameLength = 0; ULONG NameLength = 0;
ULONG TypeNameLength = 0; ULONG TypeNameLength = 0;
POBJDIR_INFORMATION current_odi = DirObjInformation; PDIRECTORY_BASIC_INFORMATION current_odi = (PDIRECTORY_BASIC_INFORMATION) Buffer;
PBYTE FirstFree = (PBYTE) DirObjInformation; PUCHAR FirstFree = (PUCHAR) Buffer;
DPRINT("NtQueryDirectoryObject(DirObjHandle %x)\n", DirObjHandle); DPRINT("NtQueryDirectoryObject(DirObjHandle %x)\n", DirObjHandle);
@ -153,7 +153,7 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
* on user params. */ * on user params. */
/* Reference the DIRECTORY_OBJECT */ /* Reference the DIRECTORY_OBJECT */
Status = ObReferenceObjectByHandle(DirObjHandle, Status = ObReferenceObjectByHandle(DirectoryHandle,
DIRECTORY_QUERY, DIRECTORY_QUERY,
ObDirectoryType, ObDirectoryType,
UserMode, UserMode,
@ -163,8 +163,8 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
{ {
return (Status); return (Status);
} }
/* Check ObjectIndex is not NULL */ /* Check Context is not NULL */
if (NULL == ObjectIndex) if (NULL == Context)
{ {
return (STATUS_INVALID_PARAMETER); return (STATUS_INVALID_PARAMETER);
} }
@ -188,7 +188,7 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
DirectoryCount = 1; DirectoryCount = 1;
} }
// count is DirectoryCount + one null entry // count is DirectoryCount + one null entry
DirectorySize = (DirectoryCount + 1) * sizeof (OBJDIR_INFORMATION); DirectorySize = (DirectoryCount + 1) * sizeof (DIRECTORY_BASIC_INFORMATION);
if (DirectorySize > SpaceLeft) if (DirectorySize > SpaceLeft)
{ {
return (STATUS_BUFFER_TOO_SMALL); return (STATUS_BUFFER_TOO_SMALL);
@ -201,7 +201,7 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
if (FALSE == RestartScan) if (FALSE == RestartScan)
{ {
/* RestartScan == FALSE */ /* RestartScan == FALSE */
register ULONG EntriesToSkip = *ObjectIndex; register ULONG EntriesToSkip = *Context;
CHECKPOINT; CHECKPOINT;
@ -289,16 +289,16 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
} while (FALSE == ReturnSingleEntry); } while (FALSE == ReturnSingleEntry);
/* /*
* Store current index in ObjectIndex * Store current index in Context
*/ */
*ObjectIndex += DirectoryCount; *Context += DirectoryCount;
/* /*
* Report to the caller how much bytes * Report to the caller how much bytes
* we wrote in the user buffer. * we wrote in the user buffer.
*/ */
if (NULL != DataWritten) if (NULL != ReturnLength)
{ {
*DataWritten = (BufferLength - SpaceLeft); *ReturnLength = (BufferLength - SpaceLeft);
} }
return (STATUS_SUCCESS); return (STATUS_SUCCESS);
} }

View file

@ -1,4 +1,4 @@
/* $Id: database.c,v 1.9 2003/08/28 13:38:24 gvg Exp $ /* $Id: database.c,v 1.10 2003/09/03 20:15:35 ekohl Exp $
* *
* service control manager * service control manager
* *
@ -318,7 +318,7 @@ ScmCheckDriver(PSERVICE Service)
UNICODE_STRING DirName; UNICODE_STRING DirName;
HANDLE DirHandle; HANDLE DirHandle;
NTSTATUS Status; NTSTATUS Status;
POBJDIR_INFORMATION DirInfo; PDIRECTORY_BASIC_INFORMATION DirInfo;
ULONG BufferLength; ULONG BufferLength;
ULONG DataLength; ULONG DataLength;
ULONG Index; ULONG Index;
@ -352,7 +352,7 @@ ScmCheckDriver(PSERVICE Service)
return(Status); return(Status);
} }
BufferLength = sizeof(OBJDIR_INFORMATION) + BufferLength = sizeof(DIRECTORY_BASIC_INFORMATION) +
2 * MAX_PATH * sizeof(WCHAR); 2 * MAX_PATH * sizeof(WCHAR);
DirInfo = HeapAlloc(GetProcessHeap(), DirInfo = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,