merge ROS Shell without integrated explorer part into trunk
[reactos.git] / reactos / drivers / fs / ntfs / ntfs.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$
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: services/fs/ntfs/ntfs.c
24 * PURPOSE: NTFS filesystem driver
25 * PROGRAMMER: Eric Kohl
26 */
27
28 /* INCLUDES *****************************************************************/
29
30 #include <ddk/ntddk.h>
31 #include <rosrtl/string.h>
32
33 #define NDEBUG
34 #include <debug.h>
35
36 #include "ntfs.h"
37
38
39 /* GLOBALS *****************************************************************/
40
41 PNTFS_GLOBAL_DATA NtfsGlobalData;
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 = ROS_STRING_INITIALIZER(L"\\Ntfs");
60
61 DPRINT("NTFS 0.0.1\n");
62
63 Status = IoCreateDevice(DriverObject,
64 sizeof(NTFS_GLOBAL_DATA),
65 &DeviceName,
66 FILE_DEVICE_DISK_FILE_SYSTEM,
67 0,
68 FALSE,
69 &DeviceObject);
70 if (!NT_SUCCESS(Status))
71 {
72 return(Status);
73 }
74
75 /* Initialize global data */
76 NtfsGlobalData = DeviceObject->DeviceExtension;
77 RtlZeroMemory(NtfsGlobalData,
78 sizeof(NTFS_GLOBAL_DATA));
79 NtfsGlobalData->DriverObject = DriverObject;
80 NtfsGlobalData->DeviceObject = DeviceObject;
81
82 /* Initialize driver data */
83 DeviceObject->Flags = DO_DIRECT_IO;
84 DriverObject->MajorFunction[IRP_MJ_CLOSE] = NtfsClose;
85 DriverObject->MajorFunction[IRP_MJ_CREATE] = NtfsCreate;
86 DriverObject->MajorFunction[IRP_MJ_READ] = NtfsRead;
87 DriverObject->MajorFunction[IRP_MJ_WRITE] = NtfsWrite;
88 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
89 NtfsFileSystemControl;
90 DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
91 NtfsDirectoryControl;
92 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
93 NtfsQueryInformation;
94 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] =
95 NtfsQueryVolumeInformation;
96 DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] =
97 NtfsSetVolumeInformation;
98
99 DriverObject->DriverUnload = NULL;
100
101 IoRegisterFileSystem(DeviceObject);
102
103 return(STATUS_SUCCESS);
104 }
105