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
* PROGRAMMER: David Welch
@ -171,8 +171,8 @@ ListDirectory (
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
HANDLE DirectoryHandle;
BYTE DirectoryEntry [MAX_DIR_ENTRY * sizeof(OBJDIR_INFORMATION)];
POBJDIR_INFORMATION pDirectoryEntry = (POBJDIR_INFORMATION) DirectoryEntry;
BYTE DirectoryEntry [MAX_DIR_ENTRY * sizeof(DIRECTORY_BASIC_INFORMATION)];
PDIRECTORY_BASIC_INFORMATION pDirectoryEntry = (PDIRECTORY_BASIC_INFORMATION) DirectoryEntry;
ULONG Context = 0;
ULONG ReturnLength = 0;
ULONG EntryCount = 0;
@ -294,7 +294,7 @@ ListDirectory (
*/
if (FALSE != Recurse)
{
pDirectoryEntry = (POBJDIR_INFORMATION) DirectoryEntry;
pDirectoryEntry = (PDIRECTORY_BASIC_INFORMATION) DirectoryEntry;
while (0 != pDirectoryEntry->ObjectTypeName.Length)
{
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
* PROJECT: ReactOS kernel
@ -4575,25 +4575,26 @@ NtProtectVirtualMemory(
/*
* FUNCTION: Query information about the content of a directory object
* ARGUMENTS:
DirObjInformation = Buffer must be large enough to hold the name strings too
GetNextIndex = If TRUE :return the index of the next object in this directory in ObjectIndex
If FALSE: return the number of objects in this directory in ObjectIndex
IgnoreInputIndex= If TRUE: ignore input value of ObjectIndex always start at index 0
If FALSE use input value of ObjectIndex
ObjectIndex = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
DataWritten = Actual size of the ObjectIndex ???
DirectoryHandle =
Buffer = Buffer must be large enough to hold the name strings too
ReturnSingleEntry = If TRUE :return the index of the next object in this directory in ObjectIndex
If FALSE: return the number of objects in this directory in ObjectIndex
RestartScan = If TRUE: ignore input value of ObjectIndex always start at index 0
If FALSE use input value of ObjectIndex
Context = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
ReturnLength = Actual size of the ObjectIndex ???
* RETURNS: Status
*/
NTSTATUS
STDCALL
NtQueryDirectoryObject(
IN HANDLE DirObjHandle,
OUT POBJDIR_INFORMATION DirObjInformation,
IN ULONG BufferLength,
IN BOOLEAN GetNextIndex,
IN BOOLEAN IgnoreInputIndex,
IN OUT PULONG ObjectIndex,
OUT PULONG DataWritten OPTIONAL
IN HANDLE DirectoryHandle,
OUT PVOID Buffer,
IN ULONG BufferLength,
IN BOOLEAN ReturnSingleEntry,
IN BOOLEAN RestartScan,
IN OUT PULONG Context,
OUT PULONG ReturnLength OPTIONAL
);
/*
@ -5212,25 +5213,26 @@ ZwQueryInformationAtom(
/*
* FUNCTION: Query information about the content of a directory object
* ARGUMENTS:
DirObjInformation = Buffer must be large enough to hold the name strings too
GetNextIndex = If TRUE :return the index of the next object in this directory in ObjectIndex
If FALSE: return the number of objects in this directory in ObjectIndex
IgnoreInputIndex= If TRUE: ignore input value of ObjectIndex always start at index 0
If FALSE use input value of ObjectIndex
ObjectIndex = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
DataWritten = Actual size of the ObjectIndex ???
DirectoryHandle =
Buffer = Buffer must be large enough to hold the name strings too
ReturnSingleEntry = If TRUE :return the index of the next object in this directory in ObjectIndex
If FALSE: return the number of objects in this directory in ObjectIndex
RestartScan = If TRUE: ignore input value of ObjectIndex always start at index 0
If FALSE use input value of ObjectIndex
Context = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
ReturnLength = Actual size of the ObjectIndex ???
* RETURNS: Status
*/
NTSTATUS
STDCALL
ZwQueryDirectoryObject(
IN HANDLE DirObjHandle,
OUT POBJDIR_INFORMATION DirObjInformation,
IN ULONG BufferLength,
IN BOOLEAN GetNextIndex,
IN BOOLEAN IgnoreInputIndex,
IN OUT PULONG ObjectIndex,
OUT PULONG DataWritten OPTIONAL
IN HANDLE DirectoryHandle,
OUT PVOID Buffer,
IN ULONG BufferLength,
IN BOOLEAN ReturnSingleEntry,
IN BOOLEAN RestartScan,
IN OUT PULONG Context,
OUT PULONG ReturnLength OPTIONAL
);
/*

View file

@ -1599,11 +1599,11 @@ typedef struct _OBJECT_TYPE_INFORMATION
// directory information
typedef struct _OBJDIR_INFORMATION {
typedef struct _DIRECTORY_BASIC_INFORMATION
{
UNICODE_STRING ObjectName;
UNICODE_STRING ObjectTypeName; // Directory, Device ...
UCHAR Data[0];
} OBJDIR_INFORMATION, *POBJDIR_INFORMATION;
} DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_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
* PROJECT: ReactOS kernel
@ -86,12 +86,12 @@ NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle,
* 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
@ -106,11 +106,11 @@ NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle,
* 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).
*
@ -124,27 +124,27 @@ NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle,
* Mostly rewritten.
*/
NTSTATUS STDCALL
NtQueryDirectoryObject (IN HANDLE DirObjHandle,
OUT POBJDIR_INFORMATION DirObjInformation,
NtQueryDirectoryObject (IN HANDLE DirectoryHandle,
OUT PVOID Buffer,
IN ULONG BufferLength,
IN BOOLEAN ReturnSingleEntry,
IN BOOLEAN RestartScan,
IN OUT PULONG ObjectIndex,
OUT PULONG DataWritten OPTIONAL)
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);
@ -153,7 +153,7 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
* on user params. */
/* Reference the DIRECTORY_OBJECT */
Status = ObReferenceObjectByHandle(DirObjHandle,
Status = ObReferenceObjectByHandle(DirectoryHandle,
DIRECTORY_QUERY,
ObDirectoryType,
UserMode,
@ -163,8 +163,8 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
{
return (Status);
}
/* Check ObjectIndex is not NULL */
if (NULL == ObjectIndex)
/* Check Context is not NULL */
if (NULL == Context)
{
return (STATUS_INVALID_PARAMETER);
}
@ -188,7 +188,7 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
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);
@ -201,7 +201,7 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
if (FALSE == RestartScan)
{
/* RestartScan == FALSE */
register ULONG EntriesToSkip = *ObjectIndex;
register ULONG EntriesToSkip = *Context;
CHECKPOINT;
@ -289,16 +289,16 @@ NtQueryDirectoryObject (IN HANDLE DirObjHandle,
} 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);
}

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
*
@ -318,7 +318,7 @@ ScmCheckDriver(PSERVICE Service)
UNICODE_STRING DirName;
HANDLE DirHandle;
NTSTATUS Status;
POBJDIR_INFORMATION DirInfo;
PDIRECTORY_BASIC_INFORMATION DirInfo;
ULONG BufferLength;
ULONG DataLength;
ULONG Index;
@ -352,7 +352,7 @@ ScmCheckDriver(PSERVICE Service)
return(Status);
}
BufferLength = sizeof(OBJDIR_INFORMATION) +
BufferLength = sizeof(DIRECTORY_BASIC_INFORMATION) +
2 * MAX_PATH * sizeof(WCHAR);
DirInfo = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,