All:
[reactos.git] / reactos / drivers / fs / vfat / iface.c
1 /* $Id: iface.c,v 1.62 2002/03/18 22:37:12 hbirr Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: services/fs/vfat/iface.c
6 * PURPOSE: VFAT Filesystem
7 * PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
8 * UPDATE HISTORY:
9 * ?? Created
10 * 24-10-1998 Fixed bugs in long filename support
11 * Fixed a bug that prevented unsuccessful file open requests
12 * being reported
13 * Now works with long filenames that span over a sector
14 * boundary
15 * 28-10-1998 Reads entire FAT into memory
16 * VFatReadSector modified to read in more than one sector at a
17 * time
18 * 7-11-1998 Fixed bug that assumed that directory data could be
19 * fragmented
20 * 8-12-1998 Added FAT32 support
21 * Added initial writability functions
22 * WARNING: DO NOT ATTEMPT TO TEST WRITABILITY FUNCTIONS!!!
23 * 12-12-1998 Added basic support for FILE_STANDARD_INFORMATION request
24 *
25 */
26
27 /* INCLUDES *****************************************************************/
28
29 #include <ddk/ntddk.h>
30
31 #define NDEBUG
32 #include <debug.h>
33
34 #include "vfat.h"
35
36 /* GLOBALS *****************************************************************/
37
38
39 PVFAT_GLOBAL_DATA VfatGlobalData;
40
41 /* FUNCTIONS ****************************************************************/
42
43 NTSTATUS STDCALL
44 DriverEntry(PDRIVER_OBJECT DriverObject,
45 PUNICODE_STRING RegistryPath)
46 /*
47 * FUNCTION: Called by the system to initalize the driver
48 * ARGUMENTS:
49 * DriverObject = object describing this driver
50 * RegistryPath = path to our configuration entries
51 * RETURNS: Success or failure
52 */
53 {
54 PDEVICE_OBJECT DeviceObject;
55 UNICODE_STRING DeviceName;
56 NTSTATUS Status;
57
58 DPRINT("VFAT 0.0.6\n");
59
60 RtlInitUnicodeString(&DeviceName,
61 L"\\Device\\Vfat");
62 Status = IoCreateDevice(DriverObject,
63 sizeof(VFAT_GLOBAL_DATA),
64 &DeviceName,
65 FILE_DEVICE_DISK_FILE_SYSTEM,
66 0,
67 FALSE,
68 &DeviceObject);
69 if (!NT_SUCCESS(Status))
70 {
71 return (Status);
72 }
73 VfatGlobalData = DeviceObject->DeviceExtension;
74 RtlZeroMemory (VfatGlobalData, sizeof(VFAT_GLOBAL_DATA));
75 VfatGlobalData->DriverObject = DriverObject;
76 VfatGlobalData->DeviceObject = DeviceObject;
77
78 DeviceObject->Flags = DO_DIRECT_IO;
79 DriverObject->MajorFunction[IRP_MJ_CLOSE] = VfatBuildRequest;
80 DriverObject->MajorFunction[IRP_MJ_CREATE] = VfatBuildRequest;
81 DriverObject->MajorFunction[IRP_MJ_READ] = VfatBuildRequest;
82 DriverObject->MajorFunction[IRP_MJ_WRITE] = VfatBuildRequest;
83 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = VfatBuildRequest;
84 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = VfatBuildRequest;
85 DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = VfatBuildRequest;
86 DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = VfatBuildRequest;
87 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = VfatBuildRequest;
88 DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = VfatBuildRequest;
89 DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = VfatShutdown;
90 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = VfatBuildRequest;
91
92 DriverObject->DriverUnload = NULL;
93
94 IoRegisterFileSystem(DeviceObject);
95 return STATUS_SUCCESS;
96 }
97
98 /* EOF */
99