Author: fireball
Date: Tue Apr 1 14:27:58 2008
New Revision: 32811
URL:
http://svn.reactos.org/svn/reactos?rev=32811&view=rev
Log:
- Fix initialiization of the object manager lookaside lists.
- Rename the variables to understandable names.
- Don't leak object locks when destroying an object type.
- Directory objects must be case-insensitive.
- Symbolic links must be case-insensitive.
- Create \KernelObjects directory during startup.
Modified:
trunk/reactos/ntoskrnl/include/internal/ob.h
trunk/reactos/ntoskrnl/ob/obinit.c
trunk/reactos/ntoskrnl/ob/oblife.c
Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ob.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ob.h [iso-8859-1] Tue Apr 1 14:27:58 2008
@@ -124,6 +124,21 @@
} OB_TEMP_BUFFER, *POB_TEMP_BUFFER;
//
+// Startup and Shutdown Functions
+//
+BOOLEAN
+NTAPI
+ObInitSystem(
+ VOID
+);
+
+VOID
+NTAPI
+ObShutdownSystem(
+ VOID
+);
+
+//
// Directory Namespace Functions
//
BOOLEAN
@@ -328,6 +343,12 @@
NTAPI
ObpFreeObjectNameBuffer(
IN PUNICODE_STRING Name
+);
+
+VOID
+NTAPI
+ObpDeleteObjectType(
+ IN PVOID Object
);
//
@@ -541,7 +562,7 @@
extern PHANDLE_TABLE ObpKernelHandleTable;
extern WORK_QUEUE_ITEM ObpReaperWorkItem;
extern volatile PVOID ObpReaperList;
-extern NPAGED_LOOKASIDE_LIST ObpNmLookasideList, ObpCiLookasideList;
+extern GENERAL_LOOKASIDE ObpNameBufferLookasideList, ObpCreateInfoLookasideList;
extern BOOLEAN IoCountOperations;
extern ALIGNEDNAME ObpDosDevicesShortNamePrefix;
extern ALIGNEDNAME ObpDosDevicesShortNameRoot;
Modified: trunk/reactos/ntoskrnl/ob/obinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obinit.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obinit.c [iso-8859-1] Tue Apr 1 14:27:58 2008
@@ -61,7 +61,7 @@
{
CCHAR i;
PKPRCB Prcb;
- PNPAGED_LOOKASIDE_LIST CurrentList = NULL;
+ PGENERAL_LOOKASIDE CurrentList = NULL;
/* Now allocate the per-processor lists */
for (i = 0; i < KeNumberProcessors; i++)
@@ -70,54 +70,52 @@
Prcb = KiProcessorBlock[(int)i];
/* Set the OBJECT_CREATE_INFORMATION List */
- Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCiLookasideList.L;
+ Prcb->PPLookasideList[LookasideCreateInfoList].L =
&ObpCreateInfoLookasideList;
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(NPAGED_LOOKASIDE_LIST),
+ sizeof(GENERAL_LOOKASIDE),
TAG('O', 'b', 'C',
'I'));
if (CurrentList)
{
/* Initialize it */
- ExInitializeNPagedLookasideList(CurrentList,
- NULL,
- NULL,
- 0,
+ ExInitializeSystemLookasideList(CurrentList,
+ NonPagedPool,
sizeof(OBJECT_CREATE_INFORMATION),
TAG('O', 'b', 'C',
'I'),
- 32);
+ 32,
+ &ExSystemLookasideListHead);
}
else
{
/* No list, use the static buffer */
- CurrentList = &ObpCiLookasideList;
+ CurrentList = &ObpCreateInfoLookasideList;
}
/* Link it */
- Prcb->PPLookasideList[LookasideCreateInfoList].P = &CurrentList->L;
+ Prcb->PPLookasideList[LookasideCreateInfoList].P = CurrentList;
/* Set the captured UNICODE_STRING Object Name List */
- Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNmLookasideList.L;
+ Prcb->PPLookasideList[LookasideNameBufferList].L =
&ObpNameBufferLookasideList;
CurrentList = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(NPAGED_LOOKASIDE_LIST),
+ sizeof(GENERAL_LOOKASIDE),
TAG('O', 'b', 'N',
'M'));
if (CurrentList)
{
/* Initialize it */
- ExInitializeNPagedLookasideList(CurrentList,
- NULL,
- NULL,
- 0,
+ ExInitializeSystemLookasideList(CurrentList,
+ PagedPool,
248,
TAG('O', 'b', 'N',
'M'),
- 16);
+ 16,
+ &ExSystemLookasideListHead);
}
else
{
/* No list, use the static buffer */
- CurrentList = &ObpNmLookasideList;
+ CurrentList = &ObpNameBufferLookasideList;
}
/* Link it */
- Prcb->PPLookasideList[LookasideNameBufferList].P = &CurrentList->L;
+ Prcb->PPLookasideList[LookasideNameBufferList].P = CurrentList;
}
return TRUE;
@@ -144,34 +142,32 @@
if (ObpInitializationPhase != 0) goto ObPostPhase0;
/* Initialize the OBJECT_CREATE_INFORMATION List */
- ExInitializeNPagedLookasideList(&ObpCiLookasideList,
- NULL,
- NULL,
- 0,
+ ExInitializeSystemLookasideList(&ObpCreateInfoLookasideList,
+ NonPagedPool,
sizeof(OBJECT_CREATE_INFORMATION),
TAG('O', 'b', 'C',
'I'),
- 32);
+ 32,
+ &ExSystemLookasideListHead);
/* Set the captured UNICODE_STRING Object Name List */
- ExInitializeNPagedLookasideList(&ObpNmLookasideList,
- NULL,
- NULL,
- 0,
+ ExInitializeSystemLookasideList(&ObpNameBufferLookasideList,
+ PagedPool,
248,
TAG('O', 'b', 'N',
'M'),
- 16);
+ 16,
+ &ExSystemLookasideListHead);
/* Temporarily setup both pointers to the shared list */
- Prcb->PPLookasideList[LookasideCreateInfoList].L = &ObpCiLookasideList.L;
- Prcb->PPLookasideList[LookasideCreateInfoList].P = &ObpCiLookasideList.L;
- Prcb->PPLookasideList[LookasideNameBufferList].L = &ObpNmLookasideList.L;
- Prcb->PPLookasideList[LookasideNameBufferList].P = &ObpNmLookasideList.L;
+ Prcb->PPLookasideList[LookasideCreateInfoList].L =
&ObpCreateInfoLookasideList;
+ Prcb->PPLookasideList[LookasideCreateInfoList].P =
&ObpCreateInfoLookasideList;
+ Prcb->PPLookasideList[LookasideNameBufferList].L =
&ObpNameBufferLookasideList;
+ Prcb->PPLookasideList[LookasideNameBufferList].P =
&ObpNameBufferLookasideList;
/* Initialize the security descriptor cache */
ObpInitSdCache();
/* Initialize the Default Event */
- KeInitializeEvent(&ObpDefaultObject, NotificationEvent, TRUE );
+ KeInitializeEvent(&ObpDefaultObject, NotificationEvent, TRUE);
/* Setup default access for the system process */
PsGetCurrentProcess()->GrantedAccess = PROCESS_ALL_ACCESS;
@@ -198,21 +194,22 @@
ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
+ ObjectTypeInitializer.DeleteProcedure = ObpDeleteObjectType;
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ObpTypeObjectType);
/* Create the Directory Type */
RtlInitUnicodeString(&Name, L"Directory");
ObjectTypeInitializer.ValidAccessMask = DIRECTORY_ALL_ACCESS;
- ObjectTypeInitializer.UseDefaultObject = FALSE;
+ ObjectTypeInitializer.CaseInsensitive = TRUE;
ObjectTypeInitializer.MaintainTypeList = FALSE;
ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping;
+ ObjectTypeInitializer.DeleteProcedure = NULL;
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_DIRECTORY);
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ObDirectoryType);
/* Create 'symbolic link' object type */
RtlInitUnicodeString(&Name, L"SymbolicLink");
- ObjectTypeInitializer.DefaultNonPagedPoolCharge =
- sizeof(OBJECT_SYMBOLIC_LINK);
+ ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_SYMBOLIC_LINK);
ObjectTypeInitializer.GenericMapping = ObpSymbolicLinkMapping;
ObjectTypeInitializer.ValidAccessMask = SYMBOLIC_LINK_ALL_ACCESS;
ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink;
@@ -251,6 +248,24 @@
NULL);
if (!NT_SUCCESS(Status)) return FALSE;
+ /* Close the extra handle */
+ Status = NtClose(Handle);
+ if (!NT_SUCCESS(Status)) return FALSE;
+
+ /* Initialize Object Types directory attributes */
+ RtlInitUnicodeString(&Name, L"\\KernelObjects");
+ InitializeObjectAttributes(&ObjectAttributes,
+ &Name,
+ OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
+ NULL,
+ NULL);
+
+ /* Create the directory */
+ Status = NtCreateDirectoryObject(&Handle,
+ DIRECTORY_ALL_ACCESS,
+ &ObjectAttributes);
+ if (!NT_SUCCESS(Status)) return FALSE;
+
/* Close the extra handle */
Status = NtClose(Handle);
if (!NT_SUCCESS(Status)) return FALSE;
Modified: trunk/reactos/ntoskrnl/ob/oblife.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/oblife.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/oblife.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/oblife.c [iso-8859-1] Tue Apr 1 14:27:58 2008
@@ -22,7 +22,7 @@
POBJECT_TYPE ObpTypeObjectType = NULL;
KEVENT ObpDefaultObject;
-NPAGED_LOOKASIDE_LIST ObpNmLookasideList, ObpCiLookasideList;
+GENERAL_LOOKASIDE ObpNameBufferLookasideList, ObpCreateInfoLookasideList;
WORK_QUEUE_ITEM ObpReaperWorkItem;
volatile PVOID ObpReaperList;
@@ -1236,6 +1236,24 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
+VOID
+NTAPI
+ObpDeleteObjectType(IN PVOID Object)
+{
+ ULONG i;
+ POBJECT_TYPE ObjectType = (PVOID)Object;
+
+ /* Loop our locks */
+ for (i = 0; i < 4; i++)
+ {
+ /* Delete each one */
+ ExDeleteResourceLite(&ObjectType->ObjectLocks[i]);
+ }
+
+ /* Delete our main mutex */
+ ExDeleteResourceLite(&ObjectType->Mutex);
+}
+
/*++
* @name ObMakeTemporaryObject
* @implemented NT4