This commit was generated by cvs2svn to compensate for changes in r52,
[reactos.git] / reactos / ntoskrnl / io / iomgr.c
1 /*
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)
7 * REVISION HISTORY:
8 * 29/07/98: Created
9 */
10
11 /* INCLUDES ****************************************************************/
12
13 #include <windows.h>
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/io.h>
17
18 #define NDEBUG
19 #include <internal/debug.h>
20
21 /* GLOBALS *******************************************************************/
22
23 POBJECT_TYPE IoDeviceType = NULL;
24 POBJECT_TYPE IoFileType = NULL;
25
26
27 /* FUNCTIONS ****************************************************************/
28
29 VOID IoInit(VOID)
30 {
31 OBJECT_ATTRIBUTES attr;
32 HANDLE handle;
33 UNICODE_STRING UnicodeString;
34 ANSI_STRING AnsiString;
35
36 /*
37 * Register iomgr types
38 */
39 IoDeviceType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
40
41 IoDeviceType->TotalObjects = 0;
42 IoDeviceType->TotalHandles = 0;
43 IoDeviceType->MaxObjects = ULONG_MAX;
44 IoDeviceType->MaxHandles = ULONG_MAX;
45 IoDeviceType->PagedPoolCharge = 0;
46 IoDeviceType->NonpagedPoolCharge = sizeof(DEVICE_OBJECT);
47 IoDeviceType->Dump = NULL;
48 IoDeviceType->Open = NULL;
49 IoDeviceType->Close = NULL;
50 IoDeviceType->Delete = NULL;
51 IoDeviceType->Parse = NULL;
52 IoDeviceType->Security = NULL;
53 IoDeviceType->QueryName = NULL;
54 IoDeviceType->OkayToClose = NULL;
55
56 RtlInitAnsiString(&AnsiString,"Device");
57 RtlAnsiStringToUnicodeString(&IoDeviceType->TypeName,&AnsiString,TRUE);
58
59 IoFileType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
60
61 IoFileType->TotalObjects = 0;
62 IoFileType->TotalHandles = 0;
63 IoFileType->MaxObjects = ULONG_MAX;
64 IoFileType->MaxHandles = ULONG_MAX;
65 IoFileType->PagedPoolCharge = 0;
66 IoFileType->NonpagedPoolCharge = sizeof(FILE_OBJECT);
67 IoFileType->Dump = NULL;
68 IoFileType->Open = NULL;
69 IoFileType->Close = NULL;
70 IoFileType->Delete = NULL;
71 IoFileType->Parse = NULL;
72 IoFileType->Security = NULL;
73 IoFileType->QueryName = NULL;
74 IoFileType->OkayToClose = NULL;
75
76 RtlInitAnsiString(&AnsiString,"File");
77 RtlAnsiStringToUnicodeString(&IoFileType->TypeName,&AnsiString,TRUE);
78
79 /*
80 * Create the device directory
81 */
82 RtlInitAnsiString(&AnsiString,"\\Device");
83 RtlAnsiStringToUnicodeString(&UnicodeString,&AnsiString,TRUE);
84 InitializeObjectAttributes(&attr,&UnicodeString,0,NULL,NULL);
85 ZwCreateDirectoryObject(&handle,0,&attr);
86
87 RtlInitAnsiString(&AnsiString,"\\??");
88 RtlAnsiStringToUnicodeString(&UnicodeString,&AnsiString,TRUE);
89 InitializeObjectAttributes(&attr,&UnicodeString,0,NULL,NULL);
90 ZwCreateDirectoryObject(&handle,0,&attr);
91
92 IoInitCancelHandling();
93 IoInitSymbolicLinkImplementation();
94 IoInitFileSystemImplementation();
95 }