- Formatting/comment fixes.

svn path=/trunk/; revision=22229
This commit is contained in:
Alex Ionescu 2006-06-05 00:16:14 +00:00
parent 02d0bb9dbd
commit 137f145eb6
2 changed files with 84 additions and 89 deletions

View file

@ -551,9 +551,9 @@ ObpAllocateObject(IN POBJECT_CREATE_INFORMATION ObjectCreateInfo,
NTSTATUS NTSTATUS
NTAPI NTAPI
ObpCreateTypeObject(POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, ObpCreateTypeObject(IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
PUNICODE_STRING TypeName, IN PUNICODE_STRING TypeName,
POBJECT_TYPE *ObjectType) OUT POBJECT_TYPE *ObjectType)
{ {
POBJECT_HEADER Header; POBJECT_HEADER Header;
POBJECT_TYPE LocalObjectType; POBJECT_TYPE LocalObjectType;
@ -610,13 +610,15 @@ ObpCreateTypeObject(POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
(ObjectTypeInitializer->MaintainHandleCount ? (ObjectTypeInitializer->MaintainHandleCount ?
sizeof(OBJECT_HEADER_HANDLE_INFO) : 0); sizeof(OBJECT_HEADER_HANDLE_INFO) : 0);
/* Update the Pool Charges */ /* Check the pool type */
if (ObjectTypeInitializer->PoolType == NonPagedPool) if (ObjectTypeInitializer->PoolType == NonPagedPool)
{ {
/* Update the NonPaged Pool charge */
LocalObjectType->TypeInfo.DefaultNonPagedPoolCharge += HeaderSize; LocalObjectType->TypeInfo.DefaultNonPagedPoolCharge += HeaderSize;
} }
else else
{ {
/* Update the Paged Pool charge */
LocalObjectType->TypeInfo.DefaultPagedPoolCharge += HeaderSize; LocalObjectType->TypeInfo.DefaultPagedPoolCharge += HeaderSize;
} }
@ -635,10 +637,12 @@ ObpCreateTypeObject(POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
/* Use the "Default Object", a simple event */ /* Use the "Default Object", a simple event */
LocalObjectType->DefaultObject = &ObpDefaultObject; LocalObjectType->DefaultObject = &ObpDefaultObject;
} }
/* Special system objects get an optimized hack so they can be waited on */ /* The File Object gets an optimized hack so it can be waited on */
else if (TypeName->Length == 8 && !wcscmp(TypeName->Buffer, L"File")) else if ((TypeName->Length == 8) && !(wcscmp(TypeName->Buffer, L"File")))
{ {
LocalObjectType->DefaultObject = (PVOID)FIELD_OFFSET(FILE_OBJECT, Event); /* Wait on the File Object's event directly */
LocalObjectType->DefaultObject = (PVOID)FIELD_OFFSET(FILE_OBJECT,
Event);
} }
/* FIXME: When LPC stops sucking, add a hack for Waitable Ports */ /* FIXME: When LPC stops sucking, add a hack for Waitable Ports */
else else
@ -651,9 +655,10 @@ ObpCreateTypeObject(POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
ExInitializeResourceLite(&LocalObjectType->Mutex); ExInitializeResourceLite(&LocalObjectType->Mutex);
InitializeListHead(&LocalObjectType->TypeList); InitializeListHead(&LocalObjectType->TypeList);
/* Insert it into the Object Directory */ /* Check if we're actually creating the directory object itself */
if (ObpTypeDirectoryObject) if (ObpTypeDirectoryObject)
{ {
/* Insert it into the Object Directory */
Context.Directory = ObpTypeDirectoryObject; Context.Directory = ObpTypeDirectoryObject;
Context.DirectoryLocked = TRUE; Context.DirectoryLocked = TRUE;
ObpLookupEntryDirectory(ObpTypeDirectoryObject, ObpLookupEntryDirectory(ObpTypeDirectoryObject,
@ -665,6 +670,7 @@ ObpCreateTypeObject(POBJECT_TYPE_INITIALIZER ObjectTypeInitializer,
ObReferenceObject(ObpTypeDirectoryObject); ObReferenceObject(ObpTypeDirectoryObject);
} }
/* Return the object type and creations tatus */
*ObjectType = LocalObjectType; *ObjectType = LocalObjectType;
return Status; return Status;
} }

View file

@ -180,12 +180,12 @@ Next:
Status = CurrentHeader->Type->TypeInfo.ParseProcedure(CurrentObject, Status = CurrentHeader->Type->TypeInfo.ParseProcedure(CurrentObject,
CurrentHeader->Type, CurrentHeader->Type,
AccessState, AccessState,
ExGetPreviousMode(), // fixme: should be a parameter, since caller decides. PreviousMode,
Attributes, Attributes,
&PathString, &PathString,
&CurrentUs, &CurrentUs,
ParseContext, ParseContext,
NULL, // fixme: where do we get this from? captured OBP? SecurityQos,
&NextObject); &NextObject);
current = CurrentUs.Buffer; current = CurrentUs.Buffer;
if (Status == STATUS_REPARSE) if (Status == STATUS_REPARSE)
@ -341,9 +341,6 @@ ObQueryNameString(IN PVOID Object,
POBJECT_DIRECTORY ParentDirectory; POBJECT_DIRECTORY ParentDirectory;
ULONG NameSize; ULONG NameSize;
PWCH ObjectName; PWCH ObjectName;
NTSTATUS Status;
DPRINT("ObQueryNameString: %x, %x\n", Object, ObjectNameInfo);
/* Get the Kernel Meta-Structures */ /* Get the Kernel Meta-Structures */
ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object); ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
@ -353,36 +350,24 @@ ObQueryNameString(IN PVOID Object,
if (ObjectHeader->Type->TypeInfo.QueryNameProcedure) if (ObjectHeader->Type->TypeInfo.QueryNameProcedure)
{ {
/* Call the procedure */ /* Call the procedure */
DPRINT("Calling Object's Procedure\n"); return ObjectHeader->Type->TypeInfo.QueryNameProcedure(Object,
Status = ObjectHeader->Type->TypeInfo.QueryNameProcedure(Object, TRUE, //fixme
TRUE, //fixme ObjectNameInfo,
ObjectNameInfo, Length,
Length, ReturnLength);
ReturnLength);
/* Return the status */
return Status;
} }
/* Check if the object doesn't even have a name */ /* Check if the object doesn't even have a name */
if (!LocalInfo || !LocalInfo->Name.Buffer) if (!LocalInfo || !LocalInfo->Name.Buffer)
{ {
/* We're returning the name structure */ /* We're returning the name structure */
DPRINT("Nameless Object\n");
*ReturnLength = sizeof(OBJECT_NAME_INFORMATION); *ReturnLength = sizeof(OBJECT_NAME_INFORMATION);
/* Check if we were given enough space */ /* Check if we were given enough space */
if (*ReturnLength > Length) if (*ReturnLength > Length) return STATUS_INFO_LENGTH_MISMATCH;
{
DPRINT1("Not enough buffer space\n");
return STATUS_INFO_LENGTH_MISMATCH;
}
/* Return an empty buffer */ /* Return an empty buffer */
ObjectNameInfo->Name.Length = 0; RtlInitEmptyUnicodeString(&ObjectNameInfo->Name, NULL, 0);
ObjectNameInfo->Name.MaximumLength = 0;
ObjectNameInfo->Name.Buffer = NULL;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -396,7 +381,6 @@ ObQueryNameString(IN PVOID Object,
if (Object == NameSpaceRoot) if (Object == NameSpaceRoot)
{ {
/* Size of the '\' string */ /* Size of the '\' string */
DPRINT("Object is Root\n");
NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR); NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR);
} }
else else
@ -409,13 +393,15 @@ ObQueryNameString(IN PVOID Object,
while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory)) while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory))
{ {
/* Get the Name Information */ /* Get the Name Information */
LocalInfo = OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(ParentDirectory)); LocalInfo = OBJECT_HEADER_TO_NAME_INFO(
OBJECT_TO_OBJECT_HEADER(ParentDirectory));
/* Add the size of the Directory Name */ /* Add the size of the Directory Name */
if (LocalInfo && LocalInfo->Directory) if (LocalInfo && LocalInfo->Directory)
{ {
/* Size of the '\' string + Directory Name */ /* Size of the '\' string + Directory Name */
NameSize += sizeof(OBJ_NAME_PATH_SEPARATOR) + LocalInfo->Name.Length; NameSize += sizeof(OBJ_NAME_PATH_SEPARATOR) +
LocalInfo->Name.Length;
/* Move to next parent Directory */ /* Move to next parent Directory */
ParentDirectory = LocalInfo->Directory; ParentDirectory = LocalInfo->Directory;
@ -423,7 +409,6 @@ ObQueryNameString(IN PVOID Object,
else else
{ {
/* Directory with no name. We append "...\" */ /* Directory with no name. We append "...\" */
DPRINT("Nameless Directory\n");
NameSize += sizeof(L"...") + sizeof(OBJ_NAME_PATH_SEPARATOR); NameSize += sizeof(L"...") + sizeof(OBJ_NAME_PATH_SEPARATOR);
break; break;
} }
@ -431,15 +416,12 @@ ObQueryNameString(IN PVOID Object,
} }
/* Finally, add the name of the structure and the null char */ /* Finally, add the name of the structure and the null char */
*ReturnLength = NameSize + sizeof(OBJECT_NAME_INFORMATION) + sizeof(UNICODE_NULL); *ReturnLength = NameSize +
DPRINT("Final Length: %x\n", *ReturnLength); sizeof(OBJECT_NAME_INFORMATION) +
sizeof(UNICODE_NULL);
/* Check if we were given enough space */ /* Check if we were given enough space */
if (*ReturnLength > Length) if (*ReturnLength > Length) return STATUS_INFO_LENGTH_MISMATCH;
{
DPRINT1("Not enough buffer space\n");
return STATUS_INFO_LENGTH_MISMATCH;
}
/* /*
* Now we will actually create the name. We work backwards because * Now we will actually create the name. We work backwards because
@ -450,29 +432,33 @@ ObQueryNameString(IN PVOID Object,
ObjectName = (PWCH)((ULONG_PTR)ObjectNameInfo + *ReturnLength); ObjectName = (PWCH)((ULONG_PTR)ObjectNameInfo + *ReturnLength);
*--ObjectName = UNICODE_NULL; *--ObjectName = UNICODE_NULL;
/* Check if the object is actually the Root directory */
if (Object == NameSpaceRoot) if (Object == NameSpaceRoot)
{ {
/* This is already the Root Directory, return "\\" */ /* This is already the Root Directory, return "\\" */
DPRINT("Returning Root Dir\n");
*--ObjectName = OBJ_NAME_PATH_SEPARATOR; *--ObjectName = OBJ_NAME_PATH_SEPARATOR;
ObjectNameInfo->Name.Length = (USHORT)NameSize; ObjectNameInfo->Name.Length = (USHORT)NameSize;
ObjectNameInfo->Name.MaximumLength = (USHORT)(NameSize + sizeof(UNICODE_NULL)); ObjectNameInfo->Name.MaximumLength = (USHORT)(NameSize +
sizeof(UNICODE_NULL));
ObjectNameInfo->Name.Buffer = ObjectName; ObjectNameInfo->Name.Buffer = ObjectName;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
else else
{ {
/* Start by adding the Object's Name */ /* Start by adding the Object's Name */
ObjectName = (PWCH)((ULONG_PTR)ObjectName - LocalInfo->Name.Length); ObjectName = (PWCH)((ULONG_PTR)ObjectName -
RtlMoveMemory(ObjectName, LocalInfo->Name.Buffer, LocalInfo->Name.Length); LocalInfo->Name.Length);
RtlMoveMemory(ObjectName,
LocalInfo->Name.Buffer,
LocalInfo->Name.Length);
/* Now parse the Parent directories until we reach the top */ /* Now parse the Parent directories until we reach the top */
ParentDirectory = LocalInfo->Directory; ParentDirectory = LocalInfo->Directory;
while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory)) while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory))
{ {
/* Get the name information */ /* Get the name information */
LocalInfo = OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(ParentDirectory)); LocalInfo = OBJECT_HEADER_TO_NAME_INFO(
OBJECT_TO_OBJECT_HEADER(ParentDirectory));
/* Add the "\" */ /* Add the "\" */
*(--ObjectName) = OBJ_NAME_PATH_SEPARATOR; *(--ObjectName) = OBJ_NAME_PATH_SEPARATOR;
@ -481,8 +467,11 @@ ObQueryNameString(IN PVOID Object,
if (LocalInfo && LocalInfo->Name.Buffer) if (LocalInfo && LocalInfo->Name.Buffer)
{ {
/* Add the name */ /* Add the name */
ObjectName = (PWCH)((ULONG_PTR)ObjectName - LocalInfo->Name.Length); ObjectName = (PWCH)((ULONG_PTR)ObjectName -
RtlMoveMemory(ObjectName, LocalInfo->Name.Buffer, LocalInfo->Name.Length); LocalInfo->Name.Length);
RtlMoveMemory(ObjectName,
LocalInfo->Name.Buffer,
LocalInfo->Name.Length);
/* Move to next parent */ /* Move to next parent */
ParentDirectory = LocalInfo->Directory; ParentDirectory = LocalInfo->Directory;
@ -499,13 +488,13 @@ ObQueryNameString(IN PVOID Object,
/* Add Root Directory Name */ /* Add Root Directory Name */
*(--ObjectName) = OBJ_NAME_PATH_SEPARATOR; *(--ObjectName) = OBJ_NAME_PATH_SEPARATOR;
DPRINT("Current Buffer: %S\n", ObjectName);
ObjectNameInfo->Name.Length = (USHORT)NameSize; ObjectNameInfo->Name.Length = (USHORT)NameSize;
ObjectNameInfo->Name.MaximumLength = (USHORT)(NameSize + sizeof(UNICODE_NULL)); ObjectNameInfo->Name.MaximumLength = (USHORT)(NameSize +
sizeof(UNICODE_NULL));
ObjectNameInfo->Name.Buffer = ObjectName; ObjectNameInfo->Name.Buffer = ObjectName;
DPRINT("Complete: %wZ\n", ObjectNameInfo);
} }
/* Return success */
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }