ReactOS 0.4.16-dev-197-g92996da
init.c File Reference
#include "ext2fs.h"
Include dependency graph for init.c:

Go to the source code of this file.

Macros

#define NLS_OEM_LEAD_BYTE_INFO   (*NlsOemLeadByteInfo)
 
#define FsRtlIsLeadDbcsCharacter(DBCS_CHAR)
 

Functions

NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 
 DECLARE_INIT (journal_init)
 
 DECLARE_EXIT (journal_exit)
 
NTSTATUS Ext2RegistryQueryCallback (IN PWSTR ValueName, IN ULONG ValueType, IN PVOID ValueData, IN ULONG ValueLength, IN PVOID Context, IN PVOID EntryContext)
 
NTSTATUS Ext2QueryGlobalParameters (IN PUNICODE_STRING RegistryPath)
 
BOOLEAN Ext2QueryRegistrySettings (IN PUNICODE_STRING RegistryPath)
 
VOID Ext2EresourceAlignmentChecking ()
 

Variables

PEXT2_GLOBAL Ext2Global = NULL
 
CHAR gVersion [] = EXT2FSD_VERSION
 
CHAR gTime [] = __TIME__
 
CHAR gDate [] = __DATE__
 

Macro Definition Documentation

◆ FsRtlIsLeadDbcsCharacter

#define FsRtlIsLeadDbcsCharacter (   DBCS_CHAR)
Value:
( \
(BOOLEAN)((UCHAR)(DBCS_CHAR) < 0x80 ? FALSE : \
(NLS_OEM_LEAD_BYTE_INFO[(UCHAR)(DBCS_CHAR)] != 0))) \
)
#define FALSE
Definition: types.h:117
#define NLS_OEM_LEAD_BYTE_INFO
Definition: init.c:425
#define NLS_MB_CODE_PAGE_TAG
Definition: nt_native.h:212
#define BOOLEAN
Definition: pedump.c:73
unsigned char UCHAR
Definition: xmlstorage.h:181

Definition at line 428 of file init.c.

◆ NLS_OEM_LEAD_BYTE_INFO

#define NLS_OEM_LEAD_BYTE_INFO   (*NlsOemLeadByteInfo)

Definition at line 425 of file init.c.

Function Documentation

◆ DECLARE_EXIT()

DECLARE_EXIT ( journal_exit  )

◆ DECLARE_INIT()

DECLARE_INIT ( journal_init  )

◆ DriverEntry()

NTSTATUS DriverEntry ( IN PDRIVER_OBJECT  DriverObject,
IN PUNICODE_STRING  RegistryPath 
)

Definition at line 468 of file init.c.

472{
473 PDEVICE_OBJECT DiskdevObject = NULL;
474 PDEVICE_OBJECT CdromdevObject = NULL;
477
479 PCACHE_MANAGER_CALLBACKS CacheManagerCallbacks;
480
482
483 int rc = 0;
484 BOOLEAN linux_lib_inited = FALSE;
485 BOOLEAN journal_module_inited = FALSE;
486
487 /* Verity super block ... */
488 ASSERT(sizeof(EXT2_SUPER_BLOCK) == 1024);
489 ASSERT(FIELD_OFFSET(EXT2_SUPER_BLOCK, s_magic) == 56);
490
491 DbgPrint(
492 "Ext2Fsd --"
493#ifdef _WIN2K_TARGET_
494 " Win2k --"
495#endif
496 " Version "
498#if EXT2_DEBUG
499 " Checked"
500#else
501 " Free"
502#endif
503 " -- "
504 __DATE__ " "
505 __TIME__ ".\n");
506
507 DEBUG(DL_FUN, ( "Ext2 DriverEntry ...\n"));
508
509 /* initialize winlib structures */
510 if (ext2_init_linux()) {
512 goto errorout;
513 }
514 linux_lib_inited = TRUE;
515
516 /* initialize journal module structures */
518 if (rc != 0) {
520 goto errorout;
521 }
522 journal_module_inited = TRUE;
523
524 /* allocate memory for Ext2Global */
526 if (!Ext2Global) {
528 goto errorout;
529 }
530
531 /* initialize Ext2Global */
535
538
539 /* query registry settings */
541
542 /* create Ext2Fsd cdrom fs deivce */
546 0,
547 &DeviceName,
549 0,
550 FALSE,
551 &CdromdevObject );
552
553 if (!NT_SUCCESS(Status)) {
554 DEBUG(DL_ERR, ( "IoCreateDevice cdrom device object error.\n"));
555 goto errorout;
556 }
557
558 /* create Ext2Fsd disk fs deivce */
562 0,
563 &DeviceName,
565 0,
566 FALSE,
567 &DiskdevObject );
568
569 if (!NT_SUCCESS(Status)) {
570 DEBUG(DL_ERR, ( "IoCreateDevice disk device object error.\n"));
571 goto errorout;
572 }
573
577 if (!NT_SUCCESS(Status)) {
578 goto errorout;
579 }
580
581 /* start resource reaper thread */
585 if (!NT_SUCCESS(Status)) {
587 goto errorout;
588 }
589
593 if (!NT_SUCCESS(Status)) {
596 goto errorout;
597 }
598
599#ifdef _PNP_POWER_
600 DiskdevObject->DeviceObjectExtension->PowerControlNeeded = FALSE;
601 CdromdevObject->DeviceObjectExtension->PowerControlNeeded = FALSE;
602#endif
603
604 /* initializing */
605 Ext2Global->DiskdevObject = DiskdevObject;
606 Ext2Global->CdromdevObject = CdromdevObject;
607
610 DriverObject->MajorFunction[IRP_MJ_READ] = Ext2BuildRequest;
612
615
618
621
626
629
631
632#if (_WIN32_WINNT >= 0x0500)
633 DriverObject->MajorFunction[IRP_MJ_PNP] = Ext2BuildRequest;
634#endif //(_WIN32_WINNT >= 0x0500)
635
636#if EXT2_UNLOAD
637 DriverObject->DriverUnload = DriverUnload;
638#else
639 DriverObject->DriverUnload = NULL;
640#endif
641
642 //
643 // Initialize the fast I/O entry points
644 //
645
647
659
668
669 DriverObject->FastIoDispatch = FastIoDispatch;
670
671 //
672 // initializing structure sizes for statistics
673 // 1 means flexible/not fixed for all allocations (for different volumes).
674 //
678
680 Ext2Global->PerfStat.Unit.Slot[PS_VCB] = sizeof(EXT2_VCB); /* 1 */
681 Ext2Global->PerfStat.Unit.Slot[PS_FCB] = sizeof(EXT2_FCB); /* 2 */
682 Ext2Global->PerfStat.Unit.Slot[PS_CCB] = sizeof(EXT2_CCB); /* 3 */
683 Ext2Global->PerfStat.Unit.Slot[PS_MCB] = sizeof(EXT2_MCB); /* 4 */
684 Ext2Global->PerfStat.Unit.Slot[PS_EXTENT] = sizeof(EXT2_EXTENT); /* 5 */
686 Ext2Global->PerfStat.Unit.Slot[PS_VPB] = sizeof(VPB); /* 7 */
692 Ext2Global->PerfStat.Unit.Slot[PS_DISK_EVENT] = sizeof(KEVENT); /* d */
696 Ext2Global->PerfStat.Unit.Slot[PS_DENTRY] = sizeof(struct dentry); /* 11 */
697 Ext2Global->PerfStat.Unit.Slot[PS_BUFF_HEAD] = sizeof(struct buffer_head); /* 12 */
698
699 switch ( MmQuerySystemSize() ) {
700
701 case MmSmallSystem:
702
703 Ext2Global->MaxDepth = 64;
704 break;
705
706 case MmMediumSystem:
707
708 Ext2Global->MaxDepth = 128;
709 break;
710
711 case MmLargeSystem:
712
713 Ext2Global->MaxDepth = 256;
714 break;
715 }
716
717 //
718 // Initialize the Cache Manager callbacks
719 //
720
721 CacheManagerCallbacks = &(Ext2Global->CacheManagerCallbacks);
722 CacheManagerCallbacks->AcquireForLazyWrite = Ext2AcquireForLazyWrite;
723 CacheManagerCallbacks->ReleaseFromLazyWrite = Ext2ReleaseFromLazyWrite;
724 CacheManagerCallbacks->AcquireForReadAhead = Ext2AcquireForReadAhead;
725 CacheManagerCallbacks->ReleaseFromReadAhead = Ext2ReleaseFromReadAhead;
726
731
732
733#ifndef _WIN2K_TARGET_
734 //
735 // Initialize FS Filter callbacks
736 //
737
742
743#endif
744
745 //
746 // Initialize the global data
747 //
748
750 NULL,
751 NULL,
752 0,
753 sizeof(EXT2_IRP_CONTEXT),
754 'PRIE',
755 0 );
756
758 NULL,
759 NULL,
760 0,
761 sizeof(EXT2_FCB),
762 'BCFE',
763 0 );
764
766 NULL,
767 NULL,
768 0,
769 sizeof(EXT2_CCB),
770 'BCCE',
771 0 );
772
774 NULL,
775 NULL,
776 0,
777 sizeof(EXT2_MCB),
778 'BCME',
779 0 );
780
782 NULL,
783 NULL,
784 0,
785 sizeof(EXT2_EXTENT),
786 'STXE',
787 0 );
788
790 NULL,
791 NULL,
792 0,
793 sizeof(struct dentry),
794 'TNED',
795 0 );
796
799
800#if EXT2_DEBUG
802#endif
803
805
806 Ext2Global->Codepage.PageTable =
807 load_nls(Ext2Global->Codepage.AnsiName);
808
809 /* register file system devices for disk and cdrom */
810 IoRegisterFileSystem(DiskdevObject);
811 ObReferenceObject(DiskdevObject);
812
813 IoRegisterFileSystem(CdromdevObject);
814 ObReferenceObject(CdromdevObject);
815
816errorout:
817
818 if (!NT_SUCCESS(Status)) {
819
820 /*
821 * stop reaper thread ...
822 */
823
824
825 /*
826 * cleanup resources ...
827 */
828
829 if (Ext2Global) {
831 Ext2FreePool(Ext2Global, 'LG2E');
832 }
833
834 if (CdromdevObject) {
835 IoDeleteDevice(CdromdevObject);
836 }
837
838 if (DiskdevObject) {
839 IoDeleteDevice(DiskdevObject);
840 }
841
842 if (journal_module_inited) {
843 /* cleanup journal related caches */
845 }
846
847 if (linux_lib_inited) {
848 /* cleanup linux lib */
850 }
851 }
852
853 return Status;
854}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DEBUG(args)
Definition: rdesktop.h:129
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define PS_FCB
Definition: common.h:18
#define EXT2_PERF_STAT_VER2
Definition: common.h:116
struct _EXT2_PERF_STATISTICS_V2 EXT2_PERF_STATISTICS_V2
#define PS_DISK_EVENT
Definition: common.h:29
#define PS_CCB
Definition: common.h:19
#define PS_EXT2_INODE
Definition: common.h:33
#define PS_FILE_NAME
Definition: common.h:24
#define PS_RW_CONTEXT
Definition: common.h:22
#define PS_MCB
Definition: common.h:20
#define PS_IRP_CONTEXT
Definition: common.h:16
#define PS_MCB_NAME
Definition: common.h:25
#define PS_DIR_PATTERN
Definition: common.h:28
#define PS_DISK_BUFFER
Definition: common.h:30
#define PS_VPB
Definition: common.h:23
#define PS_INODE_NAME
Definition: common.h:26
#define PS_VCB
Definition: common.h:17
#define PS_BUFF_HEAD
Definition: common.h:35
#define PS_BLOCK_DATA
Definition: common.h:31
#define PS_DENTRY
Definition: common.h:34
#define EXT2_PERF_STAT_MAGIC
Definition: common.h:115
#define PS_DIR_ENTRY
Definition: common.h:27
#define PS_EXTENT
Definition: common.h:21
PEXT2_GLOBAL Ext2Global
Definition: init.c:16
BOOLEAN Ext2QueryRegistrySettings(IN PUNICODE_STRING RegistryPath)
Definition: init.c:305
#define KEVENT
Definition: env_spec_w32.h:69
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define ExDeleteResourceLite(res)
Definition: env_spec_w32.h:647
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID Ext2FreePool(IN PVOID P, IN ULONG Tag)
Definition: debug.c:2697
struct ext2_icb EXT2_IRP_CONTEXT
BOOLEAN Ext2FastIoRead(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:172
BOOLEAN Ext2FastIoLock(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, IN BOOLEAN FailImmediately, IN BOOLEAN ExclusiveLock, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:517
VOID Ext2bhReaperThread(PVOID Context)
Definition: memory.c:3239
VOID Ext2McbReaperThread(PVOID Context)
Definition: memory.c:3055
struct _EXT2_CCB EXT2_CCB
BOOLEAN Ext2FastIoQueryBasicInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_BASIC_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:280
struct _EXT2_EXTENT EXT2_EXTENT
BOOLEAN Ext2FastIoUnlockAllByKey(IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:831
NTSTATUS Ext2StartReaper(PEXT2_REAPER, EXT2_REAPER_RELEASE)
Definition: memory.c:3478
struct _EXT2_GLOBAL EXT2_GLOBAL
PVOID Ext2AllocatePool(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: debug.c:2684
BOOLEAN Ext2FastIoWrite(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:207
@ EXT2FGD
Definition: ext2fs.h:461
BOOLEAN Ext2AcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:27
ULONG Ext2GetProcessNameOffset(VOID)
struct _EXT2_VCB EXT2_VCB
NTSTATUS Ext2ReleaseFileForModWrite(IN PFILE_OBJECT FileObject, IN PERESOURCE ResourceToRelease, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1110
VOID Ext2AcquireForCreateSection(IN PFILE_OBJECT FileObject)
Definition: fastio.c:1043
VOID Ext2ReleaseFromLazyWrite(IN PVOID Context)
Definition: cmcb.c:63
BOOLEAN Ext2FastIoQueryStandardInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_STANDARD_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:396
#define DEVICE_NAME
Definition: ext2fs.h:137
#define DOS_DEVICE_NAME
Definition: ext2fs.h:159
BOOLEAN Ext2NoOpAcquire(IN PVOID Fcb, IN BOOLEAN Wait)
Definition: cmcb.c:138
NTSTATUS Ext2ReleaseFileForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1156
#define EXT2FSD_VERSION
Definition: ext2fs.h:51
ULONG ProcessNameOffset
int Ext2LoadAllNls()
Definition: nls.c:118
NTSTATUS Ext2PreAcquireForCreateSection(IN PFS_FILTER_CALLBACK_DATA cd, OUT PVOID *cc)
Definition: fastio.c:1178
BOOLEAN Ext2AcquireForReadAhead(IN PVOID Context, IN BOOLEAN Wait)
Definition: cmcb.c:92
NTSTATUS Ext2AcquireFileForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1135
VOID Ext2ReleaseFromReadAhead(IN PVOID Context)
Definition: cmcb.c:117
#define CDROM_NAME
Definition: ext2fs.h:138
void ext2_destroy_linux()
Definition: linux.c:1019
BOOLEAN Ext2FastIoUnlockAll(IN PFILE_OBJECT FileObject, IN PEPROCESS Process, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:736
int ext2_init_linux()
Definition: linux.c:1004
BOOLEAN Ext2FastIoCheckIfPossible(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN BOOLEAN CheckForReadOperation, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:64
VOID Ext2StopReaper(PEXT2_REAPER Reaper)
Definition: memory.c:3546
VOID Ext2FcbReaperThread(PVOID Context)
Definition: memory.c:3391
struct _EXT2_FCB EXT2_FCB
BOOLEAN Ext2FastIoQueryNetworkOpenInfo(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_NETWORK_OPEN_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
#define DL_ERR
Definition: ext2fs.h:1434
VOID Ext2ReleaseForCreateSection(IN PFILE_OBJECT FileObject)
Definition: fastio.c:1062
struct ext3_dir_entry_2 EXT2_DIR_ENTRY2
Definition: ext2fs.h:109
VOID Ext2NoOpRelease(IN PVOID Fcb)
Definition: cmcb.c:153
NTSTATUS Ext2BuildRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct _EXT2_MCB EXT2_MCB
Definition: ext2fs.h:484
BOOLEAN Ext2FastIoUnlockSingle(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:629
struct _EXT2_RW_CONTEXT EXT2_RW_CONTEXT
#define DL_FUN
Definition: ext2fs.h:1437
#define EXT2_DEBUG
Definition: ext2fs.h:34
NTSTATUS Ext2AcquireFileForModWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER EndingOffset, OUT PERESOURCE *ResourceToRelease, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:1081
Status
Definition: gdiplustypes.h:25
#define DbgPrint
Definition: hal.h:12
static DRIVER_UNLOAD DriverUnload
Definition: kbdclass.c:17
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
static char DosDeviceName[DEVICE_SIZE]
Definition: lsdd.c:26
MM_SYSTEMSIZE NTAPI MmQuerySystemSize(VOID)
Definition: mmsup.c:257
#define ASSERT(a)
Definition: mode.c:44
struct nls_table * load_nls(char *)
Definition: nls_base.c:218
#define LOAD_MODULE(X)
Definition: module.h:284
#define UNLOAD_MODULE(X)
Definition: module.h:288
#define _WIN2K_TARGET_
Definition: module.h:23
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI FsRtlRegisterFileSystemFilterCallbacks(PDRIVER_OBJECT FilterDriverObject, PFS_FILTER_CALLBACKS Callbacks)
Definition: fastio.c:2008
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
FAST_IO_DISPATCH FastIoDispatch
Definition: null.c:15
#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
static void __exit journal_exit(void)
Definition: replay.c:1641
static int __init journal_init(void)
Definition: replay.c:1628
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
FAST_IO_DISPATCH FastIoDispatch
Definition: ext2fs.h:526
CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks
Definition: ext2fs.h:533
NPAGED_LOOKASIDE_LIST Ext2ExtLookasideList
Definition: ext2fs.h:557
NPAGED_LOOKASIDE_LIST Ext2McbLookasideList
Definition: ext2fs.h:556
NPAGED_LOOKASIDE_LIST Ext2IrpContextLookasideList
Definition: ext2fs.h:553
NPAGED_LOOKASIDE_LIST Ext2FcbLookasideList
Definition: ext2fs.h:554
EXT2_IDENTIFIER Identifier
Definition: ext2fs.h:516
struct _EXT2_GLOBAL::@697 Codepage
FS_FILTER_CALLBACKS FilterCallbacks
Definition: ext2fs.h:529
PDEVICE_OBJECT DiskdevObject
Definition: ext2fs.h:539
NPAGED_LOOKASIDE_LIST Ext2DentryLookasideList
Definition: ext2fs.h:558
EXT2_REAPER bhReaper
Definition: ext2fs.h:550
USHORT MaxDepth
Definition: ext2fs.h:559
EXT2_PERF_STATISTICS_V2 PerfStat
Definition: ext2fs.h:582
NPAGED_LOOKASIDE_LIST Ext2CcbLookasideList
Definition: ext2fs.h:555
ERESOURCE Resource
Definition: ext2fs.h:519
EXT2_REAPER McbReaper
Definition: ext2fs.h:549
CACHE_MANAGER_CALLBACKS CacheManagerCallbacks
Definition: ext2fs.h:532
LIST_ENTRY VcbList
Definition: ext2fs.h:545
EXT2_REAPER FcbReaper
Definition: ext2fs.h:548
PDEVICE_OBJECT CdromdevObject
Definition: ext2fs.h:542
EXT2_IDENTIFIER_TYPE Type
Definition: ext2fs.h:477
EXT2_STAT_ARRAY_V2 Unit
Definition: common.h:131
PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite
Definition: iotypes.h:1748
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_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
ULONG SizeOfFastIoDispatch
Definition: iotypes.h:1733
PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection
Definition: iotypes.h:1744
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_RELEASE_FILE ReleaseFileForNtCreateSection
Definition: iotypes.h:1745
PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite
Definition: iotypes.h:1758
PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible
Definition: iotypes.h:1734
ULONG SizeOfFsFilterCallbacks
Definition: iotypes.h:7426
PFS_FILTER_CALLBACK PreAcquireForSectionSynchronization
Definition: iotypes.h:7428
Definition: fs.h:117
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG Slot[PS_MAX_TYPE_V2]
Definition: common.h:67
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_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
#define IRP_MJ_QUERY_EA
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MJ_SET_VOLUME_INFORMATION
#define IRP_MJ_SET_EA
struct _FS_FILTER_CALLBACKS FS_FILTER_CALLBACKS
struct _VPB VPB
struct _FAST_IO_DISPATCH FAST_IO_DISPATCH
#define IRP_MJ_FLUSH_BUFFERS
#define IRP_MJ_SHUTDOWN
#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

◆ Ext2EresourceAlignmentChecking()

VOID Ext2EresourceAlignmentChecking ( )

Definition at line 436 of file init.c.

437{
438 /* Verify ERESOURCE alignment in structures */
440 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, MainResource) & 7) == 0);
441 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, PagingIoResource) & 7) == 0);
442 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, MetaInode) & 7) == 0);
443 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, MetaBlock) & 7) == 0);
444 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, McbLock) & 7) == 0);
445 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, FcbLock) & 7) == 0);
446 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, bd.bd_bh_lock) & 7) == 0);
447 CL_ASSERT((FIELD_OFFSET(EXT2_VCB, sbi.s_gd_lock) & 7) == 0);
448 CL_ASSERT((FIELD_OFFSET(EXT2_FCBVCB, MainResource) & 7) == 0);
449 CL_ASSERT((FIELD_OFFSET(EXT2_FCBVCB, PagingIoResource) & 7) == 0);
450 CL_ASSERT((FIELD_OFFSET(EXT2_FCB, MainResource) & 7) == 0);
451 CL_ASSERT((FIELD_OFFSET(EXT2_FCB, PagingIoResource) & 7) == 0);
452}
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
#define CL_ASSERT(cond)
Definition: ext2fs.h:132

◆ Ext2QueryGlobalParameters()

NTSTATUS Ext2QueryGlobalParameters ( IN PUNICODE_STRING  RegistryPath)

Definition at line 199 of file init.c.

200{
202 int i = 0;
204
206
207 /*
208 * 1 writing support
209 */
210 QueryTable[i].Flags = 0;
217 i++;
218
219 /*
220 * 2 checking bitmap
221 */
222 QueryTable[i].Flags = 0;
229 i++;
230
231 /*
232 * 3 force writing
233 */
234 QueryTable[i].Flags = 0;
241 i++;
242
243 /*
244 * 4 automount
245 */
246 QueryTable[i].Flags = 0;
253 i++;
254
255 /*
256 * 5 codepage
257 */
258 QueryTable[i].Flags = 0;
265 i++;
266
267 /*
268 * 6 hidden prefix
269 */
270 QueryTable[i].Flags = 0;
277 i++;
278
279
280 /*
281 * 7 hidden suffix
282 */
283 QueryTable[i].Flags = 0;
290 i++;
291
294 RegistryPath->Buffer,
295 &QueryTable[0],
296 NULL,
297 NULL
298 );
299
300 return NT_SUCCESS(Status);
301}
NTSTATUS Ext2RegistryQueryCallback(IN PWSTR ValueName, IN ULONG ValueType, IN PVOID ValueData, IN ULONG ValueLength, IN PVOID Context, IN PVOID EntryContext)
Definition: init.c:115
#define AUTO_MOUNT
Definition: ext2fs.h:152
#define HIDING_PREFIX
Definition: ext2fs.h:150
#define CHECKING_BITMAP
Definition: ext2fs.h:147
#define HIDING_SUFFIX
Definition: ext2fs.h:151
#define CODEPAGE_NAME
Definition: ext2fs.h:149
#define EXT3_FORCEWRITING
Definition: ext2fs.h:148
#define WRITING_SUPPORT
Definition: ext2fs.h:146
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
Definition: rtlfuncs.h:4220
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
#define REG_NONE
Definition: nt_native.h:1492
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
Definition: nt_native.h:109

Referenced by Ext2QueryRegistrySettings().

◆ Ext2QueryRegistrySettings()

BOOLEAN Ext2QueryRegistrySettings ( IN PUNICODE_STRING  RegistryPath)

Definition at line 305 of file init.c.

306{
307 UNICODE_STRING ParameterPath;
308 UNICODE_STRING UniName;
309 ANSI_STRING AnsiName;
310
311 ULONG WritingSupport = 0;
312 ULONG CheckingBitmap = 0;
313 ULONG Ext3ForceWriting = 0;
314 ULONG AutoMount = 0;
315
316 WCHAR UniBuffer[CODEPAGE_MAXLEN];
318
320
321 ParameterPath.Length = 0;
322 ParameterPath.MaximumLength =
323 RegistryPath->Length + sizeof(PARAMETERS_KEY) + sizeof(WCHAR);
324 ParameterPath.Buffer =
326 PagedPool,
327 ParameterPath.MaximumLength,
328 'LG2E'
329 );
330 if (!ParameterPath.Buffer) {
331 DbgBreak();
332 DEBUG(DL_ERR, ( "Ex2QueryParameters: failed to allocate Parameters...\n"));
333 return FALSE;
334 }
335
336 RtlCopyUnicodeString(&ParameterPath, RegistryPath);
338
339 /* enable automount of ext2/3/4 volumes */
341
342 /* query parameter settings from registry */
343 Ext2QueryGlobalParameters(&ParameterPath);
344
345 /* set global codepage settings */
346 if (wcslen(&Ext2Global->Codepage.PageName[0])) {
347 UniName.Length = sizeof(WCHAR) * wcslen(&Ext2Global->Codepage.PageName[0]);
348 UniName.MaximumLength = CODEPAGE_MAXLEN * sizeof(WCHAR);
349 UniName.Buffer = &Ext2Global->Codepage.PageName[0];
351 AnsiName.Length = 0;
352 AnsiName.Buffer = &Ext2Global->Codepage.AnsiName[0];
354 &AnsiName,
355 &UniName,
356 FALSE);
357 if (!NT_SUCCESS(Status)) {
358 DEBUG(DL_ERR, ( "Ext2QueryParameters: Wrong CodePage %wZ ...\n", &UniName));
359 RtlCopyMemory(&(Ext2Global->Codepage.AnsiName[0]),"default\0", 8);
360 }
361 } else {
362 DEBUG(DL_ERR, ( "Ext2QueryParameters: CodePage not specified.\n"));
363 RtlCopyMemory(&(Ext2Global->Codepage.AnsiName[0]),"default\0", 8);
364 }
365 Ext2Global->Codepage.AnsiName[CODEPAGE_MAXLEN - 1] = 0;
366
367
368 /* set global hidden prefix pattern */
369 if (wcslen(&Ext2Global->wHidingPrefix[0])) {
370 UniName.Length = sizeof(WCHAR) * wcslen(&Ext2Global->wHidingPrefix[0]);
371 UniName.MaximumLength = HIDINGPAT_LEN * sizeof(WCHAR);
372 UniName.Buffer = &Ext2Global->wHidingPrefix[0];
373 AnsiName.MaximumLength = HIDINGPAT_LEN;
374 AnsiName.Length = 0;
375 AnsiName.Buffer = &(Ext2Global->sHidingPrefix[0]);
376
378 &AnsiName,
379 &UniName,
380 FALSE);
381 if (NT_SUCCESS(Status)) {
383 } else {
384 DEBUG(DL_ERR, ( "Ext2QueryParameters: Wrong HidingPrefix ...\n"));
385 }
386 } else {
387 DEBUG(DL_ERR, ( "Ext2QueryParameters: HidingPrefix not specified.\n"));
388 }
390
391
392 /* set global hidden suffix pattern */
393 if (wcslen(&Ext2Global->wHidingSuffix[0])) {
394 UniName.Length = sizeof(WCHAR) * wcslen(&Ext2Global->wHidingSuffix[0]);
395 UniName.MaximumLength = HIDINGPAT_LEN * sizeof(WCHAR);
396 UniName.Buffer = &Ext2Global->wHidingSuffix[0];
397 AnsiName.MaximumLength = HIDINGPAT_LEN;
398 AnsiName.Length = 0;
399 AnsiName.Buffer = &(Ext2Global->sHidingSuffix[0]);
400
402 &AnsiName,
403 &UniName,
404 FALSE);
405 if (NT_SUCCESS(Status)) {
407 } else {
408 DEBUG(DL_ERR, ( "Ext2QueryParameters: Wrong HidingSuffix ...\n"));
409 }
410 } else {
411 DEBUG(DL_ERR, ( "Ext2QueryParameters: HidingSuffix not specified.\n"));
412 }
414
415 Ext2Global->RegistryPath.Buffer = ParameterPath.Buffer;
420
421 return TRUE;
422}
Definition: bufpool.h:45
#define HIDINGPAT_LEN
Definition: common.h:160
#define CODEPAGE_MAXLEN
Definition: common.h:159
NTSTATUS Ext2QueryGlobalParameters(IN PUNICODE_STRING RegistryPath)
Definition: init.c:199
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
#define PagedPool
Definition: env_spec_w32.h:308
#define VOLUMES_KEY
Definition: ext2fs.h:143
#define PARAMETERS_KEY
Definition: ext2fs.h:142
#define SetLongFlag(_F, _SF)
Definition: ext2fs.h:258
#define DbgBreak()
Definition: ext2fs.h:46
#define EXT2_AUTO_MOUNT
Definition: ext2fs.h:594
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
unsigned short USHORT
Definition: pedump.c:61
USHORT MaximumLength
Definition: env_spec_w32.h:377
UNICODE_STRING RegistryPath
Definition: ext2fs.h:577
WCHAR wHidingSuffix[HIDINGPAT_LEN]
Definition: ext2fs.h:570
CHAR sHidingSuffix[HIDINGPAT_LEN]
Definition: ext2fs.h:574
BOOLEAN bHidingSuffix
Definition: ext2fs.h:573
ULONG Flags
Definition: ext2fs.h:523
WCHAR wHidingPrefix[HIDINGPAT_LEN]
Definition: ext2fs.h:569
BOOLEAN bHidingPrefix
Definition: ext2fs.h:571
CHAR sHidingPrefix[HIDINGPAT_LEN]
Definition: ext2fs.h:572
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DriverEntry().

◆ Ext2RegistryQueryCallback()

NTSTATUS Ext2RegistryQueryCallback ( IN PWSTR  ValueName,
IN ULONG  ValueType,
IN PVOID  ValueData,
IN ULONG  ValueLength,
IN PVOID  Context,
IN PVOID  EntryContext 
)

Definition at line 115 of file init.c.

123{
124 ULONG i = 0;
125 BYTE *s, *t;
126
127 if (NULL == ValueName || NULL == ValueData)
128 return STATUS_SUCCESS;
129
132
133 if (ValueData && ValueLength == sizeof(DWORD)) {
134 if (*((PULONG)ValueData)) {
136 } else {
138 }
139 }
142
143 if (ValueData && ValueLength == sizeof(DWORD)) {
144 if (*((PULONG)ValueData)) {
146 } else {
148 }
149 }
152
153 if (ValueData && ValueLength == sizeof(DWORD)) {
154 if (*((PULONG)ValueData)) {
157 } else {
159 }
160 }
161 } else if (ValueType == REG_DWORD && wcslen(ValueName) == wcslen(AUTO_MOUNT) &&
163
164 if (ValueData && ValueLength == sizeof(DWORD)) {
165 if (*((PULONG)ValueData)) {
167 } else {
169 }
170 }
171 } else if (ValueType == REG_SZ && wcslen(ValueName) == wcslen(CODEPAGE_NAME) &&
173
174 if (ValueData && ValueLength <= sizeof(WCHAR) * CODEPAGE_MAXLEN) {
175 RtlCopyMemory(&Ext2Global->Codepage.PageName[0],
177 }
178 } else if (ValueType == REG_SZ && wcslen(ValueName) == wcslen(HIDING_PREFIX) &&
180
181 if (ValueData && ValueLength <= sizeof(WCHAR) * HIDINGPAT_LEN) {
184 }
185 } else if (ValueType == REG_SZ && wcslen(ValueName) == wcslen(HIDING_SUFFIX) &&
187
188 if (ValueData && ValueLength <= sizeof(WCHAR) * HIDINGPAT_LEN) {
191 }
192 }
193
194
195 return STATUS_SUCCESS;
196}
#define EXT2_CHECKING_BITMAP
Definition: ext2fs.h:593
#define ClearLongFlag(_F, _SF)
Definition: ext2fs.h:259
#define EXT2_SUPPORT_WRITING
Definition: ext2fs.h:591
#define EXT3_FORCE_WRITING
Definition: ext2fs.h:592
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039
GLdouble GLdouble t
Definition: gl.h:2047
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:312
#define REG_SZ
Definition: layer.c:22
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t * PULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
Definition: wdfregistry.h:282
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:275
unsigned char BYTE
Definition: xxhash.c:193

Referenced by Ext2QueryGlobalParameters().

Variable Documentation

◆ Ext2Global

◆ gDate

CHAR gDate[] = __DATE__

Definition at line 24 of file init.c.

Referenced by Ext2ProcessGlobalProperty().

◆ gTime

CHAR gTime[] = __TIME__

Definition at line 23 of file init.c.

Referenced by Ext2ProcessGlobalProperty().

◆ gVersion

CHAR gVersion[] = EXT2FSD_VERSION

Definition at line 22 of file init.c.