Author: ion
Date: Thu Jan 25 04:50:40 2007
New Revision: 25625
URL:
http://svn.reactos.org/svn/reactos?rev=25625&view=rev
Log:
- Implement ObQueryTypeInfo and link it to NtQueryObject.
- Fix a bug in ObQueryNameInfo.
See issue #1993 for more details.
Modified:
trunk/reactos/include/ndk/obtypes.h
trunk/reactos/ntoskrnl/ob/oblife.c
trunk/reactos/ntoskrnl/ob/obname.c
Modified: trunk/reactos/include/ndk/obtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/obtypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/obtypes.h (original)
+++ trunk/reactos/include/ndk/obtypes.h Thu Jan 25 04:50:40 2007
@@ -269,6 +269,34 @@
UNICODE_STRING TypeName;
} OBJECT_DIRECTORY_INFORMATION, *POBJECT_DIRECTORY_INFORMATION;
+//
+// Object Type Information
+//
+typedef struct _OBJECT_TYPE_INFORMATION
+{
+ UNICODE_STRING TypeName;
+ ULONG TotalNumberOfObjects;
+ ULONG TotalNumberOfHandles;
+ ULONG TotalPagedPoolUsage;
+ ULONG TotalNonPagedPoolUsage;
+ ULONG TotalNamePoolUsage;
+ ULONG TotalHandleTableUsage;
+ ULONG HighWaterNumberOfObjects;
+ ULONG HighWaterNumberOfHandles;
+ ULONG HighWaterPagedPoolUsage;
+ ULONG HighWaterNonPagedPoolUsage;
+ ULONG HighWaterNamePoolUsage;
+ ULONG HighWaterHandleTableUsage;
+ ULONG InvalidAttributes;
+ GENERIC_MAPPING GenericMapping;
+ ULONG ValidAccessMask;
+ BOOLEAN SecurityRequired;
+ BOOLEAN MaintainHandleCount;
+ ULONG PoolType;
+ ULONG DefaultPagedPoolCharge;
+ ULONG DefaultNonPagedPoolCharge;
+} OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
+
#ifndef NTOS_MODE_USER
typedef struct _OBJECT_BASIC_INFORMATION
@@ -306,14 +334,14 @@
typedef struct _OBJECT_TYPE_INITIALIZER
{
USHORT Length;
- UCHAR UseDefaultObject;
- UCHAR CaseInsensitive;
+ BOOLEAN UseDefaultObject;
+ BOOLEAN CaseInsensitive;
ULONG InvalidAttributes;
GENERIC_MAPPING GenericMapping;
ULONG ValidAccessMask;
- UCHAR SecurityRequired;
- UCHAR MaintainHandleCount;
- UCHAR MaintainTypeList;
+ BOOLEAN SecurityRequired;
+ BOOLEAN MaintainHandleCount;
+ BOOLEAN MaintainTypeList;
POOL_TYPE PoolType;
ULONG DefaultPagedPoolCharge;
ULONG DefaultNonPagedPoolCharge;
Modified: trunk/reactos/ntoskrnl/ob/oblife.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/oblife.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/oblife.c (original)
+++ trunk/reactos/ntoskrnl/ob/oblife.c Thu Jan 25 04:50:40 2007
@@ -820,6 +820,78 @@
return STATUS_SUCCESS;
}
+NTSTATUS
+NTAPI
+ObQueryTypeInfo(IN POBJECT_TYPE ObjectType,
+ OUT POBJECT_TYPE_INFORMATION ObjectTypeInfo,
+ IN ULONG Length,
+ OUT PULONG ReturnLength)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+ PWSTR InfoBuffer;
+
+ /* Enter SEH */
+ _SEH_TRY
+ {
+ /* Set return length aligned to 4-byte boundary */
+ *ReturnLength += sizeof(*ObjectTypeInfo) +
+ ALIGN_UP(ObjectType->Name.MaximumLength, ULONG);
+
+ /* Check if thats too much though. */
+ if (Length < *ReturnLength) return STATUS_INFO_LENGTH_MISMATCH;
+
+ /* Build the data */
+ ObjectTypeInfo->TotalNumberOfHandles =
+ ObjectType->TotalNumberOfHandles;
+ ObjectTypeInfo->TotalNumberOfObjects =
+ ObjectType->TotalNumberOfObjects;
+ ObjectTypeInfo->HighWaterNumberOfHandles =
+ ObjectType->HighWaterNumberOfHandles;
+ ObjectTypeInfo->HighWaterNumberOfObjects =
+ ObjectType->HighWaterNumberOfObjects;
+ ObjectTypeInfo->PoolType =
+ ObjectType->TypeInfo.PoolType;
+ ObjectTypeInfo->DefaultNonPagedPoolCharge =
+ ObjectType->TypeInfo.DefaultNonPagedPoolCharge;
+ ObjectTypeInfo->DefaultPagedPoolCharge =
+ ObjectType->TypeInfo.DefaultPagedPoolCharge;
+ ObjectTypeInfo->ValidAccessMask =
+ ObjectType->TypeInfo.ValidAccessMask;
+ ObjectTypeInfo->SecurityRequired =
+ ObjectType->TypeInfo.SecurityRequired;
+ ObjectTypeInfo->InvalidAttributes =
+ ObjectType->TypeInfo.InvalidAttributes;
+ ObjectTypeInfo->GenericMapping =
+ ObjectType->TypeInfo.GenericMapping;
+ ObjectTypeInfo->MaintainHandleCount =
+ ObjectType->TypeInfo.MaintainHandleCount;
+
+ /* Setup the name buffer */
+ InfoBuffer = (PWSTR)(ObjectTypeInfo + 1);
+ ObjectTypeInfo->TypeName.Buffer = InfoBuffer;
+ ObjectTypeInfo->TypeName.MaximumLength = ObjectType->Name.MaximumLength;
+ ObjectTypeInfo->TypeName.Length = ObjectType->Name.Length;
+
+ /* Copy it */
+ RtlCopyMemory(InfoBuffer,
+ ObjectType->Name.Buffer,
+ ObjectType->Name.Length);
+
+ /* Null-terminate it */
+ (InfoBuffer)[ObjectType->Name.Length / sizeof(WCHAR)] = UNICODE_NULL;
+ }
+ _SEH_EXCEPT(_SEH_ExSystemExceptionFilter)
+ {
+ /* Otherwise, get the exception code */
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ /* Return status to caller */
+ return Status;
+}
+
+
/* PUBLIC FUNCTIONS **********************************************************/
NTSTATUS
@@ -1416,8 +1488,13 @@
/* Information about this type */
case ObjectTypeInformation:
- DPRINT1("NOT IMPLEMENTED!\n");
- Status = STATUS_NOT_IMPLEMENTED;
+
+ /* Call the helper and break out */
+ Status = ObQueryTypeInfo(ObjectHeader->Type,
+ (POBJECT_TYPE_INFORMATION)
+ ObjectInformation,
+ Length,
+ &InfoLength);
break;
/* Information about all types */
Modified: trunk/reactos/ntoskrnl/ob/obname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obname.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obname.c (original)
+++ trunk/reactos/ntoskrnl/ob/obname.c Thu Jan 25 04:50:40 2007
@@ -985,6 +985,7 @@
POBJECT_DIRECTORY ParentDirectory;
ULONG NameSize;
PWCH ObjectName;
+ BOOLEAN ObjectIsNamed;
/* Get the Kernel Meta-Structures */
ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
@@ -994,8 +995,9 @@
if (ObjectHeader->Type->TypeInfo.QueryNameProcedure)
{
/* Call the procedure */
+ ObjectIsNamed = ((LocalInfo) && (LocalInfo->Name.Length > 0));
return ObjectHeader->Type->TypeInfo.QueryNameProcedure(Object,
- TRUE, //fixme
+ ObjectIsNamed,
ObjectNameInfo,
Length,
ReturnLength,