migrate substitution keywords to SVN
[reactos.git] / reactos / drivers / fs / cdfs / cdfs.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2002, 2003 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id$
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: drivers/fs/cdfs/cdfs.c
24 * PURPOSE: CDROM (ISO 9660) filesystem driver
25 * PROGRAMMER: Art Yerkes
26 * Eric Kohl
27 */
28
29 /* INCLUDES *****************************************************************/
30
31 #include <ddk/ntddk.h>
32 #include <rosrtl/string.h>
33
34 #define NDEBUG
35 #include <debug.h>
36
37 #include "cdfs.h"
38
39
40 /* GLOBALS *****************************************************************/
41
42 PCDFS_GLOBAL_DATA CdfsGlobalData;
43
44
45 /* FUNCTIONS ****************************************************************/
46
47 NTSTATUS STDCALL
48 DriverEntry(PDRIVER_OBJECT DriverObject,
49 PUNICODE_STRING RegistryPath)
50 /*
51 * FUNCTION: Called by the system to initalize the driver
52 * ARGUMENTS:
53 * DriverObject = object describing this driver
54 * RegistryPath = path to our configuration entries
55 * RETURNS: Success or failure
56 */
57 {
58 PDEVICE_OBJECT DeviceObject;
59 NTSTATUS Status;
60 UNICODE_STRING DeviceName = ROS_STRING_INITIALIZER(L"\\Cdfs");
61
62 DPRINT("CDFS 0.0.3\n");
63
64 Status = IoCreateDevice(DriverObject,
65 sizeof(CDFS_GLOBAL_DATA),
66 &DeviceName,
67 FILE_DEVICE_CD_ROM_FILE_SYSTEM,
68 0,
69 FALSE,
70 &DeviceObject);
71 if (!NT_SUCCESS(Status))
72 {
73 return(Status);
74 }
75
76 /* Initialize global data */
77 CdfsGlobalData = DeviceObject->DeviceExtension;
78 RtlZeroMemory(CdfsGlobalData,
79 sizeof(CDFS_GLOBAL_DATA));
80 CdfsGlobalData->DriverObject = DriverObject;
81 CdfsGlobalData->DeviceObject = DeviceObject;
82
83 /* Initialize driver data */
84 DeviceObject->Flags = DO_DIRECT_IO;
85 DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose;
86 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = CdfsCleanup;
87 DriverObject->MajorFunction[IRP_MJ_CREATE] = CdfsCreate;
88 DriverObject->MajorFunction[IRP_MJ_READ] = CdfsRead;
89 DriverObject->MajorFunction[IRP_MJ_WRITE] = CdfsWrite;
90 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
91 CdfsFileSystemControl;
92 DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
93 CdfsDirectoryControl;
94 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
95 CdfsQueryInformation;
96 DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
97 CdfsSetInformation;
98 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
99 CdfsQueryVolumeInformation;
100 DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] =
101 CdfsSetVolumeInformation;
102
103 DriverObject->DriverUnload = NULL;
104
105 IoRegisterFileSystem(DeviceObject);
106
107 return(STATUS_SUCCESS);
108 }
109