Author: ion
Date: Wed Jul 5 02:41:47 2006
New Revision: 22852
URL:
http://svn.reactos.org/svn/reactos?rev=22852&view=rev
Log:
- Fix and combine the creation of I/O Object Types, it was a complete mess with missing
attributes and dangerous bugs (Adapters and Controllers had IopParseDevice as a parse
routine and the same pool charge as a deivice object, etc.)
Modified:
trunk/reactos/ntoskrnl/include/internal/io.h
trunk/reactos/ntoskrnl/io/iomgr/driver.c
trunk/reactos/ntoskrnl/io/iomgr/iocomp.c
trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h Wed Jul 5 02:41:47 2006
@@ -772,6 +772,12 @@
VOID
);
+VOID
+NTAPI
+IopDeleteDriver(
+ IN PVOID ObjectBody
+);
+
NTSTATUS
FASTCALL
IopCreateDriverObject(
@@ -925,9 +931,9 @@
// I/O Completion Routines
//
VOID
-FASTCALL
-IopInitIoCompletionImplementation(
- VOID
+NTAPI
+IopDeleteIoCompletion(
+ PVOID ObjectBody
);
//
@@ -994,6 +1000,7 @@
extern PDEVICE_NODE IopRootDeviceNode;
extern ULONG IopTraceLevel;
extern NPAGED_LOOKASIDE_LIST IopMdlLookasideList;
+extern GENERIC_MAPPING IopCompletionMapping;
//
// Inlined Functions
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Wed Jul 5 02:41:47 2006
@@ -115,22 +115,6 @@
INIT_FUNCTION
IopInitDriverImplementation(VOID)
{
- OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
- UNICODE_STRING Name;
-
- DPRINT("Creating Registry Object Type\n");
-
- /* Initialize the Driver object type */
- RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
- RtlInitUnicodeString(&Name, L"Driver");
- ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
- ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DRIVER_OBJECT);
- ObjectTypeInitializer.PoolType = NonPagedPool;
- ObjectTypeInitializer.UseDefaultObject = TRUE;
- ObjectTypeInitializer.DeleteProcedure = IopDeleteDriver;
-
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoDriverObjectType);
-
InitializeListHead(&DriverReinitListHead);
KeInitializeSpinLock(&DriverReinitListLock);
DriverReinitTailEntry = NULL;
Modified: trunk/reactos/ntoskrnl/io/iomgr/iocomp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iocomp.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iocomp.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iocomp.c Wed Jul 5 02:41:47 2006
@@ -109,26 +109,6 @@
}
} while (FirstEntry != CurrentEntry);
}
-}
-
-VOID
-FASTCALL
-IopInitIoCompletionImplementation(VOID)
-{
- OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
- UNICODE_STRING Name;
-
- /* Initialize the Driver object type */
- RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
- RtlInitUnicodeString(&Name, L"IoCompletion");
- ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
- ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KQUEUE);
- ObjectTypeInitializer.PoolType = NonPagedPool;
- ObjectTypeInitializer.ValidAccessMask = IO_COMPLETION_ALL_ACCESS;
- ObjectTypeInitializer.UseDefaultObject = TRUE;
- ObjectTypeInitializer.GenericMapping = IopCompletionMapping;
- ObjectTypeInitializer.DeleteProcedure = IopDeleteIoCompletion;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoCompletionType);
}
/* PUBLIC FUNCTIONS **********************************************************/
Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c Wed Jul 5 02:41:47 2006
@@ -232,21 +232,14 @@
UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\DosDevices");
HANDLE Handle;
- IopInitDriverImplementation();
-
- DPRINT("Creating Device Object Type\n");
-
- /* Initialize the Driver object type */
+ /* Initialize default settings */
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
- RtlInitUnicodeString(&Name, L"Device");
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
- ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DEVICE_OBJECT);
ObjectTypeInitializer.PoolType = NonPagedPool;
+ ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
ObjectTypeInitializer.ValidAccessMask = FILE_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.GenericMapping = IopFileMapping;
- ObjectTypeInitializer.ParseProcedure = IopParseDevice;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoDeviceObjectType);
/* Do the Adapter Type */
RtlInitUnicodeString(&Name, L"Adapter");
@@ -257,10 +250,37 @@
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(CONTROLLER_OBJECT);
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoControllerObjectType);
+ /* Do the Device Type */
+ RtlInitUnicodeString(&Name, L"Device");
+ ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DEVICE_OBJECT);
+ ObjectTypeInitializer.ParseProcedure = IopParseDevice;
+ ObjectTypeInitializer.SecurityProcedure = IopSecurityFile;
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoDeviceObjectType);
+
+ /* Initialize the Driver object type */
+ RtlInitUnicodeString(&Name, L"Driver");
+ ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DRIVER_OBJECT);
+ ObjectTypeInitializer.DeleteProcedure = IopDeleteDriver;
+ ObjectTypeInitializer.ParseProcedure = NULL;
+ ObjectTypeInitializer.SecurityProcedure = NULL;
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoDriverObjectType);
+
+ /* Initialize the I/O Completion object type */
+ RtlInitUnicodeString(&Name, L"IoCompletion");
+ ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KQUEUE);
+ ObjectTypeInitializer.ValidAccessMask = IO_COMPLETION_ALL_ACCESS;
+ ObjectTypeInitializer.InvalidAttributes |= OBJ_PERMANENT;
+ ObjectTypeInitializer.GenericMapping = IopCompletionMapping;
+ ObjectTypeInitializer.DeleteProcedure = IopDeleteIoCompletion;
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&IoCompletionType);
+
/* Initialize the File object type */
RtlInitUnicodeString(&Name, L"File");
- ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(FILE_OBJECT);
+ ObjectTypeInitializer.InvalidAttributes |= OBJ_EXCLUSIVE;
+ ObjectTypeInitializer.MaintainHandleCount = TRUE;
+ ObjectTypeInitializer.ValidAccessMask = FILE_ALL_ACCESS;
+ ObjectTypeInitializer.GenericMapping = IopFileMapping;
ObjectTypeInitializer.CloseProcedure = IopCloseFile;
ObjectTypeInitializer.DeleteProcedure = IopDeleteFile;
ObjectTypeInitializer.SecurityProcedure = IopSecurityFile;
@@ -341,6 +361,7 @@
/*
* Initialize remaining subsubsystem
*/
+ IopInitDriverImplementation();
IoInitCancelHandling();
IoInitFileSystemImplementation();
IoInitVpbImplementation();
@@ -348,7 +369,6 @@
IopInitPnpNotificationImplementation();
IopInitErrorLog();
IopInitTimerImplementation();
- IopInitIoCompletionImplementation();
IopInitLookasideLists();
/*