00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef _FSRTL_
00022
#define _FSRTL_
00023
00024
00025
00026
00027
00028
00029 typedef ULONG
LBN;
00030 typedef LBN *
PLBN;
00031
00032 typedef ULONG
VBN;
00033 typedef VBN *
PVBN;
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
NTKERNELAPI
00044 BOOLEAN
00045
FsRtlInitSystem (
00046 );
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 typedef enum _FAST_IO_POSSIBLE {
00059
FastIoIsNotPossible = 0,
00060
FastIoIsPossible,
00061
FastIoIsQuestionable
00062 }
FAST_IO_POSSIBLE;
00063
00064
00065
00066
00067
00068 typedef struct _FSRTL_COMMON_FCB_HEADER {
00069
00070 CSHORT
NodeTypeCode;
00071 CSHORT
NodeByteSize;
00072
00073
00074
00075
00076
00077 UCHAR
Flags;
00078
00079
00080
00081
00082
00083
00084
00085 UCHAR
IsFastIoPossible;
00086
00087
00088
00089
00090
00091 UCHAR
Flags2;
00092
00093
00094
00095
00096
00097 UCHAR
Reserved;
00098
00099 PERESOURCE Resource;
00100
00101 PERESOURCE PagingIoResource;
00102
00103 LARGE_INTEGER
AllocationSize;
00104 LARGE_INTEGER
FileSize;
00105 LARGE_INTEGER
ValidDataLength;
00106
00107
00108
00109
#ifndef BUILDING_FSKDEXT
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 PFAST_MUTEX FastMutex;
00134
00135
00136
00137
00138
00139
00140
00141 LIST_ENTRY
FilterContexts;
00142
00143
#endif
00144
00145
00146 }
FSRTL_COMMON_FCB_HEADER;
00147 typedef FSRTL_COMMON_FCB_HEADER *
PFSRTL_COMMON_FCB_HEADER;
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
#ifdef __cplusplus
00160
typedef struct _FSRTL_ADVANCED_FCB_HEADER:
FSRTL_COMMON_FCB_HEADER {
00161
#else // __cplusplus
00162
00163 typedef struct _FSRTL_ADVANCED_FCB_HEADER {
00164
00165
00166
00167
00168
00169 FSRTL_COMMON_FCB_HEADER ;
00170
00171
#endif // __cplusplus
00172
00173
00174
00175
00176
00177
00178
00179 PLIST_ENTRY PendingEofAdvances;
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 PFILE_OBJECT FileObjectC;
00193
00194
00195
00196
00197
00198
00199 PSECTION_OBJECT_POINTERS SectionObjectPointers;
00200
00201 }
FSRTL_ADVANCED_FCB_HEADER;
00202 typedef FSRTL_ADVANCED_FCB_HEADER *
PFSRTL_ADVANCED_FCB_HEADER;
00203
00204
00205
00206
00207
00208
00209 #define FSRTL_FLAG_FILE_MODIFIED (0x01)
00210 #define FSRTL_FLAG_FILE_LENGTH_CHANGED (0x02)
00211 #define FSRTL_FLAG_LIMIT_MODIFIED_PAGES (0x04)
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX (0x08)
00222 #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH (0x10)
00223
00224
00225
00226
00227
00228
00229 #define FSRTL_FLAG_USER_MAPPED_FILE (0x20)
00230
00231
00232
00233
00234
00235
00236 #define FSRTL_FLAG_ADVANCED_HEADER (0x40)
00237
00238
00239
00240
00241
00242
00243 #define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80)
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 #define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01)
00257
00258
00259
00260
00261
00262
00263
00264
00265 #define FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS (0x02)
00266
00267
00268
00269
00270
00271
00272 #define FSRTL_FLAG2_PURGE_WHEN_MAPPED (0x04)
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282 #define FSRTL_FSP_TOP_LEVEL_IRP 0x01
00283 #define FSRTL_CACHE_TOP_LEVEL_IRP 0x02
00284 #define FSRTL_MOD_WRITE_TOP_LEVEL_IRP 0x03
00285 #define FSRTL_FAST_IO_TOP_LEVEL_IRP 0x04
00286 #define FSRTL_MAX_TOP_LEVEL_IRP_FLAG 0x04
00287
00288
00289
00290
00291
00292
00293 typedef struct _EOF_WAIT_BLOCK {
00294
00295 LIST_ENTRY EofWaitLinks;
00296 KEVENT Event;
00297
00298 }
EOF_WAIT_BLOCK;
00299
00300 typedef EOF_WAIT_BLOCK *
PEOF_WAIT_BLOCK;
00301
00302
00303
00304
00305
00306
00307
NTKERNELAPI
00308 BOOLEAN
00309
FsRtlCopyRead (
00310 IN
PFILE_OBJECT FileObject,
00311 IN PLARGE_INTEGER FileOffset,
00312 IN ULONG Length,
00313 IN BOOLEAN Wait,
00314 IN ULONG LockKey,
00315 OUT PVOID Buffer,
00316 OUT PIO_STATUS_BLOCK IoStatus,
00317 IN
PDEVICE_OBJECT DeviceObject
00318 );
00319
00320
NTKERNELAPI
00321 BOOLEAN
00322
FsRtlCopyWrite (
00323 IN
PFILE_OBJECT FileObject,
00324 IN PLARGE_INTEGER FileOffset,
00325 IN ULONG Length,
00326 IN BOOLEAN Wait,
00327 IN ULONG LockKey,
00328 IN PVOID Buffer,
00329 OUT PIO_STATUS_BLOCK IoStatus,
00330 IN
PDEVICE_OBJECT DeviceObject
00331 );
00332
00333
00334
00335
NTKERNELAPI
00336 BOOLEAN
00337
FsRtlMdlRead (
00338 IN
PFILE_OBJECT FileObject,
00339 IN PLARGE_INTEGER FileOffset,
00340 IN ULONG Length,
00341 IN ULONG LockKey,
00342 OUT
PMDL *MdlChain,
00343 OUT PIO_STATUS_BLOCK IoStatus
00344 );
00345
00346 BOOLEAN
00347
FsRtlMdlReadComplete (
00348 IN
PFILE_OBJECT FileObject,
00349 IN
PMDL MdlChain
00350 );
00351
00352
NTKERNELAPI
00353 BOOLEAN
00354
FsRtlPrepareMdlWrite (
00355 IN
PFILE_OBJECT FileObject,
00356 IN PLARGE_INTEGER FileOffset,
00357 IN ULONG Length,
00358 IN ULONG LockKey,
00359 OUT
PMDL *MdlChain,
00360 OUT PIO_STATUS_BLOCK IoStatus
00361 );
00362
00363 BOOLEAN
00364
FsRtlMdlWriteComplete (
00365 IN
PFILE_OBJECT FileObject,
00366 IN PLARGE_INTEGER FileOffset,
00367 IN
PMDL MdlChain
00368 );
00369
00370
00371
00372
NTKERNELAPI
00373 BOOLEAN
00374
FsRtlMdlReadDev (
00375 IN
PFILE_OBJECT FileObject,
00376 IN PLARGE_INTEGER FileOffset,
00377 IN ULONG Length,
00378 IN ULONG LockKey,
00379 OUT
PMDL *MdlChain,
00380 OUT PIO_STATUS_BLOCK IoStatus,
00381 IN
PDEVICE_OBJECT DeviceObject
00382 );
00383
00384
NTKERNELAPI
00385 BOOLEAN
00386
FsRtlMdlReadCompleteDev (
00387 IN
PFILE_OBJECT FileObject,
00388 IN
PMDL MdlChain,
00389 IN
PDEVICE_OBJECT DeviceObject
00390 );
00391
00392
NTKERNELAPI
00393 BOOLEAN
00394
FsRtlPrepareMdlWriteDev (
00395 IN
PFILE_OBJECT FileObject,
00396 IN PLARGE_INTEGER FileOffset,
00397 IN ULONG Length,
00398 IN ULONG LockKey,
00399 OUT
PMDL *MdlChain,
00400 OUT PIO_STATUS_BLOCK IoStatus,
00401 IN
PDEVICE_OBJECT DeviceObject
00402 );
00403
00404
NTKERNELAPI
00405 BOOLEAN
00406
FsRtlMdlWriteCompleteDev (
00407 IN
PFILE_OBJECT FileObject,
00408 IN PLARGE_INTEGER FileOffset,
00409 IN
PMDL MdlChain,
00410 IN
PDEVICE_OBJECT DeviceObject
00411 );
00412
00413
00414
00415
00416
00417
00418
00419
00420 typedef struct _FSRTL_AUXILIARY_BUFFER {
00421
00422
00423
00424
00425
00426 PVOID
Buffer;
00427 ULONG Length;
00428
00429
00430
00431
00432
00433 ULONG Flags;
00434
00435
00436
00437
00438
00439 PMDL Mdl;
00440
00441 }
FSRTL_AUXILIARY_BUFFER;
00442 typedef FSRTL_AUXILIARY_BUFFER *
PFSRTL_AUXILIARY_BUFFER;
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453 #define FSRTL_AUXILIARY_FLAG_DEALLOCATE 0x00000001
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465 #define FsRtlSetTopLevelIrpForModWriter() { \
00466
IoSetTopLevelIrp((PIRP)FSRTL_MOD_WRITE_TOP_LEVEL_IRP); \
00467
}
00468
00469
NTKERNELAPI
00470 BOOLEAN
00471
FsRtlAcquireFileForModWrite (
00472 IN
PFILE_OBJECT FileObject,
00473 IN PLARGE_INTEGER StartingOffset,
00474 OUT
PERESOURCE *ResourceToRelease
00475 );
00476
00477
NTKERNELAPI
00478
VOID
00479
FsRtlReleaseFileForModWrite (
00480 IN
PFILE_OBJECT FileObject,
00481 IN
PERESOURCE ResourceToRelease
00482 );
00483
00484
NTKERNELAPI
00485
VOID
00486
FsRtlAcquireFileForCcFlush (
00487 IN
PFILE_OBJECT FileObject
00488 );
00489
00490
NTKERNELAPI
00491
VOID
00492
FsRtlReleaseFileForCcFlush (
00493 IN
PFILE_OBJECT FileObject
00494 );
00495
00496
00497
00498
00499
00500
00501
00502
NTKERNELAPI
00503
VOID
00504
FsRtlAcquireFileExclusive (
00505 IN
PFILE_OBJECT FileObject
00506 );
00507
00508
NTKERNELAPI
00509
VOID
00510
FsRtlReleaseFile (
00511 IN
PFILE_OBJECT FileObject
00512 );
00513
00514
00515
00516
00517
00518
00519
NTSTATUS
00520
FsRtlGetFileSize(
00521 IN
PFILE_OBJECT FileObject,
00522 IN OUT PLARGE_INTEGER FileSize
00523 );
00524
00525
00526
00527
NTSTATUS
00528
FsRtlSetFileSize(
00529 IN
PFILE_OBJECT FileObject,
00530 IN OUT PLARGE_INTEGER FileSize
00531 );
00532
00533
00534
00535
00536
00537
00538
NTKERNELAPI
00539 BOOLEAN
00540
FsRtlIsTotalDeviceFailure(
00541 IN NTSTATUS Status
00542 );
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553 typedef struct _FILE_LOCK_INFO {
00554
00555
00556
00557
00558
00559
00560 LARGE_INTEGER StartingByte;
00561 LARGE_INTEGER Length;
00562 BOOLEAN ExclusiveLock;
00563
00564
00565
00566
00567
00568 ULONG
Key;
00569 PFILE_OBJECT FileObject;
00570 PVOID ProcessId;
00571
00572
00573
00574
00575
00576 LARGE_INTEGER EndingByte;
00577
00578 }
FILE_LOCK_INFO;
00579 typedef FILE_LOCK_INFO *
PFILE_LOCK_INFO;
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591 typedef NTSTATUS (*PCOMPLETE_LOCK_IRP_ROUTINE) (
00592 IN PVOID Context,
00593 IN
PIRP Irp
00594 );
00595
00596 typedef VOID (*PUNLOCK_ROUTINE) (
00597 IN PVOID Context,
00598 IN
PFILE_LOCK_INFO FileLockInfo
00599 );
00600
00601
00602
00603
00604
00605
00606 typedef struct _FILE_LOCK {
00607
00608
00609
00610
00611
00612 PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine;
00613
00614
00615
00616
00617
00618 PUNLOCK_ROUTINE UnlockRoutine;
00619
00620
00621
00622
00623
00624 BOOLEAN
FastIoIsQuestionable;
00625 BOOLEAN SpareC[3];
00626
00627
00628
00629
00630
00631 PVOID LockInformation;
00632
00633
00634
00635
00636
00637 FILE_LOCK_INFO LastReturnedLockInfo;
00638 PVOID LastReturnedLock;
00639
00640 }
FILE_LOCK;
00641 typedef FILE_LOCK *
PFILE_LOCK;
00642
00643
PFILE_LOCK
00644
FsRtlAllocateFileLock (
00645 IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL,
00646 IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL
00647 );
00648
00649
VOID
00650
FsRtlFreeFileLock (
00651 IN
PFILE_LOCK FileLock
00652 );
00653
00654
NTKERNELAPI
00655
VOID
00656
FsRtlInitializeFileLock (
00657 IN
PFILE_LOCK FileLock,
00658 IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL,
00659 IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL
00660 );
00661
00662
NTKERNELAPI
00663
VOID
00664
FsRtlUninitializeFileLock (
00665 IN
PFILE_LOCK FileLock
00666 );
00667
00668
NTKERNELAPI
00669
NTSTATUS
00670
FsRtlProcessFileLock (
00671 IN
PFILE_LOCK FileLock,
00672 IN
PIRP Irp,
00673 IN PVOID Context OPTIONAL
00674 );
00675
00676
NTKERNELAPI
00677 BOOLEAN
00678
FsRtlCheckLockForReadAccess (
00679 IN
PFILE_LOCK FileLock,
00680 IN
PIRP Irp
00681 );
00682
00683
NTKERNELAPI
00684 BOOLEAN
00685
FsRtlCheckLockForWriteAccess (
00686 IN
PFILE_LOCK FileLock,
00687 IN
PIRP Irp
00688 );
00689
00690
NTKERNELAPI
00691 BOOLEAN
00692
FsRtlFastCheckLockForRead (
00693 IN
PFILE_LOCK FileLock,
00694 IN PLARGE_INTEGER StartingByte,
00695 IN PLARGE_INTEGER Length,
00696 IN ULONG Key,
00697 IN
PFILE_OBJECT FileObject,
00698 IN PVOID ProcessId
00699 );
00700
00701
NTKERNELAPI
00702 BOOLEAN
00703
FsRtlFastCheckLockForWrite (
00704 IN
PFILE_LOCK FileLock,
00705 IN PLARGE_INTEGER StartingByte,
00706 IN PLARGE_INTEGER Length,
00707 IN ULONG Key,
00708 IN PVOID FileObject,
00709 IN PVOID ProcessId
00710 );
00711
00712
NTKERNELAPI
00713
PFILE_LOCK_INFO
00714
FsRtlGetNextFileLock (
00715 IN
PFILE_LOCK FileLock,
00716 IN BOOLEAN Restart
00717 );
00718
00719
NTKERNELAPI
00720
NTSTATUS
00721
FsRtlFastUnlockSingle (
00722 IN
PFILE_LOCK FileLock,
00723 IN
PFILE_OBJECT FileObject,
00724 IN LARGE_INTEGER UNALIGNED *FileOffset,
00725 IN PLARGE_INTEGER Length,
00726 IN
PEPROCESS ProcessId,
00727 IN ULONG Key,
00728 IN PVOID Context OPTIONAL,
00729 IN BOOLEAN AlreadySynchronized
00730 );
00731
00732
NTKERNELAPI
00733
NTSTATUS
00734
FsRtlFastUnlockAll (
00735 IN
PFILE_LOCK FileLock,
00736 IN
PFILE_OBJECT FileObject,
00737 IN
PEPROCESS ProcessId,
00738 IN PVOID Context OPTIONAL
00739 );
00740
00741
NTKERNELAPI
00742
NTSTATUS
00743
FsRtlFastUnlockAllByKey (
00744 IN
PFILE_LOCK FileLock,
00745 IN
PFILE_OBJECT FileObject,
00746 IN
PEPROCESS ProcessId,
00747 IN ULONG Key,
00748 IN PVOID Context OPTIONAL
00749 );
00750
00751
NTKERNELAPI
00752 BOOLEAN
00753
FsRtlPrivateLock (
00754 IN
PFILE_LOCK FileLock,
00755 IN
PFILE_OBJECT FileObject,
00756 IN PLARGE_INTEGER FileOffset,
00757 IN PLARGE_INTEGER Length,
00758 IN
PEPROCESS ProcessId,
00759 IN ULONG Key,
00760 IN BOOLEAN FailImmediately,
00761 IN BOOLEAN ExclusiveLock,
00762 OUT PIO_STATUS_BLOCK Iosb,
00763 IN
PIRP Irp,
00764 IN PVOID Context,
00765 IN BOOLEAN AlreadySynchronized
00766 );
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785 #define FsRtlFastLock(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) ( \
00786
FsRtlPrivateLock( A1, \
00787 A2, \
00788 A3, \
00789 A4, \
00790 A5, \
00791 A6, \
00792 A7, \
00793 A8, \
00794 A9, \
00795 NULL, \
00796 A10, \
00797 A11 ) \
00798 )
00799
00800
00801
00802
00803
00804
00805
00806
00807 #define FsRtlAreThereCurrentFileLocks(FL) ( \
00808
((FL)->FastIoIsQuestionable))
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820 typedef struct {
00821
00822
00823
00824
00825
00826 FAST_MUTEX Mutex;
00827
00828
00829
00830
00831
00832
00833 PRTL_SPLAY_LINKS Cache;
00834
00835
00836
00837
00838
00839 LIST_ENTRY TimerQueue;
00840
00841
00842
00843
00844
00845
00846 USHORT NumEntries;
00847
00848 }
TUNNEL, *
PTUNNEL;
00849
00850
NTKERNELAPI
00851
VOID
00852
FsRtlInitializeTunnelCache (
00853 IN
TUNNEL *Cache);
00854
00855
NTKERNELAPI
00856
VOID
00857
FsRtlAddToTunnelCache (
00858 IN
TUNNEL *Cache,
00859 IN ULONGLONG DirectoryKey,
00860 IN UNICODE_STRING *ShortName,
00861 IN UNICODE_STRING *LongName,
00862 IN BOOLEAN KeyByShortName,
00863 IN ULONG DataLength,
00864 IN VOID *Data);
00865
00866
NTKERNELAPI
00867 BOOLEAN
00868
FsRtlFindInTunnelCache (
00869 IN
TUNNEL *Cache,
00870 IN ULONGLONG DirectoryKey,
00871 IN UNICODE_STRING *Name,
00872 OUT UNICODE_STRING *ShortName,
00873 OUT UNICODE_STRING *LongName,
00874 IN OUT ULONG *DataLength,
00875 OUT VOID *Data);
00876
00877
00878
NTKERNELAPI
00879
VOID
00880
FsRtlDeleteKeyFromTunnelCache (
00881 IN
TUNNEL *Cache,
00882 IN ULONGLONG DirectoryKey);
00883
00884
00885
NTKERNELAPI
00886
VOID
00887
FsRtlDeleteTunnelCache (
00888 IN
TUNNEL *Cache);
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900 typedef enum _FSRTL_COMPARISON_RESULT {
00901
LessThan = -1,
00902
EqualTo = 0,
00903
GreaterThan = 1
00904 }
FSRTL_COMPARISON_RESULT;
00905
00906
#ifdef NLS_MB_CODE_PAGE_TAG
00907
#undef NLS_MB_CODE_PAGE_TAG
00908
#endif // NLS_MB_CODE_PAGE_TAG
00909
00910
00911
#if defined(_NTIFS_) || defined(_NTDRIVER_)
00912
00913
00914
#define LEGAL_ANSI_CHARACTER_ARRAY (*FsRtlLegalAnsiCharacterArray)
00915
#define NLS_MB_CODE_PAGE_TAG (*NlsMbOemCodePageTag)
00916
#define NLS_OEM_LEAD_BYTE_INFO (*NlsOemLeadByteInfo)
00917
00918
00919
#else
00920
00921 #define LEGAL_ANSI_CHARACTER_ARRAY FsRtlLegalAnsiCharacterArray
00922 #define NLS_MB_CODE_PAGE_TAG NlsMbOemCodePageTag
00923 #define NLS_OEM_LEAD_BYTE_INFO NlsOemLeadByteInfo
00924
00925
#endif
00926
00927
00928 extern PUCHAR
LEGAL_ANSI_CHARACTER_ARRAY;
00929 extern PUSHORT NLS_OEM_LEAD_BYTE_INFO;
00930
00931
00932
00933
00934
00935 #define FSRTL_FAT_LEGAL 0x01
00936 #define FSRTL_HPFS_LEGAL 0x02
00937 #define FSRTL_NTFS_LEGAL 0x04
00938 #define FSRTL_WILD_CHARACTER 0x08
00939 #define FSRTL_OLE_LEGAL 0x10
00940 #define FSRTL_NTFS_STREAM_LEGAL (FSRTL_NTFS_LEGAL | FSRTL_OLE_LEGAL)
00941
00942
00943
00944
00945
00946 #define FsRtlIsAnsiCharacterWild(C) ( \
00947
FsRtlTestAnsiCharacter((C), FALSE, FALSE, FSRTL_WILD_CHARACTER) \
00948
)
00949
00950
00951
00952
00953
00954 #define FsRtlIsAnsiCharacterLegalFat(C,WILD_OK) ( \
00955
FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_FAT_LEGAL) \
00956
)
00957
00958
00959
00960
00961
00962 #define FsRtlIsAnsiCharacterLegalHpfs(C,WILD_OK) ( \
00963
FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_HPFS_LEGAL) \
00964
)
00965
00966
00967
00968
00969
00970 #define FsRtlIsAnsiCharacterLegalNtfs(C,WILD_OK) ( \
00971
FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_LEGAL) \
00972
)
00973
00974
00975
00976
00977
00978
00979 #define FsRtlIsAnsiCharacterLegalNtfsStream(C,WILD_OK) ( \
00980
FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_STREAM_LEGAL) \
00981
)
00982
00983
00984
00985
00986
00987
00988 #define FsRtlIsAnsiCharacterLegal(C,FLAGS) ( \
00989
FsRtlTestAnsiCharacter((C), TRUE, FALSE, (FLAGS)) \
00990
)
00991
00992
00993
00994
00995
00996
00997 #define FsRtlTestAnsiCharacter(C, DEFAULT_RET, WILD_OK, FLAGS) ( \
00998
((SCHAR)(C) < 0) ? DEFAULT_RET : \
00999
FlagOn( LEGAL_ANSI_CHARACTER_ARRAY[(C)], \
01000
(FLAGS) | \
01001
((WILD_OK) ? FSRTL_WILD_CHARACTER : 0) ) \
01002
)
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033 #define FsRtlIsLeadDbcsCharacter(DBCS_CHAR) ( \
01034
(BOOLEAN)((UCHAR)(DBCS_CHAR) < 0x80 ? FALSE : \
01035
(NLS_MB_CODE_PAGE_TAG && \
01036
(NLS_OEM_LEAD_BYTE_INFO[(UCHAR)(DBCS_CHAR)] != 0))) \
01037
)
01038
01039
NTKERNELAPI
01040
VOID
01041
FsRtlDissectDbcs (
01042 IN ANSI_STRING InputName,
01043 OUT PANSI_STRING FirstPart,
01044 OUT PANSI_STRING RemainingPart
01045 );
01046
01047
NTKERNELAPI
01048 BOOLEAN
01049
FsRtlDoesDbcsContainWildCards (
01050 IN PANSI_STRING Name
01051 );
01052
01053
NTKERNELAPI
01054 BOOLEAN
01055
FsRtlIsDbcsInExpression (
01056 IN PANSI_STRING Expression,
01057 IN PANSI_STRING Name
01058 );
01059
01060
NTKERNELAPI
01061 BOOLEAN
01062
FsRtlIsFatDbcsLegal (
01063 IN ANSI_STRING DbcsName,
01064 IN BOOLEAN WildCardsPermissible,
01065 IN BOOLEAN PathNamePermissible,
01066 IN BOOLEAN LeadingBackslashPermissible
01067 );
01068
01069
NTKERNELAPI
01070 BOOLEAN
01071
FsRtlIsHpfsDbcsLegal (
01072 IN ANSI_STRING DbcsName,
01073 IN BOOLEAN WildCardsPermissible,
01074 IN BOOLEAN PathNamePermissible,
01075 IN BOOLEAN LeadingBackslashPermissible
01076 );
01077
01078
01079
01080
01081
01082
01083
NTKERNELAPI
01084
NTSTATUS
01085
FsRtlNormalizeNtstatus (
01086 IN NTSTATUS Exception,
01087 IN NTSTATUS GenericException
01088 );
01089
01090
NTKERNELAPI
01091 BOOLEAN
01092
FsRtlIsNtstatusExpected (
01093 IN NTSTATUS Exception
01094 );
01095
01096
01097
01098
01099
01100
01101 #define FsRtlAllocatePoolWithTag(PoolType, NumberOfBytes, Tag) \
01102
ExAllocatePoolWithTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \
01103
NumberOfBytes, \
01104
Tag)
01105
01106
01107 #define FsRtlAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, Tag) \
01108
ExAllocatePoolWithQuotaTag((POOL_TYPE)((PoolType) | POOL_RAISE_IF_ALLOCATION_FAILURE), \
01109
NumberOfBytes, \
01110
Tag)
01111
01112
01113
01114
01115
01116
NTKERNELAPI
01117
PERESOURCE
01118
FsRtlAllocateResource (
01119 );
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133 typedef struct _LARGE_MCB {
01134 PFAST_MUTEX FastMutex;
01135 ULONG MaximumPairCount;
01136 ULONG PairCount;
01137 POOL_TYPE PoolType;
01138 PVOID Mapping;
01139 }
LARGE_MCB;
01140 typedef LARGE_MCB *
PLARGE_MCB;
01141
01142
NTKERNELAPI
01143
VOID
01144
FsRtlInitializeLargeMcb (
01145 IN
PLARGE_MCB Mcb,
01146 IN POOL_TYPE PoolType
01147 );
01148
01149
NTKERNELAPI
01150
VOID
01151
FsRtlUninitializeLargeMcb (
01152 IN
PLARGE_MCB Mcb
01153 );
01154
01155
NTKERNELAPI
01156
VOID
01157
FsRtlResetLargeMcb (
01158 IN
PLARGE_MCB Mcb,
01159 IN BOOLEAN SelfSynchronized
01160 );
01161
01162
NTKERNELAPI
01163
VOID
01164
FsRtlTruncateLargeMcb (
01165 IN
PLARGE_MCB Mcb,
01166 IN LONGLONG Vbn
01167 );
01168
01169
NTKERNELAPI
01170 BOOLEAN
01171
FsRtlAddLargeMcbEntry (
01172 IN
PLARGE_MCB Mcb,
01173 IN LONGLONG Vbn,
01174 IN LONGLONG Lbn,
01175 IN LONGLONG SectorCount
01176 );
01177
01178
NTKERNELAPI
01179
VOID
01180
FsRtlRemoveLargeMcbEntry (
01181 IN
PLARGE_MCB Mcb,
01182 IN LONGLONG Vbn,
01183 IN LONGLONG SectorCount
01184 );
01185
01186
NTKERNELAPI
01187 BOOLEAN
01188
FsRtlLookupLargeMcbEntry (
01189 IN
PLARGE_MCB Mcb,
01190 IN LONGLONG Vbn,
01191 OUT PLONGLONG Lbn OPTIONAL,
01192 OUT PLONGLONG SectorCountFromLbn OPTIONAL,
01193 OUT PLONGLONG StartingLbn OPTIONAL,
01194 OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL,
01195 OUT PULONG Index OPTIONAL
01196 );
01197
01198
NTKERNELAPI
01199 BOOLEAN
01200
FsRtlLookupLastLargeMcbEntry (
01201 IN
PLARGE_MCB Mcb,
01202 OUT PLONGLONG Vbn,
01203 OUT PLONGLONG Lbn
01204 );
01205
01206
NTKERNELAPI
01207 BOOLEAN
01208
FsRtlLookupLastLargeMcbEntryAndIndex (
01209 IN
PLARGE_MCB OpaqueMcb,
01210 OUT PLONGLONG LargeVbn,
01211 OUT PLONGLONG LargeLbn,
01212 OUT PULONG Index
01213 );
01214
01215
NTKERNELAPI
01216 ULONG
01217
FsRtlNumberOfRunsInLargeMcb (
01218 IN
PLARGE_MCB Mcb
01219 );
01220
01221
NTKERNELAPI
01222 BOOLEAN
01223
FsRtlGetNextLargeMcbEntry (
01224 IN
PLARGE_MCB Mcb,
01225 IN ULONG RunIndex,
01226 OUT PLONGLONG Vbn,
01227 OUT PLONGLONG Lbn,
01228 OUT PLONGLONG SectorCount
01229 );
01230
01231
NTKERNELAPI
01232 BOOLEAN
01233
FsRtlSplitLargeMcb (
01234 IN
PLARGE_MCB Mcb,
01235 IN LONGLONG Vbn,
01236 IN LONGLONG Amount
01237 );
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248 typedef struct _MCB {
01249 LARGE_MCB DummyFieldThatSizesThisStructureCorrectly;
01250 }
MCB;
01251 typedef MCB *
PMCB;
01252
01253
NTKERNELAPI
01254
VOID
01255
FsRtlInitializeMcb (
01256 IN
PMCB Mcb,
01257 IN POOL_TYPE PoolType
01258 );
01259
01260
NTKERNELAPI
01261
VOID
01262
FsRtlUninitializeMcb (
01263 IN
PMCB Mcb
01264 );
01265
01266
NTKERNELAPI
01267
VOID
01268
FsRtlTruncateMcb (
01269 IN
PMCB Mcb,
01270 IN VBN Vbn
01271 );
01272
01273
NTKERNELAPI
01274 BOOLEAN
01275
FsRtlAddMcbEntry (
01276 IN
PMCB Mcb,
01277 IN VBN Vbn,
01278 IN LBN Lbn,
01279 IN ULONG SectorCount
01280 );
01281
01282
NTKERNELAPI
01283
VOID
01284
FsRtlRemoveMcbEntry (
01285 IN
PMCB Mcb,
01286 IN VBN Vbn,
01287 IN ULONG SectorCount
01288 );
01289
01290
NTKERNELAPI
01291 BOOLEAN
01292
FsRtlLookupMcbEntry (
01293 IN
PMCB Mcb,
01294 IN VBN Vbn,
01295 OUT PLBN Lbn,
01296 OUT PULONG SectorCount OPTIONAL,
01297 OUT PULONG Index
01298 );
01299
01300
NTKERNELAPI
01301 BOOLEAN
01302
FsRtlLookupLastMcbEntry (
01303 IN
PMCB Mcb,
01304 OUT PVBN Vbn,
01305 OUT PLBN Lbn
01306 );
01307
01308
NTKERNELAPI
01309 ULONG
01310
FsRtlNumberOfRunsInMcb (
01311 IN
PMCB Mcb
01312 );
01313
01314
NTKERNELAPI
01315 BOOLEAN
01316
FsRtlGetNextMcbEntry (
01317 IN
PMCB Mcb,
01318 IN ULONG RunIndex,
01319 OUT PVBN Vbn,
01320 OUT PLBN Lbn,
01321 OUT PULONG SectorCount
01322 );
01323
01324
01325
01326
01327
01328
01329
01330
01331
NTKERNELAPI
01332
NTSTATUS
01333
FsRtlBalanceReads (
01334 IN
PDEVICE_OBJECT TargetDevice
01335 );
01336
01337
01338
NTKERNELAPI
01339
NTSTATUS
01340
FsRtlSyncVolumes (
01341 IN
PDEVICE_OBJECT TargetDevice,
01342 IN PLARGE_INTEGER ByteOffset OPTIONAL,
01343 IN PLARGE_INTEGER ByteCount
01344 );
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355 typedef PVOID
OPLOCK, *
POPLOCK;
01356
01357
typedef
01358
VOID
01359 (*POPLOCK_WAIT_COMPLETE_ROUTINE) (
01360 IN PVOID Context,
01361 IN
PIRP Irp
01362 );
01363
01364
typedef
01365
VOID
01366 (*POPLOCK_FS_PREPOST_IRP) (
01367 IN PVOID Context,
01368 IN
PIRP Irp
01369 );
01370
01371
NTKERNELAPI
01372
VOID
01373
FsRtlInitializeOplock (
01374 IN OUT POPLOCK Oplock
01375 );
01376
01377
NTKERNELAPI
01378
VOID
01379
FsRtlUninitializeOplock (
01380 IN OUT POPLOCK Oplock
01381 );
01382
01383
NTKERNELAPI
01384
NTSTATUS
01385
FsRtlOplockFsctrl (
01386 IN POPLOCK Oplock,
01387 IN
PIRP Irp,
01388 IN ULONG OpenCount
01389 );
01390
01391
NTKERNELAPI
01392
NTSTATUS
01393
FsRtlCheckOplock (
01394 IN POPLOCK Oplock,
01395 IN
PIRP Irp,
01396 IN PVOID Context,
01397 IN
POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL,
01398 IN
POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL
01399 );
01400
01401
NTKERNELAPI
01402 BOOLEAN
01403
FsRtlOplockIsFastIoPossible (
01404 IN POPLOCK Oplock
01405 );
01406
01407
NTKERNELAPI
01408 BOOLEAN
01409
FsRtlCurrentBatchOplock (
01410 IN POPLOCK Oplock
01411 );
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421 #define FSRTL_VOLUME_DISMOUNT 1
01422 #define FSRTL_VOLUME_DISMOUNT_FAILED 2
01423 #define FSRTL_VOLUME_LOCK 3
01424 #define FSRTL_VOLUME_LOCK_FAILED 4
01425 #define FSRTL_VOLUME_UNLOCK 5
01426 #define FSRTL_VOLUME_MOUNT 6
01427
01428
NTKERNELAPI
01429
NTSTATUS
01430
FsRtlNotifyVolumeEvent (
01431 IN
PFILE_OBJECT FileObject,
01432 IN ULONG EventCode
01433 );
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443 typedef PVOID
PNOTIFY_SYNC;
01444
01445
typedef
01446 BOOLEAN (*
PCHECK_FOR_TRAVERSE_ACCESS) (
01447 IN PVOID NotifyContext,
01448 IN PVOID TargetContext,
01449 IN
PSECURITY_SUBJECT_CONTEXT SubjectContext
01450 );
01451
01452
NTKERNELAPI
01453
VOID
01454
FsRtlNotifyInitializeSync (
01455 IN PNOTIFY_SYNC *NotifySync
01456 );
01457
01458
NTKERNELAPI
01459
VOID
01460
FsRtlNotifyUninitializeSync (
01461 IN PNOTIFY_SYNC *NotifySync
01462 );
01463
01464
01465
NTKERNELAPI
01466
VOID
01467
FsRtlNotifyChangeDirectory (
01468 IN PNOTIFY_SYNC NotifySync,
01469 IN PVOID FsContext,
01470 IN PSTRING FullDirectoryName,
01471 IN PLIST_ENTRY NotifyList,
01472 IN BOOLEAN WatchTree,
01473 IN ULONG CompletionFilter,
01474 IN
PIRP NotifyIrp
01475 );
01476
01477
01478
NTKERNELAPI
01479
VOID
01480
FsRtlNotifyFullChangeDirectory (
01481 IN PNOTIFY_SYNC NotifySync,
01482 IN PLIST_ENTRY NotifyList,
01483 IN PVOID FsContext,
01484 IN PSTRING FullDirectoryName,
01485 IN BOOLEAN WatchTree,
01486 IN BOOLEAN IgnoreBuffer,
01487 IN ULONG CompletionFilter,
01488 IN
PIRP NotifyIrp,
01489 IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL,
01490 IN
PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL
01491 );
01492
01493
01494
NTKERNELAPI
01495
VOID
01496
FsRtlNotifyReportChange (
01497 IN PNOTIFY_SYNC NotifySync,
01498 IN PLIST_ENTRY NotifyList,
01499 IN PSTRING FullTargetName,
01500 IN PSTRING TargetName,
01501 IN ULONG FilterMatch
01502 );
01503
01504
01505
NTKERNELAPI
01506
VOID
01507
FsRtlNotifyFullReportChange (
01508 IN PNOTIFY_SYNC NotifySync,
01509 IN PLIST_ENTRY NotifyList,
01510 IN PSTRING FullTargetName,
01511 IN USHORT TargetNameOffset,
01512 IN PSTRING StreamName OPTIONAL,
01513 IN PSTRING NormalizedParentName OPTIONAL,
01514 IN ULONG FilterMatch,
01515 IN ULONG Action,
01516 IN PVOID TargetContext
01517 );
01518
01519
NTKERNELAPI
01520
VOID
01521
FsRtlNotifyCleanup (
01522 IN PNOTIFY_SYNC NotifySync,
01523 IN PLIST_ENTRY NotifyList,
01524 IN PVOID FsContext
01525 );
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538 #define FsRtlIsUnicodeCharacterWild(C) ( \
01539
(((C) >= 0x40) ? FALSE : FlagOn( LEGAL_ANSI_CHARACTER_ARRAY[(C)], \
01540
FSRTL_WILD_CHARACTER ) ) \
01541
)
01542
01543
NTKERNELAPI
01544
VOID
01545
FsRtlDissectName (
01546 IN UNICODE_STRING Path,
01547 OUT PUNICODE_STRING FirstName,
01548 OUT PUNICODE_STRING RemainingName
01549 );
01550
01551
NTKERNELAPI
01552 BOOLEAN
01553
FsRtlDoesNameContainWildCards (
01554 IN PUNICODE_STRING Name
01555 );
01556
01557
NTKERNELAPI
01558 BOOLEAN
01559
FsRtlAreNamesEqual (
01560 PCUNICODE_STRING ConstantNameA,
01561 PCUNICODE_STRING ConstantNameB,
01562 IN BOOLEAN IgnoreCase,
01563 IN PCWCH UpcaseTable OPTIONAL
01564 );
01565
01566
NTKERNELAPI
01567 BOOLEAN
01568
FsRtlIsNameInExpression (
01569 IN PUNICODE_STRING Expression,
01570 IN PUNICODE_STRING Name,
01571 IN BOOLEAN IgnoreCase,
01572 IN PWCH UpcaseTable OPTIONAL
01573 );
01574
01575
01576
01577
01578
01579
01580
typedef
01581
VOID
01582 (*PFSRTL_STACK_OVERFLOW_ROUTINE) (
01583 IN PVOID Context,
01584 IN
PKEVENT Event
01585 );
01586
01587
NTKERNELAPI
01588
VOID
01589
FsRtlPostStackOverflow (
01590 IN PVOID Context,
01591 IN
PKEVENT Event,
01592 IN
PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine
01593 );
01594
01595
NTKERNELAPI
01596
VOID
01597
FsRtlPostPagingFileStackOverflow (
01598 IN PVOID Context,
01599 IN
PKEVENT Event,
01600 IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine
01601 );
01602
01603
01604
01605
01606
01607
NTKERNELAPI
01608
NTSTATUS
01609
FsRtlRegisterUncProvider(
01610 IN OUT PHANDLE MupHandle,
01611 IN PUNICODE_STRING RedirectorDeviceName,
01612 IN BOOLEAN MailslotsSupported
01613 );
01614
01615
NTKERNELAPI
01616
VOID
01617
FsRtlDeregisterUncProvider(
01618 IN HANDLE Handle
01619 );
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645 typedef struct _FSRTL_FILTER_CONTEXT {
01646 LIST_ENTRY Links;
01647 PVOID OwnerId;
01648 PVOID InstanceId;
01649 PFREE_FUNCTION FreeCallback;
01650 }
FSRTL_FILTER_CONTEXT, *
PFSRTL_FILTER_CONTEXT;
01651
01652
01653
01654
01655
01656
01657
01658
01659
NTKERNELAPI
01660
NTSTATUS
01661
FsRtlInsertFilterContext (
01662 IN
PFILE_OBJECT FileObject,
01663 IN
PFSRTL_FILTER_CONTEXT Ptr
01664 );
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
NTKERNELAPI
01675
PFSRTL_FILTER_CONTEXT
01676
FsRtlLookupFilterContextInternal (
01677 IN
PFILE_OBJECT FileObject,
01678 IN PVOID OwnerId OPTIONAL,
01679 IN PVOID InstanceId OPTIONAL
01680 );
01681
01682 #define FsRtlLookupFilterContext(fo, oid, iid) \
01683
(( (fo)->FsContext \
01684
&& ( ((PFSRTL_COMMON_FCB_HEADER)(fo)->FsContext)->Flags2 & \
01685
FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS ) \
01686
&& !IsListEmpty( (PLIST_ENTRY) \
01687
&((PFSRTL_COMMON_FCB_HEADER)(fo)->FsContext)->FilterContexts ) \
01688
) ? FsRtlLookupFilterContextInternal(fo, oid, iid) \
01689
: NULL)
01690
01691
01692
01693
01694
01695
01696
01697
01698
NTKERNELAPI
01699
PFSRTL_FILTER_CONTEXT
01700
FsRtlRemoveFilterContext (
01701 IN
PFILE_OBJECT FileObject,
01702 IN PVOID OwnerId OPTIONAL,
01703 IN PVOID InstanceId OPTIONAL
01704 );
01705
01706
01707
01708
01709
01710
01711
01712
NTKERNELAPI
01713
VOID
01714
FsRtlTeardownFilterContexts (
01715 IN PLIST_ENTRY FilterContexts
01716 );
01717
01718
01719
01720
01721
01722
01723
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745 #define FsRtlCompleteRequest(IRP,STATUS) { \
01746
(IRP)->IoStatus.Status = (STATUS); \
01747
IoCompleteRequest( (IRP), IO_DISK_INCREMENT ); \
01748
}
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772 #define FsRtlEnterFileSystem() { \
01773
KeEnterCriticalRegion(); \
01774
}
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795 #define FsRtlExitFileSystem() { \
01796
KeLeaveCriticalRegion(); \
01797
}
01798
01799
01800
01801
#endif // _FSRTL_