ReactOS  0.4.14-dev-1233-gf5658fd
fatinit.c File Reference
#include "fatprocs.h"
Include dependency graph for fatinit.c:

Go to the source code of this file.

Macros

#define COMPATIBILITY_MODE_KEY_NAME   L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\FileSystem"
 
#define COMPATIBILITY_MODE_VALUE_NAME   L"Win31FileSystem"
 
#define CODE_PAGE_INVARIANCE_VALUE_NAME   L"FatDisableCodePageInvariance"
 
#define KEY_WORK_AREA
 
#define REGISTRY_HARDWARE_DESCRIPTION_W   L"\\Registry\\Machine\\Hardware\\DESCRIPTION\\System"
 
#define REGISTRY_MACHINE_IDENTIFIER_W   L"Identifier"
 
#define FUJITSU_FMR_NAME_W   L"FUJITSU FMR-"
 

Functions

NTSTATUS NTAPI DriverEntry (_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
 
 _Function_class_ (DRIVER_UNLOAD)
 
NTSTATUS FatGetCompatibilityModeValue (IN PUNICODE_STRING ValueName, IN OUT PULONG Value)
 
BOOLEAN FatIsFujitsuFMR ()
 

Variables

DRIVER_INITIALIZE DriverEntry
 

Macro Definition Documentation

◆ CODE_PAGE_INVARIANCE_VALUE_NAME

#define CODE_PAGE_INVARIANCE_VALUE_NAME   L"FatDisableCodePageInvariance"

◆ COMPATIBILITY_MODE_KEY_NAME

#define COMPATIBILITY_MODE_KEY_NAME   L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\FileSystem"

◆ COMPATIBILITY_MODE_VALUE_NAME

#define COMPATIBILITY_MODE_VALUE_NAME   L"Win31FileSystem"

◆ FUJITSU_FMR_NAME_W

#define FUJITSU_FMR_NAME_W   L"FUJITSU FMR-"

◆ KEY_WORK_AREA

#define KEY_WORK_AREA
Value:
sizeof(ULONG)) + 64)
struct _KEY_VALUE_FULL_INFORMATION KEY_VALUE_FULL_INFORMATION
unsigned int ULONG
Definition: retypes.h:1

◆ REGISTRY_HARDWARE_DESCRIPTION_W

#define REGISTRY_HARDWARE_DESCRIPTION_W   L"\\Registry\\Machine\\Hardware\\DESCRIPTION\\System"

◆ REGISTRY_MACHINE_IDENTIFIER_W

#define REGISTRY_MACHINE_IDENTIFIER_W   L"Identifier"

Function Documentation

◆ _Function_class_()

_Function_class_ ( DRIVER_UNLOAD  )

Definition at line 31 of file fatinit.c.

98 {
102  FS_FILTER_CALLBACKS FilterCallbacks;
104  ULONG Value;
105 
107 
108  //
109  // Create the device object for disks. To avoid problems with filters who
110  // know this name, we must keep it.
111  //
112 
115  0,
116  &UnicodeString,
118  0,
119  FALSE,
121 
122  if (!NT_SUCCESS( Status )) {
123  return Status;
124  }
125 
126  //
127  // Create the device object for "cdroms".
128  //
129 
130  RtlInitUnicodeString( &UnicodeString, L"\\FatCdrom" );
132  0,
133  &UnicodeString,
135  0,
136  FALSE,
138 
139  if (!NT_SUCCESS( Status )) {
141  return Status;
142  }
143 
144 #ifdef _MSC_VER
145 #pragma prefast( push )
146 #pragma prefast( disable:28155, "these are all correct" )
147 #pragma prefast( disable:28169, "these are all correct" )
148 #pragma prefast( disable:28175, "this is a filesystem, touching FastIoDispatch is allowed" )
149 #endif
150 
151  DriverObject->DriverUnload = FatUnload;
152 
153  //
154  // Note that because of the way data caching is done, we set neither
155  // the Direct I/O or Buffered I/O bit in DeviceObject->Flags. If
156  // data is not in the cache, or the request is not buffered, we may,
157  // set up for Direct I/O by hand.
158  //
159 
160  //
161  // Initialize the driver object with this driver's entry points.
162  //
163 
182 
184 
186 
188  FatFastIoDispatch.FastIoCheckIfPossible = FatFastIoCheckIfPossible; // CheckForFastIo
191  FatFastIoDispatch.FastIoQueryBasicInfo = FatFastQueryBasicInfo; // QueryBasicInfo
192  FatFastIoDispatch.FastIoQueryStandardInfo = FatFastQueryStdInfo; // QueryStandardInfo
193  FatFastIoDispatch.FastIoLock = FatFastLock; // Lock
194  FatFastIoDispatch.FastIoUnlockSingle = FatFastUnlockSingle; // UnlockSingle
195  FatFastIoDispatch.FastIoUnlockAll = FatFastUnlockAll; // UnlockAll
196  FatFastIoDispatch.FastIoUnlockAllByKey = FatFastUnlockAllByKey; // UnlockAllByKey
197  FatFastIoDispatch.FastIoQueryNetworkOpenInfo = FatFastQueryNetworkOpenInfo;
198  FatFastIoDispatch.AcquireForCcFlush = FatAcquireForCcFlush;
199  FatFastIoDispatch.ReleaseForCcFlush = FatReleaseForCcFlush;
204 
205 #ifdef _MSC_VER
206 #pragma prefast( pop )
207 #endif
208 
209  //
210  // Initialize the filter callbacks we use.
211  //
212 
213  RtlZeroMemory( &FilterCallbacks,
214  sizeof(FS_FILTER_CALLBACKS) );
215 
216  FilterCallbacks.SizeOfFsFilterCallbacks = sizeof(FS_FILTER_CALLBACKS);
217  FilterCallbacks.PreAcquireForSectionSynchronization = FatFilterCallbackAcquireForCreateSection;
218 
220  &FilterCallbacks );
221 
222  if (!NT_SUCCESS( Status )) {
223 
226  return Status;
227  }
228 
229  //
230  // Initialize the global data structures
231  //
232 
233  //
234  // The FatData record
235  //
236 
237  RtlZeroMemory( &FatData, sizeof(FAT_DATA));
238 
240  FatData.NodeByteSize = sizeof(FAT_DATA);
241 
243 
247 
248  //
249  // This list head keeps track of closes yet to be done.
250  //
251 
254 
256 
257  if (FatData.FatCloseItem == NULL) {
261  }
262 
263  //
264  // Allocate the zero page
265  //
266 
267 #ifndef __REACTOS__
268  FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' );
269 #else
271 #endif
272  if (FatData.ZeroPage == NULL) {
276  }
278 
279 
280  //
281  // Now initialize our general purpose spinlock (gag) and figure out how
282  // deep and wide we want our delayed lists (along with fooling ourselves
283  // about the lookaside depths).
284  //
285 
287 
288  switch ( MmQuerySystemSize() ) {
289 
290  case MmSmallSystem:
291 
292  MaxDepth = 4;
294  break;
295 
296  case MmMediumSystem:
297 
298  MaxDepth = 8;
300  break;
301 
302  case MmLargeSystem:
303  default:
304 
305  MaxDepth = 16;
307  break;
308  }
309 
310 
311  //
312  // Initialize the cache manager callback routines
313  //
314 
315  FatData.CacheManagerCallbacks.AcquireForLazyWrite = &FatAcquireFcbForLazyWrite;
316  FatData.CacheManagerCallbacks.ReleaseFromLazyWrite = &FatReleaseFcbFromLazyWrite;
317  FatData.CacheManagerCallbacks.AcquireForReadAhead = &FatAcquireFcbForReadAhead;
318  FatData.CacheManagerCallbacks.ReleaseFromReadAhead = &FatReleaseFcbFromReadAhead;
319 
324 
325  //
326  // Set up global pointer to our process.
327  //
328 
330 
331  //
332  // Setup the number of processors we support for statistics as the current number
333  // running.
334  //
335 
336 #if (NTDDI_VERSION >= NTDDI_VISTA)
338 #else
340 #endif
341 
342 
343  //
344  // Read the registry to determine if we are in ChicagoMode.
345  //
346 
350 
352 
353  if (NT_SUCCESS(Status) && FlagOn(Value, 1)) {
354 
356 
357  } else {
358 
360  }
361 
362  //
363  // Read the registry to determine if we are going to generate LFNs
364  // for valid 8.3 names with extended characters.
365  //
366 
370 
372 
373  if (NT_SUCCESS(Status) && FlagOn(Value, 1)) {
374 
376 
377  } else {
378 
380  }
381 
382  //
383  // Initialize our global resource and fire up the lookaside lists.
384  //
385 
387 
389  NULL,
390  NULL,
391 #ifndef __REACTOS__
392  POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE,
393 #else
395 #endif
396  sizeof(IRP_CONTEXT),
398  MaxDepth );
399 
401  NULL,
402  NULL,
403 #ifndef __REACTOS__
404  POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE,
405 #else
407 #endif
408  sizeof(NON_PAGED_FCB),
410  MaxDepth );
411 
413  NULL,
414  NULL,
415 #ifndef __REACTOS__
416  POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE,
417 #else
419 #endif
420  sizeof(ERESOURCE),
422  MaxDepth );
423 
427 
428  //
429  // Register the file system with the I/O system
430  //
431 
436 
437  //
438  // Find out if we are running an a FujitsuFMR machine.
439  //
440 
442 
443 #if (NTDDI_VERSION >= NTDDI_WIN8)
444 
445  //
446  // Find out global disk accounting state, cache the result
447  //
448 
449  FatDiskAccountingEnabled = PsIsDiskCountersEnabled();
450 
451 #endif
452 
453  //
454  // And return to our caller
455  //
456 
457  return( STATUS_SUCCESS );
458 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2374
#define TAG_FCB_NONPAGED
Definition: cdprocs.h:83
NODE_TYPE_CODE NodeTypeCode
Definition: fatstruc.h:37
PIO_WORKITEM FatCloseItem
Definition: fatstruc.h:144
PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle
Definition: iotypes.h:1697
#define TRUE
Definition: types.h:120
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
PVOID CdromFileSystemDeviceObject
Definition: fatstruc.h:61
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PVOID ZeroPage
Definition: fatstruc.h:162
ULONG SizeOfFsFilterCallbacks
Definition: iotypes.h:7070
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
BOOLEAN FujitsuFMR
Definition: fatstruc.h:94
#define IRP_MJ_FLUSH_BUFFERS
USHORT MaximumLength
Definition: env_spec_w32.h:370
CACHE_MANAGER_CALLBACKS CacheManagerCallbacks
Definition: fatstruc.h:158
BOOLEAN NTAPI FsRtlMdlReadCompleteDev(IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1011
PDEVICE_OBJECT FatCdromFileSystemDeviceObject
Definition: fatdata.c:59
#define IRP_MJ_SHUTDOWN
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LOGICAL FatDiskAccountingEnabled
Definition: fatdata.c:129
BOOLEAN NTAPI FsRtlMdlWriteCompleteDev(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1198
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
KSPIN_LOCK GeneralSpinLock
Definition: fatstruc.h:151
PFAST_IO_MDL_READ MdlRead
Definition: iotypes.h:1706
#define IRP_MJ_SET_VOLUME_INFORMATION
SLIST_HEADER FatCloseContextSList
Definition: fatdata.c:106
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
ULONG FatMaxDelayedCloseCount
Definition: close.c:31
PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite
Definition: iotypes.h:1708
PFAST_IO_UNLOCK_ALL FastIoUnlockAll
Definition: iotypes.h:1698
BOOLEAN ChicagoMode
Definition: fatstruc.h:86
PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo
Definition: iotypes.h:1704
BOOLEAN NTAPI FsRtlPrepareMdlWriteDev(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG LockKey, OUT PMDL *MdlChain, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1272
NPAGED_LOOKASIDE_LIST FatNonPagedFcbLookasideList
Definition: fatdata.c:103
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
PFAST_IO_MDL_READ_COMPLETE MdlReadComplete
Definition: iotypes.h:1707
NPAGED_LOOKASIDE_LIST FatIrpContextLookasideList
Definition: fatdata.c:102
FAST_MUTEX FatCloseQueueMutex
Definition: fatdata.c:112
LIST_ENTRY DelayedCloseList
Definition: fatstruc.h:138
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
BOOLEAN CodePageInvariant
Definition: fatstruc.h:114
PFS_FILTER_CALLBACK PreAcquireForSectionSynchronization
Definition: iotypes.h:7072
ULONG NumberProcessors
Definition: fatstruc.h:80
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
Definition: iotypes.h:1694
#define IRP_MJ_SET_EA
struct _FAST_IO_DISPATCH FAST_IO_DISPATCH
#define PsGetCurrentProcess
Definition: psfuncs.h:17
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
BOOLEAN NTAPI FatNoOpAcquire(IN PVOID Fcb, IN BOOLEAN Wait)
Definition: resrcsup.c:795
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
PDRIVER_OBJECT DriverObject
Definition: fatstruc.h:54
BOOLEAN NTAPI FsRtlMdlReadDev(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG LockKey, OUT PMDL *MdlChain, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1025
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:113
#define IRP_MJ_QUERY_EA
FAT_DATA FatData
Definition: fatdata.c:56
PDEVICE_OBJECT FatDiskFileSystemDeviceObject
Definition: fatdata.c:58
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:222
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
KEVENT FatReserveEvent
Definition: fatdata.c:123
#define IRP_MJ_FILE_SYSTEM_CONTROL
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
MM_SYSTEMSIZE NTAPI MmQuerySystemSize(VOID)
Definition: mmsup.c:257
PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite
Definition: cctypes.h:39
PEPROCESS OurProcess
Definition: fatstruc.h:74
PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey
Definition: iotypes.h:1699
struct _FAT_DATA FAT_DATA
NPAGED_LOOKASIDE_LIST FatEResourceLookasideList
Definition: fatdata.c:104
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
NTSTATUS FatGetCompatibilityModeValue(IN PUNICODE_STRING ValueName, IN OUT PULONG Value)
Definition: fatinit.c:503
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NODE_BYTE_SIZE NodeByteSize
Definition: fatstruc.h:38
NTSTATUS NTAPI FsRtlRegisterFileSystemFilterCallbacks(PDRIVER_OBJECT FilterDriverObject, PFS_FILTER_CALLBACKS Callbacks)
Definition: fastio.c:1947
PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush
Definition: iotypes.h:1716
PFAST_IO_LOCK FastIoLock
Definition: iotypes.h:1696
#define TAG_ERESOURCE
Definition: nodetype.h:154
VOID NTAPI FatNoOpRelease(IN PVOID Fcb)
Definition: resrcsup.c:842
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define COMPATIBILITY_MODE_VALUE_NAME
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define FAT_NTC_DATA_HEADER
Definition: nodetype.h:27
FAST_IO_DISPATCH FatFastIoDispatch
Definition: fatdata.c:96
struct _FS_FILTER_CALLBACKS FS_FILTER_CALLBACKS
NTKERNELAPI ULONG NTAPI KeQueryActiveProcessorCount(OUT PKAFFINITY ActiveProcessors OPTIONAL)
Definition: ke.c:15
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
Status
Definition: gdiplustypes.h:24
#define TAG_IRP_CONTEXT
Definition: cdprocs.h:89
LIST_ENTRY VcbQueue
Definition: fatstruc.h:48
#define CODE_PAGE_INVARIANCE_VALUE_NAME
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1692
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2154
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
PFAST_IO_WRITE FastIoWrite
Definition: iotypes.h:1693
unsigned short USHORT
Definition: pedump.c:61
#define FAT_MAX_DELAYED_CLOSES
Definition: fatdata.h:108
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
ERESOURCE Resource
Definition: fatstruc.h:67
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo
Definition: iotypes.h:1695
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
#define IRP_MJ_READ
Definition: rdpdr.c:46
BOOLEAN NTAPI FsRtlCopyRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:64
BOOLEAN NTAPI FsRtlCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:264
VOID NTAPI IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
Definition: volume.c:992
struct _FAST_IO_DISPATCH * FastIoDispatch
Definition: iotypes.h:2177
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete
Definition: iotypes.h:1709
#define IRP_MJ_CLEANUP
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:108
#define ObReferenceObject
Definition: obfuncs.h:204
#define ExInitializeSListHead
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite
Definition: cctypes.h:40
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
unsigned int ULONG
Definition: retypes.h:1
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
PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible
Definition: iotypes.h:1691
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:28
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define POOL_RAISE_IF_ALLOCATION_FAILURE
LIST_ENTRY AsyncCloseList
Definition: fatstruc.h:131
return STATUS_SUCCESS
Definition: btrfs.c:2938
BOOLEAN FatIsFujitsuFMR()
Definition: fatinit.c:644
PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush
Definition: iotypes.h:1717
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 MaxDepth
Definition: acpixf.h:635
PVOID DiskFileSystemDeviceObject
Definition: fatstruc.h:60
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
ULONG SizeOfFastIoDispatch
Definition: iotypes.h:1690
CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks
Definition: fatstruc.h:159

◆ DriverEntry()

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

Definition at line 25 of file ksecdd.c.

28 {
29  UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KsecDD");
31 
32  /* Create the KsecDD device */
34  0,
35  &DeviceName,
37  0x100u,
38  FALSE,
40  if (!NT_SUCCESS(Status))
41  {
42  DPRINT1("Failed to create KsecDD device: 0x%lx\n", Status);
43  return Status;
44  }
45 
46  /* Set up dispatch table */
54 
55  /* Initialize */
57 
58  return STATUS_SUCCESS;
59 }
#define FILE_DEVICE_KSEC
Definition: winioctl.h:162
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
LONG NTSTATUS
Definition: precomp.h:26
WCHAR DeviceName[]
Definition: adapter.cpp:21
PDEVICE_OBJECT KsecDeviceObject
Definition: ksecdd.c:18
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
VOID NTAPI KsecInitializeEncryptionSupport(VOID)
Definition: crypt.c:32
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI KsecDdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: dispatch.c:184
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
#define IRP_MJ_READ
Definition: rdpdr.c:46
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
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
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

◆ FatGetCompatibilityModeValue()

NTSTATUS FatGetCompatibilityModeValue ( IN PUNICODE_STRING  ValueName,
IN OUT PULONG  Value 
)

Definition at line 503 of file fatinit.c.

531 {
532  HANDLE Handle;
534  ULONG RequestLength;
539  PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
540 
542  KeyName.Length = sizeof(COMPATIBILITY_MODE_KEY_NAME) - sizeof(WCHAR);
543  KeyName.MaximumLength = sizeof(COMPATIBILITY_MODE_KEY_NAME);
544 
546  &KeyName,
548  NULL,
549  NULL);
550 
551  Status = ZwOpenKey(&Handle,
552  KEY_READ,
554 
555  if (!NT_SUCCESS(Status)) {
556 
557  return Status;
558  }
559 
560  RequestLength = KEY_WORK_AREA;
561 
562  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)Buffer;
563 
564  while (1) {
565 
566  Status = ZwQueryValueKey(Handle,
567  ValueName,
569  KeyValueInformation,
570  RequestLength,
571  &ResultLength);
572 
574 
576 
577  //
578  // Try to get a buffer big enough.
579  //
580 
581  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
582 
583  ExFreePool(KeyValueInformation);
584  }
585 
586  RequestLength += 256;
587 
588  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)
590  RequestLength,
591  ' taF');
592 
593  if (!KeyValueInformation) {
594 
595  ZwClose(Handle);
596  return STATUS_NO_MEMORY;
597  }
598 
599  } else {
600 
601  break;
602  }
603  }
604 
605  ZwClose(Handle);
606 
607  if (NT_SUCCESS(Status)) {
608 
609  if (KeyValueInformation->DataLength != 0) {
610 
611  PULONG DataPtr;
612 
613  //
614  // Return contents to the caller.
615  //
616 
617  DataPtr = (PULONG)
618  ((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset);
619  *Value = *DataPtr;
620 
621  } else {
622 
623  //
624  // Treat as if no value was found
625  //
626 
628  }
629  }
630 
631  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
632 
633  ExFreePool(KeyValueInformation);
634  }
635 
636  return Status;
637 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2374
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define KEY_WORK_AREA
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
_In_ HANDLE Handle
Definition: extypes.h:390
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define COMPATIBILITY_MODE_KEY_NAME
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
struct _KEY_VALUE_FULL_INFORMATION * PKEY_VALUE_FULL_INFORMATION
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NT_ASSERT
Definition: rtlfuncs.h:3312

◆ FatIsFujitsuFMR()

BOOLEAN FatIsFujitsuFMR ( )

Definition at line 644 of file fatinit.c.

662 {
663  BOOLEAN Result;
664  HANDLE Handle;
666  ULONG RequestLength;
672  PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
673 
674  //
675  // Set default as PC/AT
676  //
677 
679  KeyName.Length = sizeof(REGISTRY_HARDWARE_DESCRIPTION_W) - sizeof(WCHAR);
680  KeyName.MaximumLength = sizeof(REGISTRY_HARDWARE_DESCRIPTION_W);
681 
683  &KeyName,
685  NULL,
686  NULL);
687 
688  Status = ZwOpenKey(&Handle,
689  KEY_READ,
691 
692  if (!NT_SUCCESS(Status)) {
693 
694  return FALSE;
695  }
696 
700 
701  RequestLength = KEY_WORK_AREA;
702 
703  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)Buffer;
704 
705  while (1) {
706 
707  Status = ZwQueryValueKey(Handle,
708  &ValueName,
710  KeyValueInformation,
711  RequestLength,
712  &ResultLength);
713 
714  // NT_ASSERT( Status != STATUS_BUFFER_OVERFLOW );
715 
717 
718  //
719  // Try to get a buffer big enough.
720  //
721 
722  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
723 
724  ExFreePool(KeyValueInformation);
725  }
726 
727  RequestLength += 256;
728 
729  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)
730  ExAllocatePoolWithTag(PagedPool, RequestLength, ' taF');
731 
732  if (!KeyValueInformation) {
733 
734  ZwClose(Handle);
735  return FALSE;
736  }
737 
738  } else {
739 
740  break;
741  }
742  }
743 
744  ZwClose(Handle);
745 
746  if (NT_SUCCESS(Status) &&
747  (KeyValueInformation->DataLength >= sizeof(FUJITSU_FMR_NAME_W)) &&
748  (RtlCompareMemory((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset,
750  sizeof(FUJITSU_FMR_NAME_W) - sizeof(WCHAR)) ==
751  sizeof(FUJITSU_FMR_NAME_W) - sizeof(WCHAR))) {
752 
753  Result = TRUE;
754 
755  } else {
756 
757  Result = FALSE;
758  }
759 
760  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
761 
762  ExFreePool(KeyValueInformation);
763  }
764 
765  return Result;
766 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define KEY_WORK_AREA
#define TRUE
Definition: types.h:120
#define REGISTRY_MACHINE_IDENTIFIER_W
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
#define FUJITSU_FMR_NAME_W
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
_In_ HANDLE Handle
Definition: extypes.h:390
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define REGISTRY_HARDWARE_DESCRIPTION_W
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
struct _KEY_VALUE_FULL_INFORMATION * PKEY_VALUE_FULL_INFORMATION
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

Variable Documentation

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 22 of file fatinit.c.