ReactOS 0.4.15-dev-8241-g63935f8
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
uint32_t ULONG
Definition: typedefs.h:59

◆ 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 27 of file fatinit.c.

94{
98 FS_FILTER_CALLBACKS FilterCallbacks;
100 ULONG Value;
101
103
104 //
105 // Create the device object for disks. To avoid problems with filters who
106 // know this name, we must keep it.
107 //
108
111 0,
114 0,
115 FALSE,
117
118 if (!NT_SUCCESS( Status )) {
119 return Status;
120 }
121
122 //
123 // Create the device object for "cdroms".
124 //
125
126 RtlInitUnicodeString( &UnicodeString, L"\\FatCdrom" );
128 0,
131 0,
132 FALSE,
134
135 if (!NT_SUCCESS( Status )) {
137 return Status;
138 }
139
140#ifdef _MSC_VER
141#pragma prefast( push )
142#pragma prefast( disable:28155, "these are all correct" )
143#pragma prefast( disable:28169, "these are all correct" )
144#pragma prefast( disable:28175, "this is a filesystem, touching FastIoDispatch is allowed" )
145#endif
146
147 DriverObject->DriverUnload = FatUnload;
148
149 //
150 // Note that because of the way data caching is done, we set neither
151 // the Direct I/O or Buffered I/O bit in DeviceObject->Flags. If
152 // data is not in the cache, or the request is not buffered, we may,
153 // set up for Direct I/O by hand.
154 //
155
156 //
157 // Initialize the driver object with this driver's entry points.
158 //
159
160 DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH)FatFsdCreate;
161 DriverObject->MajorFunction[IRP_MJ_CLOSE] = (PDRIVER_DISPATCH)FatFsdClose;
162 DriverObject->MajorFunction[IRP_MJ_READ] = (PDRIVER_DISPATCH)FatFsdRead;
163 DriverObject->MajorFunction[IRP_MJ_WRITE] = (PDRIVER_DISPATCH)FatFsdWrite;
164 DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = (PDRIVER_DISPATCH)FatFsdQueryInformation;
165 DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = (PDRIVER_DISPATCH)FatFsdSetInformation;
166 DriverObject->MajorFunction[IRP_MJ_QUERY_EA] = (PDRIVER_DISPATCH)FatFsdQueryEa;
167 DriverObject->MajorFunction[IRP_MJ_SET_EA] = (PDRIVER_DISPATCH)FatFsdSetEa;
168 DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = (PDRIVER_DISPATCH)FatFsdFlushBuffers;
169 DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = (PDRIVER_DISPATCH)FatFsdQueryVolumeInformation;
170 DriverObject->MajorFunction[IRP_MJ_SET_VOLUME_INFORMATION] = (PDRIVER_DISPATCH)FatFsdSetVolumeInformation;
171 DriverObject->MajorFunction[IRP_MJ_CLEANUP] = (PDRIVER_DISPATCH)FatFsdCleanup;
172 DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = (PDRIVER_DISPATCH)FatFsdDirectoryControl;
173 DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = (PDRIVER_DISPATCH)FatFsdFileSystemControl;
174 DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] = (PDRIVER_DISPATCH)FatFsdLockControl;
175 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = (PDRIVER_DISPATCH)FatFsdDeviceControl;
176 DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = (PDRIVER_DISPATCH)FatFsdShutdown;
177 DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH)FatFsdPnp;
178
179 DriverObject->FastIoDispatch = &FatFastIoDispatch;
180
182
184 FatFastIoDispatch.FastIoCheckIfPossible = FatFastIoCheckIfPossible; // CheckForFastIo
187 FatFastIoDispatch.FastIoQueryBasicInfo = FatFastQueryBasicInfo; // QueryBasicInfo
188 FatFastIoDispatch.FastIoQueryStandardInfo = FatFastQueryStdInfo; // QueryStandardInfo
189 FatFastIoDispatch.FastIoLock = FatFastLock; // Lock
190 FatFastIoDispatch.FastIoUnlockSingle = FatFastUnlockSingle; // UnlockSingle
191 FatFastIoDispatch.FastIoUnlockAll = FatFastUnlockAll; // UnlockAll
192 FatFastIoDispatch.FastIoUnlockAllByKey = FatFastUnlockAllByKey; // UnlockAllByKey
193 FatFastIoDispatch.FastIoQueryNetworkOpenInfo = FatFastQueryNetworkOpenInfo;
194 FatFastIoDispatch.AcquireForCcFlush = FatAcquireForCcFlush;
195 FatFastIoDispatch.ReleaseForCcFlush = FatReleaseForCcFlush;
200
201#ifdef _MSC_VER
202#pragma prefast( pop )
203#endif
204
205 //
206 // Initialize the filter callbacks we use.
207 //
208
209 RtlZeroMemory( &FilterCallbacks,
210 sizeof(FS_FILTER_CALLBACKS) );
211
212 FilterCallbacks.SizeOfFsFilterCallbacks = sizeof(FS_FILTER_CALLBACKS);
213 FilterCallbacks.PreAcquireForSectionSynchronization = FatFilterCallbackAcquireForCreateSection;
214
216 &FilterCallbacks );
217
218 if (!NT_SUCCESS( Status )) {
219
222 return Status;
223 }
224
225 //
226 // Initialize the global data structures
227 //
228
229 //
230 // The FatData record
231 //
232
233 RtlZeroMemory( &FatData, sizeof(FAT_DATA));
234
236 FatData.NodeByteSize = sizeof(FAT_DATA);
237
239
243
244 //
245 // This list head keeps track of closes yet to be done.
246 //
247
250
252
253 if (FatData.FatCloseItem == NULL) {
257 }
258
259 //
260 // Allocate the zero page
261 //
262
263 FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' );
264 if (FatData.ZeroPage == NULL) {
268 }
270
271
272 //
273 // Now initialize our general purpose spinlock (gag) and figure out how
274 // deep and wide we want our delayed lists (along with fooling ourselves
275 // about the lookaside depths).
276 //
277
279
280 switch ( MmQuerySystemSize() ) {
281
282 case MmSmallSystem:
283
284 MaxDepth = 4;
286 break;
287
288 case MmMediumSystem:
289
290 MaxDepth = 8;
292 break;
293
294 case MmLargeSystem:
295 default:
296
297 MaxDepth = 16;
299 break;
300 }
301
302
303 //
304 // Initialize the cache manager callback routines
305 //
306
307 FatData.CacheManagerCallbacks.AcquireForLazyWrite = &FatAcquireFcbForLazyWrite;
308 FatData.CacheManagerCallbacks.ReleaseFromLazyWrite = &FatReleaseFcbFromLazyWrite;
309 FatData.CacheManagerCallbacks.AcquireForReadAhead = &FatAcquireFcbForReadAhead;
310 FatData.CacheManagerCallbacks.ReleaseFromReadAhead = &FatReleaseFcbFromReadAhead;
311
316
317 //
318 // Set up global pointer to our process.
319 //
320
322
323 //
324 // Setup the number of processors we support for statistics as the current number
325 // running.
326 //
327
328#if (NTDDI_VERSION >= NTDDI_VISTA)
330#else
332#endif
333
334
335 //
336 // Read the registry to determine if we are in ChicagoMode.
337 //
338
340 ValueName.Length = sizeof(COMPATIBILITY_MODE_VALUE_NAME) - sizeof(WCHAR);
341 ValueName.MaximumLength = sizeof(COMPATIBILITY_MODE_VALUE_NAME);
342
344
345 if (NT_SUCCESS(Status) && FlagOn(Value, 1)) {
346
348
349 } else {
350
352 }
353
354 //
355 // Read the registry to determine if we are going to generate LFNs
356 // for valid 8.3 names with extended characters.
357 //
358
360 ValueName.Length = sizeof(CODE_PAGE_INVARIANCE_VALUE_NAME) - sizeof(WCHAR);
361 ValueName.MaximumLength = sizeof(CODE_PAGE_INVARIANCE_VALUE_NAME);
362
364
365 if (NT_SUCCESS(Status) && FlagOn(Value, 1)) {
366
368
369 } else {
370
372 }
373
374 //
375 // Initialize our global resource and fire up the lookaside lists.
376 //
377
379
381 NULL,
382 NULL,
384 sizeof(IRP_CONTEXT),
386 MaxDepth );
387
389 NULL,
390 NULL,
392 sizeof(NON_PAGED_FCB),
394 MaxDepth );
395
397 NULL,
398 NULL,
400 sizeof(ERESOURCE),
402 MaxDepth );
403
407
408 //
409 // Register the file system with the I/O system
410 //
411
416
417 //
418 // Find out if we are running an a FujitsuFMR machine.
419 //
420
422
423#if (NTDDI_VERSION >= NTDDI_WIN8)
424
425 //
426 // Find out global disk accounting state, cache the result
427 //
428
429 FatDiskAccountingEnabled = PsIsDiskCountersEnabled();
430
431#endif
432
433 //
434 // And return to our caller
435 //
436
437 return( STATUS_SUCCESS );
438}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 MaxDepth
Definition: acpixf.h:640
LONG NTSTATUS
Definition: precomp.h:26
#define TAG_FCB_NONPAGED
Definition: cdprocs.h:91
#define TAG_IRP_CONTEXT
Definition: cdprocs.h:97
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG FatMaxDelayedCloseCount
Definition: close.c:31
#define FAT_NTC_DATA_HEADER
Definition: nodetype.h:27
#define TAG_ERESOURCE
Definition: nodetype.h:154
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define PAGE_SIZE
Definition: env_spec_w32.h:49
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
NPAGED_LOOKASIDE_LIST FatNonPagedFcbLookasideList
Definition: fatdata.c:103
FAST_MUTEX FatCloseQueueMutex
Definition: fatdata.c:112
PDEVICE_OBJECT FatDiskFileSystemDeviceObject
Definition: fatdata.c:58
KEVENT FatReserveEvent
Definition: fatdata.c:123
SLIST_HEADER FatCloseContextSList
Definition: fatdata.c:106
LOGICAL FatDiskAccountingEnabled
Definition: fatdata.c:129
NPAGED_LOOKASIDE_LIST FatIrpContextLookasideList
Definition: fatdata.c:102
NPAGED_LOOKASIDE_LIST FatEResourceLookasideList
Definition: fatdata.c:104
FAST_IO_DISPATCH FatFastIoDispatch
Definition: fatdata.c:96
FAT_DATA FatData
Definition: fatdata.c:56
PDEVICE_OBJECT FatCdromFileSystemDeviceObject
Definition: fatdata.c:59
#define FAT_MAX_DELAYED_CLOSES
Definition: fatdata.h:108
#define CODE_PAGE_INVARIANCE_VALUE_NAME
BOOLEAN FatIsFujitsuFMR()
Definition: fatinit.c:624
#define COMPATIBILITY_MODE_VALUE_NAME
NTSTATUS FatGetCompatibilityModeValue(IN PUNICODE_STRING ValueName, IN OUT PULONG Value)
Definition: fatinit.c:483
BOOLEAN NTAPI FatNoOpAcquire(IN PVOID Fcb, IN BOOLEAN Wait)
Definition: resrcsup.c:795
VOID NTAPI FatNoOpRelease(IN PVOID Fcb)
Definition: resrcsup.c:842
struct _FAT_DATA FAT_DATA
Status
Definition: gdiplustypes.h:25
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
NTKRNLVISTAAPI ULONG NTAPI KeQueryActiveProcessorCount(OUT PKAFFINITY ActiveProcessors OPTIONAL)
Definition: ke.c:15
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
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
MM_SYSTEMSIZE NTAPI MmQuerySystemSize(VOID)
Definition: mmsup.c:257
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
@ SynchronizationEvent
BOOLEAN NTAPI FsRtlMdlWriteCompleteDev(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1198
BOOLEAN NTAPI FsRtlMdlReadCompleteDev(IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1011
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
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
NTSTATUS NTAPI FsRtlRegisterFileSystemFilterCallbacks(PDRIVER_OBJECT FilterDriverObject, PFS_FILTER_CALLBACKS Callbacks)
Definition: fastio.c:2008
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
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
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject)
Definition: volume.c:987
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:53
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:48
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define STATUS_SUCCESS
Definition: shellext.h:65
PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite
Definition: cctypes.h:39
PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite
Definition: cctypes.h:40
PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead
Definition: cctypes.h:41
PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead
Definition: cctypes.h:42
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo
Definition: iotypes.h:1738
PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey
Definition: iotypes.h:1742
PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush
Definition: iotypes.h:1760
PFAST_IO_MDL_READ_COMPLETE MdlReadComplete
Definition: iotypes.h:1750
PFAST_IO_MDL_READ MdlRead
Definition: iotypes.h:1749
PFAST_IO_WRITE FastIoWrite
Definition: iotypes.h:1736
PFAST_IO_UNLOCK_ALL FastIoUnlockAll
Definition: iotypes.h:1741
PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo
Definition: iotypes.h:1747
PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush
Definition: iotypes.h:1759
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete
Definition: iotypes.h:1752
ULONG SizeOfFastIoDispatch
Definition: iotypes.h:1733
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1735
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
Definition: iotypes.h:1737
PFAST_IO_LOCK FastIoLock
Definition: iotypes.h:1739
PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle
Definition: iotypes.h:1740
PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite
Definition: iotypes.h:1751
PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible
Definition: iotypes.h:1734
ULONG NumberProcessors
Definition: fatstruc.h:81
BOOLEAN ChicagoMode
Definition: fatstruc.h:87
PVOID DiskFileSystemDeviceObject
Definition: fatstruc.h:61
CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks
Definition: fatstruc.h:160
PDRIVER_OBJECT DriverObject
Definition: fatstruc.h:55
KSPIN_LOCK GeneralSpinLock
Definition: fatstruc.h:152
NODE_TYPE_CODE NodeTypeCode
Definition: fatstruc.h:38
NODE_BYTE_SIZE NodeByteSize
Definition: fatstruc.h:39
BOOLEAN CodePageInvariant
Definition: fatstruc.h:115
LIST_ENTRY AsyncCloseList
Definition: fatstruc.h:132
BOOLEAN FujitsuFMR
Definition: fatstruc.h:95
CACHE_MANAGER_CALLBACKS CacheManagerCallbacks
Definition: fatstruc.h:159
PVOID ZeroPage
Definition: fatstruc.h:163
PEPROCESS OurProcess
Definition: fatstruc.h:75
PVOID CdromFileSystemDeviceObject
Definition: fatstruc.h:62
PIO_WORKITEM FatCloseItem
Definition: fatstruc.h:145
LIST_ENTRY VcbQueue
Definition: fatstruc.h:49
LIST_ENTRY DelayedCloseList
Definition: fatstruc.h:139
ERESOURCE Resource
Definition: fatstruc.h:68
ULONG SizeOfFsFilterCallbacks
Definition: iotypes.h:7426
PFS_FILTER_CALLBACK PreAcquireForSectionSynchronization
Definition: iotypes.h:7428
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define ExInitializeSListHead
#define IRP_MJ_QUERY_EA
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MJ_SET_VOLUME_INFORMATION
#define POOL_NX_ALLOCATION
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2262
#define IRP_MJ_SET_EA
struct _FS_FILTER_CALLBACKS FS_FILTER_CALLBACKS
struct _FAST_IO_DISPATCH FAST_IO_DISPATCH
#define IRP_MJ_FLUSH_BUFFERS
#define IRP_MJ_SHUTDOWN
#define POOL_RAISE_IF_ALLOCATION_FAILURE
#define IRP_MJ_CLEANUP
@ MmLargeSystem
Definition: mmtypes.h:147
@ MmMediumSystem
Definition: mmtypes.h:146
@ MmSmallSystem
Definition: mmtypes.h:145
#define ObReferenceObject
Definition: obfuncs.h:204
#define PsGetCurrentProcess
Definition: psfuncs.h:17
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ DriverEntry()

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

Definition at line 1606 of file isapnp.c.

1609{
1610 DPRINT("%s(%p, %wZ)\n", __FUNCTION__, DriverObject, RegistryPath);
1611
1612 DriverObject->MajorFunction[IRP_MJ_CREATE] = IsaCreateClose;
1613 DriverObject->MajorFunction[IRP_MJ_CLOSE] = IsaCreateClose;
1614 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IsaForwardOrIgnore;
1615 DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = IsaForwardOrIgnore;
1616 DriverObject->MajorFunction[IRP_MJ_PNP] = IsaPnp;
1617 DriverObject->MajorFunction[IRP_MJ_POWER] = IsaPower;
1618 DriverObject->DriverExtension->AddDevice = IsaAddDevice;
1619
1620 /* FIXME: Fix SDK headers */
1621#if 0
1623#endif
1624
1626 InitializeListHead(&BusListHead);
1627
1628 /* FIXME: Fix SDK headers */
1629#if 0
1631#endif
1632
1633 return STATUS_SUCCESS;
1634}
#define _No_competing_thread_begin_
#define _No_competing_thread_end_
#define __FUNCTION__
Definition: types.h:116
KEVENT BusSyncEvent
Definition: isapnp.c:21
#define DPRINT
Definition: sndvol32.h:73
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_POWER

◆ FatGetCompatibilityModeValue()

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

Definition at line 483 of file fatinit.c.

511{
514 ULONG RequestLength;
519 PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
520
522 KeyName.Length = sizeof(COMPATIBILITY_MODE_KEY_NAME) - sizeof(WCHAR);
523 KeyName.MaximumLength = sizeof(COMPATIBILITY_MODE_KEY_NAME);
524
526 &KeyName,
528 NULL,
529 NULL);
530
531 Status = ZwOpenKey(&Handle,
532 KEY_READ,
534
535 if (!NT_SUCCESS(Status)) {
536
537 return Status;
538 }
539
540 RequestLength = KEY_WORK_AREA;
541
542 KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)Buffer;
543
544 while (1) {
545
546 Status = ZwQueryValueKey(Handle,
547 ValueName,
549 KeyValueInformation,
550 RequestLength,
551 &ResultLength);
552
554
556
557 //
558 // Try to get a buffer big enough.
559 //
560
561 if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
562
563 ExFreePool(KeyValueInformation);
564 }
565
566 RequestLength += 256;
567
568 KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)
570 RequestLength,
571 ' taF');
572
573 if (!KeyValueInformation) {
574
576 return STATUS_NO_MEMORY;
577 }
578
579 } else {
580
581 break;
582 }
583 }
584
586
587 if (NT_SUCCESS(Status)) {
588
589 if (KeyValueInformation->DataLength != 0) {
590
591 PULONG DataPtr;
592
593 //
594 // Return contents to the caller.
595 //
596
597 DataPtr = (PULONG)
598 ((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset);
599 *Value = *DataPtr;
600
601 } else {
602
603 //
604 // Treat as if no value was found
605 //
606
608 }
609 }
610
611 if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
612
613 ExFreePool(KeyValueInformation);
614 }
615
616 return Status;
617}
Definition: bufpool.h:45
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PagedPool
Definition: env_spec_w32.h:308
#define COMPATIBILITY_MODE_KEY_NAME
#define KEY_WORK_AREA
ULONG Handle
Definition: gdb_input.c:15
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValueFullInformation
Definition: nt_native.h:1181
#define KEY_READ
Definition: nt_native.h:1023
struct _KEY_VALUE_FULL_INFORMATION * PKEY_VALUE_FULL_INFORMATION
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PUCHAR
Definition: typedefs.h:53
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
#define NT_ASSERT
Definition: rtlfuncs.h:3310
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ FatIsFujitsuFMR()

BOOLEAN FatIsFujitsuFMR ( )

Definition at line 624 of file fatinit.c.

642{
646 ULONG RequestLength;
652 PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
653
654 //
655 // Set default as PC/AT
656 //
657
659 KeyName.Length = sizeof(REGISTRY_HARDWARE_DESCRIPTION_W) - sizeof(WCHAR);
660 KeyName.MaximumLength = sizeof(REGISTRY_HARDWARE_DESCRIPTION_W);
661
663 &KeyName,
665 NULL,
666 NULL);
667
668 Status = ZwOpenKey(&Handle,
669 KEY_READ,
671
672 if (!NT_SUCCESS(Status)) {
673
674 return FALSE;
675 }
676
678 ValueName.Length = sizeof(REGISTRY_MACHINE_IDENTIFIER_W) - sizeof(WCHAR);
679 ValueName.MaximumLength = sizeof(REGISTRY_MACHINE_IDENTIFIER_W);
680
681 RequestLength = KEY_WORK_AREA;
682
683 KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)Buffer;
684
685 while (1) {
686
687 Status = ZwQueryValueKey(Handle,
688 &ValueName,
690 KeyValueInformation,
691 RequestLength,
692 &ResultLength);
693
694 // NT_ASSERT( Status != STATUS_BUFFER_OVERFLOW );
695
697
698 //
699 // Try to get a buffer big enough.
700 //
701
702 if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
703
704 ExFreePool(KeyValueInformation);
705 }
706
707 RequestLength += 256;
708
709 KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)
710 ExAllocatePoolWithTag(PagedPool, RequestLength, ' taF');
711
712 if (!KeyValueInformation) {
713
715 return FALSE;
716 }
717
718 } else {
719
720 break;
721 }
722 }
723
725
726 if (NT_SUCCESS(Status) &&
727 (KeyValueInformation->DataLength >= sizeof(FUJITSU_FMR_NAME_W)) &&
728 (RtlCompareMemory((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset,
730 sizeof(FUJITSU_FMR_NAME_W) - sizeof(WCHAR)) ==
731 sizeof(FUJITSU_FMR_NAME_W) - sizeof(WCHAR))) {
732
733 Result = TRUE;
734
735 } else {
736
737 Result = FALSE;
738 }
739
740 if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) {
741
742 ExFreePool(KeyValueInformation);
743 }
744
745 return Result;
746}
unsigned char BOOLEAN
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define REGISTRY_HARDWARE_DESCRIPTION_W
#define FUJITSU_FMR_NAME_W
#define REGISTRY_MACHINE_IDENTIFIER_W
_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:409

Variable Documentation

◆ DriverEntry

DRIVER_INITIALIZE DriverEntry

Definition at line 18 of file fatinit.c.