00074 :
00075
00076 This routine
is invoked once when
the driver
is loaded to allow
the driver
00077 to initialize itself. The initialization
for the driver consists of simply
00078 creating a device object
for each
type of
file system recognized by
this
00079 driver, and then registering each as active
file systems.
00080
00081 Arguments:
00082
00083 DriverObject - Pointer to
the driver object
for this driver.
00084
00085 RegistryPath - Pointer to
the registry service node
for this driver.
00086
00087 Return Value:
00088
00089 The function value
is the final status of
the initialization
for the driver.
00090
00091 --*/
00092
00093 {
00094
PDEVICE_OBJECT UdfsMainRecognizerDeviceObject;
00095
NTSTATUS status;
00096 ULONG count = 0;
00097
00098
PAGED_CODE();
00099
00100
00101
00102
00103
00104
MmPageEntireDriver ((PVOID)DriverEntry);
00105
00106
00107
00108
00109
00110
00111 DriverObject->MajorFunction[
IRP_MJ_FILE_SYSTEM_CONTROL] =
FsRecFsControl;
00112 DriverObject->MajorFunction[
IRP_MJ_CREATE] =
FsRecCreate;
00113 DriverObject->MajorFunction[
IRP_MJ_CLEANUP] =
FsRecCleanupClose;
00114 DriverObject->MajorFunction[
IRP_MJ_CLOSE] =
FsRecCleanupClose;
00115 DriverObject->DriverUnload =
FsRecUnload;
00116
00117
FsRecLoadSync =
ExAllocatePoolWithTag( NonPagedPool,
sizeof(
KEVENT), FSREC_POOL_TAG );
00118
00119
if (
FsRecLoadSync ==
NULL) {
00120
00121
return STATUS_INSUFFICIENT_RESOURCES;
00122 }
00123
00124
KeInitializeEvent( FsRecLoadSync, SynchronizationEvent, TRUE );
00125
00126
00127
00128
00129
00130
00131 status =
FsRecCreateAndRegisterDO( DriverObject,
00132 NULL,
00133 NULL,
00134 L
"\\Cdfs",
00135 L
"\\FileSystem\\CdfsRecognizer",
00136 CdfsFileSystem,
00137 FILE_DEVICE_CD_ROM_FILE_SYSTEM );
00138
if (
NT_SUCCESS( status )) {
00139 count++;
00140 }
00141
00142 status =
FsRecCreateAndRegisterDO( DriverObject,
00143 NULL,
00144 &UdfsMainRecognizerDeviceObject,
00145 L
"\\UdfsCdRom",
00146 L
"\\FileSystem\\UdfsCdRomRecognizer",
00147 UdfsFileSystem,
00148 FILE_DEVICE_CD_ROM_FILE_SYSTEM );
00149
if (
NT_SUCCESS( status )) {
00150 count++;
00151 }
00152
00153 status =
FsRecCreateAndRegisterDO( DriverObject,
00154 UdfsMainRecognizerDeviceObject,
00155 NULL,
00156 L
"\\UdfsDisk",
00157 L
"\\FileSystem\\UdfsDiskRecognizer",
00158 UdfsFileSystem,
00159 FILE_DEVICE_DISK_FILE_SYSTEM );
00160
if (
NT_SUCCESS( status )) {
00161 count++;
00162 }
00163
00164 status =
FsRecCreateAndRegisterDO( DriverObject,
00165 NULL,
00166 NULL,
00167 L
"\\Fat",
00168 L
"\\FileSystem\\FatRecognizer",
00169 FatFileSystem,
00170 FILE_DEVICE_DISK_FILE_SYSTEM );
00171
if (
NT_SUCCESS( status )) {
00172 count++;
00173 }
00174
00175 status =
FsRecCreateAndRegisterDO( DriverObject,
00176 NULL,
00177 NULL,
00178 L
"\\Ntfs",
00179 L
"\\FileSystem\\NtfsRecognizer",
00180 NtfsFileSystem,
00181 FILE_DEVICE_DISK_FILE_SYSTEM );
00182
if (
NT_SUCCESS( status )) {
00183 count++;
00184 }
00185
00186
if (count) {
00187
return STATUS_SUCCESS;
00188 }
else {
00189
return STATUS_IMAGE_ALREADY_LOADED;
00190 }
00191 }