ReactOS  0.4.15-dev-3165-gdf6fff7
iface.c File Reference
#include "vfat.h"
#include <debug.h>
Include dependency graph for iface.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 

Variables

PVFAT_GLOBAL_DATA VfatGlobalData
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 31 of file iface.c.

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( IN PDRIVER_OBJECT  DriverObject,
IN PUNICODE_STRING  RegistryPath 
)

Definition at line 50 of file iface.c.

53 {
57 
59 
61  sizeof(VFAT_GLOBAL_DATA),
62  &DeviceName,
64  0,
65  FALSE,
66  &DeviceObject);
69  {
70  /* Try an other name, if 'Fat' is already in use. 'Fat' is also used by fastfat.sys on W2K */
71  RtlInitUnicodeString(&DeviceName, L"\\RosFat");
73  sizeof(VFAT_GLOBAL_DATA),
74  &DeviceName,
76  0,
77  FALSE,
78  &DeviceObject);
79  }
80 
81  if (!NT_SUCCESS(Status))
82  {
83  return Status;
84  }
85 
86  VfatGlobalData = DeviceObject->DeviceExtension;
91  /* Enable this to enter the debugger when file system corruption
92  * has been detected:
93  VfatGlobalData->Flags = VFAT_BREAK_ON_CORRUPTION; */
94 
95  /* Delayed close support */
103  {
106  }
107 
108  DeviceObject->Flags |= DO_DIRECT_IO;
109  DriverObject->MajorFunction[IRP_MJ_CLOSE] = VfatBuildRequest;
110  DriverObject->MajorFunction[IRP_MJ_CREATE] = VfatBuildRequest;
111  DriverObject->MajorFunction[IRP_MJ_READ] = VfatBuildRequest;
112  DriverObject->MajorFunction[IRP_MJ_WRITE] = VfatBuildRequest;
119  DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = VfatShutdown;
122  DriverObject->MajorFunction[IRP_MJ_CLEANUP] = VfatBuildRequest;
124  DriverObject->MajorFunction[IRP_MJ_PNP] = VfatBuildRequest;
125 
126  DriverObject->DriverUnload = NULL;
127 
128  /* Cache manager */
133 
134  /* Fast I/O */
136  DriverObject->FastIoDispatch = &VfatGlobalData->FastIoDispatch;
137 
138  /* Private lists */
140  NULL, NULL, 0, sizeof(VFATFCB), TAG_FCB, 0);
142  NULL, NULL, 0, sizeof(VFATCCB), TAG_CCB, 0);
144  NULL, NULL, 0, sizeof(VFAT_IRP_CONTEXT), TAG_IRP, 0);
146  NULL, NULL, 0, sizeof(VFAT_CLOSE_CONTEXT), TAG_CLOSE, 0);
147 
151 
152 #ifdef KDBG
153  {
154  BOOLEAN Registered;
155 
156  Registered = KdRosRegisterCliCallback(vfatKdbgHandler);
157  DPRINT1("FastFAT KDBG extension registered: %s\n", (Registered ? "yes" : "no"));
158  }
159 #endif
160 
161  return STATUS_SUCCESS;
162 }
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define TAG_FCB
Definition: vfat.h:547
LIST_ENTRY VolumeListHead
Definition: vfat.h:416
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
VOID NTAPI ExInitializePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
Definition: lookas.c:270
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
FAST_MUTEX CloseMutex
Definition: vfat.h:423
#define IRP_MJ_FLUSH_BUFFERS
Definition: vfat.h:447
Definition: vfat.h:536
#define IRP_MJ_SHUTDOWN
NPAGED_LOOKASIDE_LIST FcbLookasideList
Definition: vfat.h:417
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
PDRIVER_OBJECT DriverObject
Definition: vfat.h:411
VOID NTAPI VfatReleaseFromLazyWrite(IN PVOID Context)
Definition: fastio.c:742
#define TAG_IRP
Definition: vfat.h:548
PIO_WORKITEM CloseWorkItem
Definition: vfat.h:427
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define STATUS_OBJECT_NAME_EXISTS
Definition: ntstatus.h:114
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
#define IRP_MJ_SET_VOLUME_INFORMATION
FAST_IO_DISPATCH FastIoDispatch
Definition: vfat.h:421
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
NPAGED_LOOKASIDE_LIST IrpContextLookasideList
Definition: vfat.h:419
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
DRIVER_DISPATCH VfatBuildRequest
Definition: vfat.h:1147
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
#define TAG_CLOSE
Definition: vfat.h:549
ULONG NumberProcessors
Definition: vfat.h:414
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
NPAGED_LOOKASIDE_LIST CcbLookasideList
Definition: vfat.h:418
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:114
VOID VfatInitFastIoRoutines(PFAST_IO_DISPATCH FastIoDispatch)
Definition: fastio.c:754
Status
Definition: gdiplustypes.h:24
PDEVICE_OBJECT DeviceObject
Definition: vfat.h:412
VOID NTAPI ExInitializeNPagedLookasideList(IN PNPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
Definition: lookas.c:218
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MJ_FILE_SYSTEM_CONTROL
BOOLEAN NTAPI VfatAcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: fastio.c:724
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite
Definition: cctypes.h:39
#define TAG_CCB
Definition: cdprocs.h:85
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
PVFAT_GLOBAL_DATA VfatGlobalData
Definition: iface.c:36
CACHE_MANAGER_CALLBACKS CacheMgrCallbacks
Definition: vfat.h:422
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
BOOLEAN ShutdownStarted
Definition: vfat.h:428
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NULL
Definition: types.h:112
LIST_ENTRY CloseListHead
Definition: vfat.h:425
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
BOOLEAN CloseWorkerRunning
Definition: vfat.h:426
#define DPRINT1
Definition: precomp.h:8
#define IRP_MJ_READ
Definition: rdpdr.c:46
ERESOURCE VolumeListLock
Definition: vfat.h:415
VOID NTAPI IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
Definition: volume.c:987
#define IRP_MJ_CLEANUP
PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite
Definition: cctypes.h:40
ULONG CloseCount
Definition: vfat.h:424
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define STATUS_SUCCESS
Definition: shellext.h:65
PAGED_LOOKASIDE_LIST CloseContextLookasideList
Definition: vfat.h:420
DRIVER_DISPATCH VfatShutdown
Definition: vfat.h:1210
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Variable Documentation

◆ VfatGlobalData