2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/io/iomgr.c
5 * PURPOSE: Initializes the io manager
6 * PROGRAMMER: David Welch (welch@mcmail.com)
11 /* INCLUDES ****************************************************************/
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/io.h>
19 #include <internal/debug.h>
21 /* GLOBALS *******************************************************************/
23 POBJECT_TYPE IoDeviceType
= NULL
;
24 POBJECT_TYPE IoFileType
= NULL
;
27 /* FUNCTIONS ****************************************************************/
29 VOID
IopCloseFile(PVOID ObjectBody
)
31 PFILE_OBJECT FileObject
= (PFILE_OBJECT
)ObjectBody
;
33 if (FileObject
->FileName
.Buffer
!= NULL
)
35 ExFreePool(FileObject
->FileName
.Buffer
);
41 OBJECT_ATTRIBUTES attr
;
43 UNICODE_STRING UnicodeString
;
44 ANSI_STRING AnsiString
;
47 * Register iomgr types
49 IoDeviceType
= ExAllocatePool(NonPagedPool
,sizeof(OBJECT_TYPE
));
51 IoDeviceType
->TotalObjects
= 0;
52 IoDeviceType
->TotalHandles
= 0;
53 IoDeviceType
->MaxObjects
= ULONG_MAX
;
54 IoDeviceType
->MaxHandles
= ULONG_MAX
;
55 IoDeviceType
->PagedPoolCharge
= 0;
56 IoDeviceType
->NonpagedPoolCharge
= sizeof(DEVICE_OBJECT
);
57 IoDeviceType
->Dump
= NULL
;
58 IoDeviceType
->Open
= NULL
;
59 IoDeviceType
->Close
= NULL
;
60 IoDeviceType
->Delete
= NULL
;
61 IoDeviceType
->Parse
= NULL
;
62 IoDeviceType
->Security
= NULL
;
63 IoDeviceType
->QueryName
= NULL
;
64 IoDeviceType
->OkayToClose
= NULL
;
66 RtlInitAnsiString(&AnsiString
,"Device");
67 RtlAnsiStringToUnicodeString(&IoDeviceType
->TypeName
,&AnsiString
,TRUE
);
69 IoFileType
= ExAllocatePool(NonPagedPool
,sizeof(OBJECT_TYPE
));
71 IoFileType
->TotalObjects
= 0;
72 IoFileType
->TotalHandles
= 0;
73 IoFileType
->MaxObjects
= ULONG_MAX
;
74 IoFileType
->MaxHandles
= ULONG_MAX
;
75 IoFileType
->PagedPoolCharge
= 0;
76 IoFileType
->NonpagedPoolCharge
= sizeof(FILE_OBJECT
);
77 IoFileType
->Dump
= NULL
;
78 IoFileType
->Open
= NULL
;
79 IoFileType
->Close
= IopCloseFile
;
80 IoFileType
->Delete
= NULL
;
81 IoFileType
->Parse
= NULL
;
82 IoFileType
->Security
= NULL
;
83 IoFileType
->QueryName
= NULL
;
84 IoFileType
->OkayToClose
= NULL
;
86 RtlInitAnsiString(&AnsiString
,"File");
87 RtlAnsiStringToUnicodeString(&IoFileType
->TypeName
,&AnsiString
,TRUE
);
90 * Create the device directory
92 RtlInitAnsiString(&AnsiString
,"\\Device");
93 RtlAnsiStringToUnicodeString(&UnicodeString
,&AnsiString
,TRUE
);
94 InitializeObjectAttributes(&attr
,&UnicodeString
,0,NULL
,NULL
);
95 ZwCreateDirectoryObject(&handle
,0,&attr
);
97 RtlInitAnsiString(&AnsiString
,"\\??");
98 RtlAnsiStringToUnicodeString(&UnicodeString
,&AnsiString
,TRUE
);
99 InitializeObjectAttributes(&attr
,&UnicodeString
,0,NULL
,NULL
);
100 ZwCreateDirectoryObject(&handle
,0,&attr
);
102 IoInitCancelHandling();
103 IoInitSymbolicLinkImplementation();
104 IoInitFileSystemImplementation();