ReactOS  0.4.15-dev-492-ga1108f6
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  FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' );
268  if (FatData.ZeroPage == NULL) {
272  }
274 
275 
276  //
277  // Now initialize our general purpose spinlock (gag) and figure out how
278  // deep and wide we want our delayed lists (along with fooling ourselves
279  // about the lookaside depths).
280  //
281 
283 
284  switch ( MmQuerySystemSize() ) {
285 
286  case MmSmallSystem:
287 
288  MaxDepth = 4;
290  break;
291 
292  case MmMediumSystem:
293 
294  MaxDepth = 8;
296  break;
297 
298  case MmLargeSystem:
299  default:
300 
301  MaxDepth = 16;
303  break;
304  }
305 
306 
307  //
308  // Initialize the cache manager callback routines
309  //
310 
311  FatData.CacheManagerCallbacks.AcquireForLazyWrite = &FatAcquireFcbForLazyWrite;
312  FatData.CacheManagerCallbacks.ReleaseFromLazyWrite = &FatReleaseFcbFromLazyWrite;
313  FatData.CacheManagerCallbacks.AcquireForReadAhead = &FatAcquireFcbForReadAhead;
314  FatData.CacheManagerCallbacks.ReleaseFromReadAhead = &FatReleaseFcbFromReadAhead;
315 
320 
321  //
322  // Set up global pointer to our process.
323  //
324 
326 
327  //
328  // Setup the number of processors we support for statistics as the current number
329  // running.
330  //
331 
332 #if (NTDDI_VERSION >= NTDDI_VISTA)
334 #else
336 #endif
337 
338 
339  //
340  // Read the registry to determine if we are in ChicagoMode.
341  //
342 
346 
348 
349  if (NT_SUCCESS(Status) && FlagOn(Value, 1)) {
350 
352 
353  } else {
354 
356  }
357 
358  //
359  // Read the registry to determine if we are going to generate LFNs
360  // for valid 8.3 names with extended characters.
361  //
362 
366 
368 
369  if (NT_SUCCESS(Status) && FlagOn(Value, 1)) {
370 
372 
373  } else {
374 
376  }
377 
378  //
379  // Initialize our global resource and fire up the lookaside lists.
380  //
381 
383 
385  NULL,
386  NULL,
388  sizeof(IRP_CONTEXT),
390  MaxDepth );
391 
393  NULL,
394  NULL,
396  sizeof(NON_PAGED_FCB),
398  MaxDepth );
399 
401  NULL,
402  NULL,
404  sizeof(ERESOURCE),
406  MaxDepth );
407 
411 
412  //
413  // Register the file system with the I/O system
414  //
415 
420 
421  //
422  // Find out if we are running an a FujitsuFMR machine.
423  //
424 
426 
427 #if (NTDDI_VERSION >= NTDDI_WIN8)
428 
429  //
430  // Find out global disk accounting state, cache the result
431  //
432 
433  FatDiskAccountingEnabled = PsIsDiskCountersEnabled();
434 
435 #endif
436 
437  //
438  // And return to our caller
439  //
440 
441  return( STATUS_SUCCESS );
442 }
#define TAG_FCB_NONPAGED
Definition: cdprocs.h:91
NODE_TYPE_CODE NodeTypeCode
Definition: fatstruc.h:37
PIO_WORKITEM FatCloseItem
Definition: fatstruc.h:144
PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle
Definition: iotypes.h:1699
#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:7072
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
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:1708
#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:1710
PFAST_IO_UNLOCK_ALL FastIoUnlockAll
Definition: iotypes.h:1700
#define POOL_NX_ALLOCATION
BOOLEAN ChicagoMode
Definition: fatstruc.h:86
PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo
Definition: iotypes.h:1706
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:1709
IN UCHAR Value
Definition: halp.h:394
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:7074
ULONG NumberProcessors
Definition: fatstruc.h:80
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
Definition: iotypes.h:1696
#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:1701
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:487
#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:1718
PFAST_IO_LOCK FastIoLock
Definition: iotypes.h:1698
#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:2182
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:97
LIST_ENTRY VcbQueue
Definition: fatstruc.h:48
#define CODE_PAGE_INVARIANCE_VALUE_NAME
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1694
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2156
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
PFAST_IO_WRITE FastIoWrite
Definition: iotypes.h:1695
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:1697
#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:2179
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete
Definition: iotypes.h:1711
#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:2183
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:1693
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:3014
BOOLEAN FatIsFujitsuFMR()
Definition: fatinit.c:628
PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush
Definition: iotypes.h:1719
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:1692
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:2183
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:3014
#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 487 of file fatinit.c.

515 {
516  HANDLE Handle;
518  ULONG RequestLength;
523  PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
524 
526  KeyName.Length = sizeof(COMPATIBILITY_MODE_KEY_NAME) - sizeof(WCHAR);
527  KeyName.MaximumLength = sizeof(COMPATIBILITY_MODE_KEY_NAME);
528 
530  &KeyName,
532  NULL,
533  NULL);
534 
535  Status = ZwOpenKey(&Handle,
536  KEY_READ,
538 
539  if (!NT_SUCCESS(Status)) {
540 
541  return Status;
542  }
543 
544  RequestLength = KEY_WORK_AREA;
545 
546  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)Buffer;
547 
548  while (1) {
549 
550  Status = ZwQueryValueKey(Handle,
551  ValueName,
553  KeyValueInformation,
554  RequestLength,
555  &ResultLength);
556 
558 
560 
561  //
562  // Try to get a buffer big enough.
563  //
564 
565  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
566 
567  ExFreePool(KeyValueInformation);
568  }
569 
570  RequestLength += 256;
571 
572  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)
574  RequestLength,
575  ' taF');
576 
577  if (!KeyValueInformation) {
578 
579  ZwClose(Handle);
580  return STATUS_NO_MEMORY;
581  }
582 
583  } else {
584 
585  break;
586  }
587  }
588 
589  ZwClose(Handle);
590 
591  if (NT_SUCCESS(Status)) {
592 
593  if (KeyValueInformation->DataLength != 0) {
594 
595  PULONG DataPtr;
596 
597  //
598  // Return contents to the caller.
599  //
600 
601  DataPtr = (PULONG)
602  ((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset);
603  *Value = *DataPtr;
604 
605  } else {
606 
607  //
608  // Treat as if no value was found
609  //
610 
612  }
613  }
614 
615  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
616 
617  ExFreePool(KeyValueInformation);
618  }
619 
620  return Status;
621 }
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 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 UCHAR Value
Definition: halp.h:394
_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 628 of file fatinit.c.

646 {
647  BOOLEAN Result;
648  HANDLE Handle;
650  ULONG RequestLength;
656  PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
657 
658  //
659  // Set default as PC/AT
660  //
661 
663  KeyName.Length = sizeof(REGISTRY_HARDWARE_DESCRIPTION_W) - sizeof(WCHAR);
664  KeyName.MaximumLength = sizeof(REGISTRY_HARDWARE_DESCRIPTION_W);
665 
667  &KeyName,
669  NULL,
670  NULL);
671 
672  Status = ZwOpenKey(&Handle,
673  KEY_READ,
675 
676  if (!NT_SUCCESS(Status)) {
677 
678  return FALSE;
679  }
680 
684 
685  RequestLength = KEY_WORK_AREA;
686 
687  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)Buffer;
688 
689  while (1) {
690 
691  Status = ZwQueryValueKey(Handle,
692  &ValueName,
694  KeyValueInformation,
695  RequestLength,
696  &ResultLength);
697 
698  // NT_ASSERT( Status != STATUS_BUFFER_OVERFLOW );
699 
701 
702  //
703  // Try to get a buffer big enough.
704  //
705 
706  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
707 
708  ExFreePool(KeyValueInformation);
709  }
710 
711  RequestLength += 256;
712 
713  KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)
714  ExAllocatePoolWithTag(PagedPool, RequestLength, ' taF');
715 
716  if (!KeyValueInformation) {
717 
718  ZwClose(Handle);
719  return FALSE;
720  }
721 
722  } else {
723 
724  break;
725  }
726  }
727 
728  ZwClose(Handle);
729 
730  if (NT_SUCCESS(Status) &&
731  (KeyValueInformation->DataLength >= sizeof(FUJITSU_FMR_NAME_W)) &&
732  (RtlCompareMemory((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset,
734  sizeof(FUJITSU_FMR_NAME_W) - sizeof(WCHAR)) ==
735  sizeof(FUJITSU_FMR_NAME_W) - sizeof(WCHAR))) {
736 
737  Result = TRUE;
738 
739  } else {
740 
741  Result = FALSE;
742  }
743 
744  if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
745 
746  ExFreePool(KeyValueInformation);
747  }
748 
749  return Result;
750 }
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.