494eb3960713e4fe6261b931a154c6b1fda63b42
[reactos.git] / reactos / drivers / fs / cdfs / cdfs.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2002 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: cdfs.c,v 1.5 2002/05/15 18:01:30 ekohl Exp $
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: services/fs/cdfs/cdfs.c
24 * PURPOSE: CDROM (ISO 9660) filesystem driver
25 * PROGRAMMER: Art Yerkes
26 * UPDATE HISTORY:
27 */
28
29 /* INCLUDES *****************************************************************/
30
31 #include <ddk/ntddk.h>
32
33 #define NDEBUG
34 #include <debug.h>
35
36 #include "cdfs.h"
37
38
39 /* GLOBALS *****************************************************************/
40
41 PCDFS_GLOBAL_DATA CdfsGlobalData;
42
43
44 /* FUNCTIONS ****************************************************************/
45
46 NTSTATUS STDCALL
47 DriverEntry(PDRIVER_OBJECT DriverObject,
48 PUNICODE_STRING RegistryPath)
49 /*
50 * FUNCTION: Called by the system to initalize the driver
51 * ARGUMENTS:
52 * DriverObject = object describing this driver
53 * RegistryPath = path to our configuration entries
54 * RETURNS: Success or failure
55 */
56 {
57 PDEVICE_OBJECT DeviceObject;
58 NTSTATUS Status;
59 UNICODE_STRING DeviceName;
60
61 DPRINT("CDFS 0.0.2\n");
62
63 RtlInitUnicodeString(&DeviceName,
64 L"\\Cdfs");
65 Status = IoCreateDevice(DriverObject,
66 sizeof(CDFS_GLOBAL_DATA),
67 &DeviceName,
68 FILE_DEVICE_CD_ROM_FILE_SYSTEM,
69 0,
70 FALSE,
71 &DeviceObject);
72 if (!NT_SUCCESS(Status))
73 {
74 return(Status);
75 }
76
77 /* Initialize global data */
78 CdfsGlobalData = DeviceObject->DeviceExtension;
79 RtlZeroMemory(CdfsGlobalData,
80 sizeof(CDFS_GLOBAL_DATA));
81 CdfsGlobalData->DriverObject = DriverObject;
82 CdfsGlobalData->DeviceObject = DeviceObject;
83
84 /* Initialize driver data */
85 DeviceObject->Flags = DO_DIRECT_IO;
86 DriverObject->MajorFunction[IRP_MJ_CLOSE] = CdfsClose;
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_QUERY_VOLUME_INFORMATION] =
97 CdfsQueryVolumeInformation;
98 DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] =
99 CdfsSetVolumeInformation;
100
101 DriverObject->DriverUnload = NULL;
102
103 IoRegisterFileSystem(DeviceObject);
104
105 return(STATUS_SUCCESS);
106 }
107