Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

fsrtl.h

Go to the documentation of this file.
00001 /*++ BUILD Version: 0001 // Increment this if a change has global effects 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 FsRtl.h 00008 00009 Abstract: 00010 00011 This module defines all of the general File System Rtl routines 00012 00013 Author: 00014 00015 Gary Kimura [GaryKi] 30-Jul-1990 00016 00017 Revision History: 00018 00019 --*/ 00020 00021 #ifndef _FSRTL_ 00022 #define _FSRTL_ 00023 00024 // begin_ntifs 00025 // 00026 // The following are globally used definitions for an LBN and a VBN 00027 // 00028 00029 typedef ULONG LBN; 00030 typedef LBN *PLBN; 00031 00032 typedef ULONG VBN; 00033 typedef VBN *PVBN; 00034 00035 00036 // end_ntifs 00037 // 00038 // The following routine is called during phase 1 initialization to allow 00039 // us to create the pool of file system threads and the associated 00040 // synchronization resources. 00041 // 00042 00043 NTKERNELAPI 00044 BOOLEAN 00045 FsRtlInitSystem ( 00046 ); 00047 00048 // begin_ntifs 00049 // 00050 // Every file system that uses the cache manager must have FsContext 00051 // of the file object point to a common fcb header structure. 00052 // end_ntifs 00053 // Either the normal or compressed FsRtl Header (the latter if the 00054 // file system supports Fast I/O for compressed reads and writes). 00055 // begin_ntifs 00056 // 00057 00058 typedef enum _FAST_IO_POSSIBLE { 00059 FastIoIsNotPossible = 0, 00060 FastIoIsPossible, 00061 FastIoIsQuestionable 00062 } FAST_IO_POSSIBLE; 00063 00064 // end_ntifs 00065 // Changes to this structure will affect FSRTL_ADVANCED_FCB_HEADER. 00066 // begin_ntifs 00067 00068 typedef struct _FSRTL_COMMON_FCB_HEADER { 00069 00070 CSHORT NodeTypeCode; 00071 CSHORT NodeByteSize; 00072 00073 // 00074 // General flags available to FsRtl. 00075 // 00076 00077 UCHAR Flags; 00078 00079 // 00080 // Indicates if fast I/O is possible or if we should be calling 00081 // the check for fast I/O routine which is found via the driver 00082 // object. 00083 // 00084 00085 UCHAR IsFastIoPossible; // really type FAST_IO_POSSIBLE 00086 00087 // 00088 // Second Flags Field 00089 // 00090 00091 UCHAR Flags2; 00092 00093 // 00094 // The following reserved field should always be 0 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 // end_ntifs 00108 00109 #ifndef BUILDING_FSKDEXT 00110 00111 // 00112 // FSKD needs fsrtl.h, but FAT/CDFS/UDFS build using ntifs.h, which doesn't 00113 // define these fields (end_ntifs above). So when building the FSKD 00114 // (fat/cdfs/udfs kdext) don't define these fields. To be fixed 5.1 00115 // 00116 00117 // 00118 // The following two fields are supported only if 00119 // Flags2 contains FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS 00120 // 00121 // FastMutex was moved here from FSRTL_ADVANCED_FCB_HEADER, 00122 // but remains at the same offset in that structure. 00123 // The other fields in the previous definition of the 00124 // advanced FCB header were moved by this change 00125 // 00126 00127 // 00128 // This is a pointer to a Fast Mutex which may be used to 00129 // properly synchronize access to the FsRtl header. The 00130 // Fast Mutex must be nonpaged. 00131 // 00132 00133 PFAST_MUTEX FastMutex; 00134 00135 // 00136 // This is a pointer to a list of context structures belonging to 00137 // filesystem filter drivers that are linked above the filesystem. 00138 // Each structure is headed by FSRTL_FILTER_CONTEXT. 00139 // 00140 00141 LIST_ENTRY FilterContexts; 00142 00143 #endif 00144 00145 // begin_ntifs 00146 } FSRTL_COMMON_FCB_HEADER; 00147 typedef FSRTL_COMMON_FCB_HEADER *PFSRTL_COMMON_FCB_HEADER; 00148 00149 // end_ntifs 00150 // 00151 // This Fcb header is used for files which support caching 00152 // of compressed data, and related new support. 00153 // 00154 // We start out by prefixing this structure with the normal 00155 // FsRtl header from above, which we have to do two different 00156 // ways for c++ or c. 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 // Put in the standard FsRtl header fields 00167 // 00168 00169 FSRTL_COMMON_FCB_HEADER ; 00170 00171 #endif // __cplusplus 00172 00173 // 00174 // This is a pointer to a list head which may be used to queue 00175 // up advances to EOF (end of file), via calls to the appropriate 00176 // FsRtl routines. This listhead may be paged. 00177 // 00178 00179 PLIST_ENTRY PendingEofAdvances; 00180 00181 // 00182 // When FSRTL_FLAG_ADVANCED_HEADER is set, the following fields 00183 // are present in the header. If the compressed stream has not 00184 // been initialized, all of the following fields will be NULL. 00185 // 00186 00187 // 00188 // This is the FileObect for the stream in which data is cached 00189 // in its compressed form. 00190 // 00191 00192 PFILE_OBJECT FileObjectC; 00193 00194 // 00195 // The following field points to the Section Object Pointers for 00196 // the normal data stream used for cache coherency in the fast path. 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 // begin_ntifs 00205 // 00206 // Define FsRtl common header flags 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 // Following flags determine how the modified page writer should 00215 // acquire the file. These flags can't change while either resource 00216 // is acquired. If neither of these flags is set then the 00217 // modified/mapped page writer will attempt to acquire the paging io 00218 // resource shared. 00219 // 00220 00221 #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX (0x08) 00222 #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH (0x10) 00223 00224 // 00225 // This flag will be set by the Cache Manager if a view is mapped 00226 // to a file. 00227 // 00228 00229 #define FSRTL_FLAG_USER_MAPPED_FILE (0x20) 00230 00231 // end_ntifs 00232 // This flag indicates that the file system supports compression 00233 // and this is a compressed FsRtl header. 00234 // 00235 00236 #define FSRTL_FLAG_ADVANCED_HEADER (0x40) 00237 00238 // begin_ntifs 00239 // This flag determines whether there currently is an Eof advance 00240 // in progress. All such advances must be serialized. 00241 // 00242 00243 #define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80) 00244 00245 // 00246 // Flag values for Flags2 00247 // 00248 // All unused bits are reserved and should NOT be modified. 00249 // 00250 00251 // 00252 // If this flag is set, the Cache Manager will allow modified writing 00253 // in spite of the value of FsContext2. 00254 // 00255 00256 #define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01) 00257 00258 // end_ntifs 00259 // 00260 // If this flag is set, the additional fields FilterContexts and FastMutex 00261 // are supported in FSRTL_COMMON_HEADER, and can be used to associate 00262 // context for filesystem filters with streams. 00263 // 00264 00265 #define FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS (0x02) 00266 00267 // 00268 // If this flag is set, the cache manager will flush and purge the cache map when 00269 // a user first maps a file 00270 // 00271 00272 #define FSRTL_FLAG2_PURGE_WHEN_MAPPED (0x04) 00273 00274 00275 // begin_ntifs 00276 // 00277 // The following constants are used to block top level Irp processing when 00278 // (in either the fast io or cc case) file system resources have been 00279 // acquired above the file system, or we are in an Fsp thread. 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 // end_ntifs 00289 // 00290 // The following structure is used to synchronize Eof extends. 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 // begin_ntifs 00303 // 00304 // Normal uncompressed Copy and Mdl Apis 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 // end_ntifs 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 // begin_ntsrv 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 // In Irps, compressed reads and writes are designated by the 00415 // subfunction IRP_MN_COMPRESSED must be set and the Compressed 00416 // Data Info buffer must be described by the following structure 00417 // pointed to by Irp->Tail.Overlay.AuxiliaryBuffer. 00418 // 00419 00420 typedef struct _FSRTL_AUXILIARY_BUFFER { 00421 00422 // 00423 // Buffer description with length. 00424 // 00425 00426 PVOID Buffer; 00427 ULONG Length; 00428 00429 // 00430 // Flags 00431 // 00432 00433 ULONG Flags; 00434 00435 // 00436 // Pointer to optional Mdl mapping buffer for file system use 00437 // 00438 00439 PMDL Mdl; 00440 00441 } FSRTL_AUXILIARY_BUFFER; 00442 typedef FSRTL_AUXILIARY_BUFFER *PFSRTL_AUXILIARY_BUFFER; 00443 00444 // 00445 // If this flag is set, the auxillary buffer structure is 00446 // deallocated on Irp completion. The caller has the 00447 // option in this case of appending this structure to the 00448 // structure being described, causing it all to be 00449 // deallocated at once. If this flag is clear, no deallocate 00450 // occurs. 00451 // 00452 00453 #define FSRTL_AUXILIARY_FLAG_DEALLOCATE 0x00000001 00454 00455 // end_ntsrv 00456 // 00457 // The following routines are intended to be called by Mm to avoid deadlocks. 00458 // They pre-acquire file system resources before acquire Mm resources. 00459 // 00460 00461 // 00462 // This macro is called once when the ModifiedPageWriter is started. 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 // begin_ntifs 00497 // 00498 // The following two routines are called from NtCreateSection to avoid 00499 // deadlocks with the file systems. 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 // These routines provide a simple interface for the common operations 00516 // of query/set file size. 00517 // 00518 00519 NTSTATUS 00520 FsRtlGetFileSize( 00521 IN PFILE_OBJECT FileObject, 00522 IN OUT PLARGE_INTEGER FileSize 00523 ); 00524 00525 // end_ntifs 00526 00527 NTSTATUS 00528 FsRtlSetFileSize( 00529 IN PFILE_OBJECT FileObject, 00530 IN OUT PLARGE_INTEGER FileSize 00531 ); 00532 00533 // begin_ntddk begin_ntifs 00534 // 00535 // Determine if there is a complete device failure on an error. 00536 // 00537 00538 NTKERNELAPI 00539 BOOLEAN 00540 FsRtlIsTotalDeviceFailure( 00541 IN NTSTATUS Status 00542 ); 00543 00544 // end_ntddk 00545 00546 // 00547 // Byte range file lock routines, implemented in FileLock.c 00548 // 00549 // The file lock info record is used to return enumerated information 00550 // about a file lock 00551 // 00552 00553 typedef struct _FILE_LOCK_INFO { 00554 00555 // 00556 // A description of the current locked range, and if the lock 00557 // is exclusive or shared 00558 // 00559 00560 LARGE_INTEGER StartingByte; 00561 LARGE_INTEGER Length; 00562 BOOLEAN ExclusiveLock; 00563 00564 // 00565 // The following fields describe the owner of the lock. 00566 // 00567 00568 ULONG Key; 00569 PFILE_OBJECT FileObject; 00570 PVOID ProcessId; 00571 00572 // 00573 // The following field is used internally by FsRtl 00574 // 00575 00576 LARGE_INTEGER EndingByte; 00577 00578 } FILE_LOCK_INFO; 00579 typedef FILE_LOCK_INFO *PFILE_LOCK_INFO; 00580 00581 // 00582 // The following two procedure prototypes are used by the caller of the 00583 // file lock package to supply an alternate routine to call when 00584 // completing an IRP and when unlocking a byte range. Note that the only 00585 // utility to us this interface is currently the redirector, all other file 00586 // system will probably let the IRP complete normally with IoCompleteRequest. 00587 // The user supplied routine returns any value other than success then the 00588 // lock package will remove any lock that we just inserted. 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 // A FILE_LOCK is an opaque structure but we need to declare the size of 00603 // it here so that users can allocate space for one. 00604 // 00605 00606 typedef struct _FILE_LOCK { 00607 00608 // 00609 // The optional procedure to call to complete a request 00610 // 00611 00612 PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine; 00613 00614 // 00615 // The optional procedure to call when unlocking a byte range 00616 // 00617 00618 PUNLOCK_ROUTINE UnlockRoutine; 00619 00620 // 00621 // FastIoIsQuestionable is set to true when... bugbug 00622 // 00623 00624 BOOLEAN FastIoIsQuestionable; 00625 BOOLEAN SpareC[3]; 00626 00627 // 00628 // FsRtl lock information 00629 // 00630 00631 PVOID LockInformation; 00632 00633 // 00634 // Contains contination information for FsRtlGetNextFileLock 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 // BOOLEAN 00770 // FsRtlFastLock ( 00771 // IN PFILE_LOCK FileLock, 00772 // IN PFILE_OBJECT FileObject, 00773 // IN PLARGE_INTEGER FileOffset, 00774 // IN PLARGE_INTEGER Length, 00775 // IN PEPROCESS ProcessId, 00776 // IN ULONG Key, 00777 // IN BOOLEAN FailImmediately, 00778 // IN BOOLEAN ExclusiveLock, 00779 // OUT PIO_STATUS_BLOCK Iosb, 00780 // IN PVOID Context OPTIONAL, 00781 // IN BOOLEAN AlreadySynchronized 00782 // ); 00783 // 00784 00785 #define FsRtlFastLock(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11) ( \ 00786 FsRtlPrivateLock( A1, /* FileLock */ \ 00787 A2, /* FileObject */ \ 00788 A3, /* FileOffset */ \ 00789 A4, /* Length */ \ 00790 A5, /* ProcessId */ \ 00791 A6, /* Key */ \ 00792 A7, /* FailImmediately */ \ 00793 A8, /* ExclusiveLock */ \ 00794 A9, /* Iosb */ \ 00795 NULL, /* Irp */ \ 00796 A10, /* Context */ \ 00797 A11 /* AlreadySynchronized */ ) \ 00798 ) 00799 00800 // 00801 // BOOLEAN 00802 // FsRtlAreThereCurrentFileLocks ( 00803 // IN PFILE_LOCK FileLock 00804 // ); 00805 // 00806 00807 #define FsRtlAreThereCurrentFileLocks(FL) ( \ 00808 ((FL)->FastIoIsQuestionable)) 00809 00810 00811 00812 // 00813 // Filesystem property tunneling, implemented in tunnel.c 00814 // 00815 00816 // 00817 // Tunnel cache structure 00818 // 00819 00820 typedef struct { 00821 00822 // 00823 // Mutex for cache manipulation 00824 // 00825 00826 FAST_MUTEX Mutex; 00827 00828 // 00829 // Splay Tree of tunneled information keyed by 00830 // DirKey ## Name 00831 // 00832 00833 PRTL_SPLAY_LINKS Cache; 00834 00835 // 00836 // Timer queue used to age entries out of the main cache 00837 // 00838 00839 LIST_ENTRY TimerQueue; 00840 00841 // 00842 // Keep track of the number of entries in the cache to prevent 00843 // excessive use of memory 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 // Dbcs name support routines, implemented in DbcsName.c 00893 // 00894 00895 // 00896 // The following enumerated type is used to denote the result of name 00897 // comparisons 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 // end_ntifs 00911 #if defined(_NTIFS_) || defined(_NTDRIVER_) 00912 // begin_ntifs 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 // end_ntifs 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 // begin_ntifs 00927 00928 extern PUCHAR LEGAL_ANSI_CHARACTER_ARRAY; 00929 extern PUSHORT NLS_OEM_LEAD_BYTE_INFO; // Lead byte info. for ACP 00930 00931 // 00932 // These following bit values are set in the FsRtlLegalDbcsCharacterArray 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 // The following macro is used to determine if an Ansi character is wild. 00944 // 00945 00946 #define FsRtlIsAnsiCharacterWild(C) ( \ 00947 FsRtlTestAnsiCharacter((C), FALSE, FALSE, FSRTL_WILD_CHARACTER) \ 00948 ) 00949 00950 // 00951 // The following macro is used to determine if an Ansi character is Fat legal. 00952 // 00953 00954 #define FsRtlIsAnsiCharacterLegalFat(C,WILD_OK) ( \ 00955 FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_FAT_LEGAL) \ 00956 ) 00957 00958 // 00959 // The following macro is used to determine if an Ansi character is Hpfs legal. 00960 // 00961 00962 #define FsRtlIsAnsiCharacterLegalHpfs(C,WILD_OK) ( \ 00963 FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_HPFS_LEGAL) \ 00964 ) 00965 00966 // 00967 // The following macro is used to determine if an Ansi character is Ntfs legal. 00968 // 00969 00970 #define FsRtlIsAnsiCharacterLegalNtfs(C,WILD_OK) ( \ 00971 FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_LEGAL) \ 00972 ) 00973 00974 // 00975 // The following macro is used to determine if an Ansi character is 00976 // legal in an Ntfs stream name 00977 // 00978 00979 #define FsRtlIsAnsiCharacterLegalNtfsStream(C,WILD_OK) ( \ 00980 FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_STREAM_LEGAL) \ 00981 ) 00982 00983 // 00984 // The following macro is used to determine if an Ansi character is legal, 00985 // according to the caller's specification. 00986 // 00987 00988 #define FsRtlIsAnsiCharacterLegal(C,FLAGS) ( \ 00989 FsRtlTestAnsiCharacter((C), TRUE, FALSE, (FLAGS)) \ 00990 ) 00991 00992 // 00993 // The following macro is used to test attributes of an Ansi character, 00994 // according to the caller's specified flags. 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 // The following two macros use global data defined in ntos\rtl\nlsdata.c 01007 // 01008 // BOOLEAN 01009 // FsRtlIsLeadDbcsCharacter ( 01010 // IN UCHAR DbcsCharacter 01011 // ); 01012 // 01013 // /*++ 01014 // 01015 // Routine Description: 01016 // 01017 // This routine takes the first bytes of a Dbcs character and 01018 // returns whether it is a lead byte in the system code page. 01019 // 01020 // Arguments: 01021 // 01022 // DbcsCharacter - Supplies the input character being examined 01023 // 01024 // Return Value: 01025 // 01026 // BOOLEAN - TRUE if the input character is a dbcs lead and 01027 // FALSE otherwise 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 // Exception filter routines, implemented in Filter.c 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 // The following procedures are used to allocate executive pool and raise 01098 // insufficient resource status if pool isn't currently available. 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 // The following function allocates a resource from the FsRtl pool. 01114 // 01115 01116 NTKERNELAPI 01117 PERESOURCE 01118 FsRtlAllocateResource ( 01119 ); 01120 01121 01122 // 01123 // Large Integer Mapped Control Blocks routines, implemented in LargeMcb.c 01124 // 01125 // Originally this structure was truely opaque and code outside largemcb was 01126 // never allowed to examine or alter the structures. However, for performance 01127 // reasons we want to allow ntfs the ability to quickly truncate down the 01128 // mcb without the overhead of an actual call to largemcb.c. So to do that we 01129 // need to export the struture. This structure is not exact. The Mapping field 01130 // is declared here as a pvoid but largemcb.c it is a pointer to mapping pairs. 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 // Mapped Control Blocks routines, implemented in Mcb.c 01242 // 01243 // An MCB is an opaque structure but we need to declare the size of 01244 // it here so that users can allocate space for one. Consequently the 01245 // size computation here must be updated by hand if the MCB changes. 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 // Fault Tollerance routines, implemented in FaultTol.c 01326 // 01327 // The routines in this package implement rouines that help file 01328 // systems interact with the FT device drivers. 01329 // 01330 01331 NTKERNELAPI 01332 NTSTATUS 01333 FsRtlBalanceReads ( 01334 IN PDEVICE_OBJECT TargetDevice 01335 ); 01336 01337 // end_ntifs 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 // begin_ntifs 01347 01348 // 01349 // Oplock routines, implemented in Oplock.c 01350 // 01351 // An OPLOCK is an opaque structure, we declare it as a PVOID and 01352 // allocate the actual memory only when needed. 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 // Volume lock/unlock notification routines, implemented in PnP.c 01416 // 01417 // These routines provide PnP volume lock notification support 01418 // for all filesystems. 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 // Notify Change routines, implemented in Notify.c 01437 // 01438 // These routines provide Notify Change support for all filesystems. 01439 // Any of the 'Full' notify routines will support returning the 01440 // change information into the user's buffer. 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 // end_ntifs 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 // begin_ntifs 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 // end_ntifs 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 // begin_ntifs 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 // Unicode Name support routines, implemented in Name.c 01530 // 01531 // The routines here are used to manipulate unicode names 01532 // 01533 01534 // 01535 // The following macro is used to determine if a character is wild. 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 // Stack Overflow support routine, implemented in StackOvf.c 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 // UNC Provider support 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 // end_ntifs 01622 01623 // 01624 // Filter Driver context support 01625 // 01626 01627 // 01628 // Filesystem filter drivers use these APIs to associate context 01629 // with open streams (for filesystems that support this). 01630 // 01631 01632 // 01633 // OwnerId should uniquely identify a particular filter driver 01634 // (e.g. the address of the driver's device object). 01635 // InstanceId can be used to distinguish distinct contexts associated 01636 // by a filter driver with a single stream (e.g. the address of the 01637 // fileobject). 01638 // FreeCallback is used by a filesystem when tearing down 01639 // an FsContext data structure to free associated FilterContexts. 01640 // The callback routine cannot recursively call down into the filesystem 01641 // or acquire any of their resources which they might hold when calling 01642 // the filesystem outside of the callback. 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 // Associate the context at Ptr with the stream specified by FileObject. 01654 // Ptr->OwnerId and Ptr->InstanceId should be filled in by the caller. 01655 // If the underlying filesystem does not support filter contexts, 01656 // STATUS_INVALID_DEVICE_REQUEST will be returned. 01657 // 01658 01659 NTKERNELAPI 01660 NTSTATUS 01661 FsRtlInsertFilterContext ( 01662 IN PFILE_OBJECT FileObject, 01663 IN PFSRTL_FILTER_CONTEXT Ptr 01664 ); 01665 01666 // 01667 // Lookup a filter context associated with the stream specified by FileObject. 01668 // The first context matching OwnerId (and InstanceId, if present) is returned. 01669 // By not specifying InstanceId, a filter driver can search for any context 01670 // that it as previously associated with a file. 01671 // If no matching context is found, NULL is returned. 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 // Filter drivers must explicitly remove the context they associate with 01693 // a stream (otherwise the underlying filesystem will BugCheck at close). 01694 // FsRtlRemoveFilterContext functions identically to FsRtlLookupFilterContext, 01695 // except that the returned context has been removed from the list. 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 // File systems call this API to free any filter contexts still associated 01708 // with an FSRTL_COMMON_FCB_HEADER that they are tearing down. 01709 // The FreeCallback routine for each filter context will be called. 01710 // 01711 01712 NTKERNELAPI 01713 VOID 01714 FsRtlTeardownFilterContexts ( 01715 IN PLIST_ENTRY FilterContexts 01716 ); 01717 01718 // begin_ntifs 01719 01720 //++ 01721 // 01722 // VOID 01723 // FsRtlCompleteRequest ( 01724 // IN PIRP Irp, 01725 // IN NTSTATUS Status 01726 // ); 01727 // 01728 // Routine Description: 01729 // 01730 // This routine is used to complete an IRP with the indicated 01731 // status. It does the necessary raise and lower of IRQL. 01732 // 01733 // Arguments: 01734 // 01735 // Irp - Supplies a pointer to the Irp to complete 01736 // 01737 // Status - Supplies the completion status for the Irp 01738 // 01739 // Return Value: 01740 // 01741 // None. 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 // VOID 01754 // FsRtlEnterFileSystem ( 01755 // ); 01756 // 01757 // Routine Description: 01758 // 01759 // This routine is used when entering a file system (e.g., through its 01760 // Fsd entry point). It ensures that the file system cannot be suspended 01761 // while running and thus block other file I/O requests. Upon exit 01762 // the file system must call FsRtlExitFileSystem. 01763 // 01764 // Arguments: 01765 // 01766 // Return Value: 01767 // 01768 // None. 01769 // 01770 //-- 01771 01772 #define FsRtlEnterFileSystem() { \ 01773 KeEnterCriticalRegion(); \ 01774 } 01775 01776 //++ 01777 // 01778 // VOID 01779 // FsRtlExitFileSystem ( 01780 // ); 01781 // 01782 // Routine Description: 01783 // 01784 // This routine is used when exiting a file system (e.g., through its 01785 // Fsd entry point). 01786 // 01787 // Arguments: 01788 // 01789 // Return Value: 01790 // 01791 // None. 01792 // 01793 //-- 01794 01795 #define FsRtlExitFileSystem() { \ 01796 KeLeaveCriticalRegion(); \ 01797 } 01798 01799 // end_ntifs 01800 01801 #endif // _FSRTL_

Generated on Sat May 15 19:40:04 2004 for test by doxygen 1.3.7