• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            S.l.e!ep.¢%

            像打了激速一樣,以四倍的速度運轉,開心的工作
            簡單、開放、平等的公司文化;尊重個性、自由與個人價值;
            posts - 1098, comments - 335, trackbacks - 0, articles - 1
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            sfilter(二) - 01 注冊FsFilter回調例程

            Posted on 2010-02-19 13:33 S.l.e!ep.¢% 閱讀(980) 評論(0)  編輯 收藏 引用 所屬分類: Windows WDM

            ??????? 04、注冊FsFilter回調例程:

            ??????? FsFilter通知回調例程在下層文件系統執行某些操作之前或之后調用。如果需要獲取更多有關于FsFilter回調例程相關信息,可參見FsRtlRegisterFileSystemFilterCallbacks例程
            ??????? 為了注冊FsFilter的通知回調例程必須分配并初始化FS_FILTER_CALLBACKS結構體,然后向該結構體中促出FsFilter回調例 程,并將存儲有Callbacks parameter到FsRtlRegisterFileSystemFilterCallbacks中。
            ??????? 例如:FileSpy驅動范例按如下方式注冊FsFilter回調。

            fsFilterCallbacks.SizeOfFsFilterCallbacks = sizeof(FS_FILTER_CALLBACKS);
            fsFilterCallbacks.PreAcquireForSectionSynchronization = SpyPreFsFilterOperation;
            fsFilterCallbacks.PostAcquireForSectionSynchronization = SpyPostFsFilterOperation;
            fsFilterCallbacks.PreReleaseForSectionSynchronization = SpyPreFsFilterOperation;
            fsFilterCallbacks.PostReleaseForSectionSynchronization = SpyPostFsFilterOperation;
            fsFilterCallbacks.PreAcquireForCcFlush = SpyPreFsFilterOperation;
            fsFilterCallbacks.PostAcquireForCcFlush = SpyPostFsFilterOperation;
            fsFilterCallbacks.PreReleaseForCcFlush = SpyPreFsFilterOperation;
            fsFilterCallbacks.PostReleaseForCcFlush = SpyPostFsFilterOperation;
            fsFilterCallbacks.PreAcquireForModifiedPageWriter = SpyPreFsFilterOperation;
            fsFilterCallbacks.PostAcquireForModifiedPageWriter = SpyPostFsFilterOperation;
            fsFilterCallbacks.PreReleaseForModifiedPageWriter = SpyPreFsFilterOperation;
            fsFilterCallbacks.PostReleaseForModifiedPageWriter = SpyPostFsFilterOperation;

            status = FsRtlRegisterFileSystemFilterCallbacks(DriverObject, &fsFilterCallbacks);

            MSDN的詳細解釋

            Windows Driver Kit: Installable File System Drivers
            FsRtlRegisterFileSystemFilterCallbacks

            File system filter drivers call the FsRtlRegisterFileSystemFilterCallbacks routine to register notification callback routines to be invoked when the underlying file system performs certain operations.

            文件系統過濾驅動調用 FsRtlRegisterFileSystemFilterCallbacks 函數注冊需通知回調函數,這些回調函數將在文件系統的相關操作之前被調用

            				
            						
            NTSTATUS

            ??FsRtlRegisterFileSystemFilterCallbacks(
            ????IN?PDRIVER_OBJECT??FilterDriverObject,
            ????IN?PFS_FILTER_CALLBACKS??Callbacks
            ????);?

            Parameters

            FilterDriverObject
            Pointer to the driver object for the filter driver.
            Callbacks
            Pointer to a structure that contains the entry points of caller-supplied notification callback routines.

            This structure is defined as follows.

            Note: All of the callback entry points are optional and can be NULL.

            typedef?struct?_FS_FILTER_CALLBACKS?{
            ????ULONG?SizeOfFsFilterCallbacks;
            ????ULONG?Reserved;
            ????PFS_FILTER_CALLBACK?PreAcquireForSectionSynchronization;
            ????PFS_FILTER_COMPLETION_CALLBACK?PostAcquireForSectionSynchronization;
            ????PFS_FILTER_CALLBACK?PreReleaseForSectionSynchronization;
            ????PFS_FILTER_COMPLETION_CALLBACK?PostReleaseForSectionSynchronization;
            ????PFS_FILTER_CALLBACK?PreAcquireForCcFlush;
            ????PFS_FILTER_COMPLETION_CALLBACK?PostAcquireForCcFlush;
            ????PFS_FILTER_CALLBACK?PreReleaseForCcFlush;
            ????PFS_FILTER_COMPLETION_CALLBACK?PostReleaseForCcFlush;
            ????PFS_FILTER_CALLBACK?PreAcquireForModifiedPageWriter;
            ????PFS_FILTER_COMPLETION_CALLBACK?PostAcquireForModifiedPageWriter;
            ????PFS_FILTER_CALLBACK?PreReleaseForModifiedPageWriter;
            ????PFS_FILTER_COMPLETION_CALLBACK?PostReleaseForModifiedPageWriter;
            }?FS_FILTER_CALLBACKS,?*PFS_FILTER_CALLBACKS;

            The filter callback routine and its parameters are defined as follows:

            typedef
            NTSTATUS?(*PFS_FILTER_CALLBACK)?(
            ??????????????IN?PFS_FILTER_CALLBACK_DATA?Data,
            ??????????????OUT?PVOID?*CompletionContext
            ??????????????);

            ParameterMeaning
            DataPointer to the callback data structure for this operation.? 指向這個操作的回調數據結構
            CompletionContextContext information to be passed to the filter completion callback routine. Set to NULL if no context information is to be passed or if there is no corresponding filter completion callback routine.??傳給過濾器完成回調函數的上下文信息

            The filter completion callback routine and its parameters are defined as follows:

            typedef
            VOID?(*PFS_FILTER_COMPLETION_CALLBACK)?(
            ??????????IN?PFS_FILTER_CALLBACK_DATA?Data,
            ??????????IN?NTSTATUS?OperationStatus,
            ??????????IN?PVOID?CompletionContext
            ??????????);

            ParameterMeaning
            DataPointer to the callback data structure for this operation.
            OperationStatusStatus of the operation. If the file system successfully performed the operation, this parameter is set to STATUS_SUCCESS. Otherwise, it is set to an appropriate error status value.
            CompletionContextContext information that was set in the filter callback routine. This is set to NULL if no information is passed or if there is no corresponding filter callback routine.

            The callback data structure and its members are defined as follows:

            typedef?struct?_FS_FILTER_CALLBACK_DATA?{
            ????ULONG?SizeOfFsFilterCallbackData;
            ????UCHAR?Operation;
            ????UCHAR?Reserved;
            ????struct?_DEVICE_OBJECT?*DeviceObject;
            ????struct?_FILE_OBJECT?*FileObject;
            ????FS_FILTER_PARAMETERS?Parameters;
            }?FS_FILTER_CALLBACK_DATA,?*PFS_FILTER_CALLBACK_DATA;

            MemberMeaning
            SizeOfFsFilterCallbackDataSize of the callback data structure.
            OperationFile system operation for which the callback routine is to be invoked. This operation can be of the following: FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION
            FS_FILTER_RELEASE_FOR_SECTION_SYNCHRONIZATION
            FS_FILTER_ACQUIRE_FOR_MOD_WRITE
            FS_FILTER_RELEASE_FOR_MOD_WRITE
            FS_FILTER_ACQUIRE_FOR_CC_FLUSH
            FS_FILTER_RELEASE_FOR_CC_FLUSH
            ReservedReserved for system use.
            DeviceObjectDevice object for this operation.
            FileObjectFile object for this operation.
            ParametersUnion containing any operation-specific parameters.

            The filter parameter union is defined as follows:

            typedef?union?_FS_FILTER_PARAMETERS?{
            ????struct?{
            ????????PLARGE_INTEGER?EndingOffset;
            ????????PERESOURCE?*ResourceToRelease;
            ????}?AcquireForModifiedPageWriter;
            ????struct?{
            ????????PERESOURCE?ResourceToRelease;
            ????}?ReleaseForModifiedPageWriter;
            ????struct?{
            ????????FS_FILTER_SECTION_SYNC_TYPE?SyncType;
            ????????ULONG?PageProtection;
            ????}?AcquireForSectionSynchronization;
            ????struct?{
            ????????PVOID?Argument1;
            ????????PVOID?Argument2;
            ????????PVOID?Argument3;
            ????????PVOID?Argument4;
            ????????PVOID?Argument5;
            ????}?Others;
            }?FS_FILTER_PARAMETERS,?*PFS_FILTER_PARAMETERS;

            ParameterMeaning
            EndingOffsetOffset of the last byte being written plus one.
            ResourceToReleaseResource to be released.
            SyncTypeType of synchronization requested for the section: SyncTypeCreateSection if a section is being created, SyncTypeOther otherwise.
            PageProtectionType of page protection requested for the section. Must be zero if SyncType is SyncTypeOther. Otherwise, one of the following flags, possibly ORed with PAGE_NOCACHE:
            PAGE_READONLY
            PAGE_READWRITE
            PAGE_WRITECOPY
            PAGE_EXECUTE
            Argument1Reserved for future use.
            Argument2Reserved for future use.
            Argument3Reserved for future use.
            Argument4Reserved for future use.
            Argument5Reserved for future use.

            Return Value

            FsRtlRegisterFileSystemFilterCallbacks can return one of the following status values:

            STATUS_SUCCESS
            The callback routines were successfully registered.
            STATUS_INSUFFICIENT_RESOURCES
            FsRtlRegisterFileSystemFilterCallbacks encountered a pool allocation failure when allocating memory to store the callback information.
            STATUS_INVALID_PARAMETER
            One of the parameters is invalid.

            Comments

            FsRtlRegisterFileSystemFilterCallbacks should only be called by file system filter drivers, and only from the filter's DriverEntry routine.

            FsRtlRegisterFileSystemFilterCallbacks registers the notification callback routines that were specified in the Callbacks parameter to be invoked when requests for certain file operations are sent to the underlying file system.

            Callback routines are currently defined for the following operations:

            Operation Notification Callback Routine and Callback Completion Routine
            The memory manager acquires a file exclusively before creating a memory-mapped section for a portion of the file.

            Note: For this operation, SyncType is set to SyncTypeCreateSection.

            PreAcquireForSectionSynchronization
            PostAcquireForSectionSynchronization
            The memory manager releases a file after creating a memory-mapped section for a portion of the file. PreReleaseForSectionSynchronization
            PostReleaseForSectionSynchronization
            A kernel component (such as the cache manager) acquires a file exclusively before temporarily disabling section creation for a portion of the file.

            Note: For this operation, SyncType is set to SyncTypeOther.

            PreAcquireForSectionSynchronization
            PostAcquireForSectionSynchronization

            Note: PreAcquireForSectionSynchronization should always return a success status code (such as STATUS_SUCCESS) for this operation. Returning any other type of status code causes the system to ASSERT on a checked build. (On free builds, the status code is ignored.)

            A kernel component (such as the cache manager) releases a file after temporarily disabling section creation for a portion of the file. PreReleaseForSectionSynchronization
            PostReleaseForSectionSynchronization
            The cache manager acquires a file exclusively before flushing a portion of the file from the cache. PreAcquireForCcFlush
            PostAcquireForCcFlush
            The cache manager releases a file after flushing a portion of the file from the cache. PreReleaseForCcFlush
            PostReleaseForCcFlush
            The modified page writer acquires a file exclusively before writing a portion of the file to disk. PreAcquireForModifiedPageWriter
            PostAcquireForModifiedPageWriter
            The modified page writer releases a file after writing a portion of the file to disk. PreReleaseForModifiedPageWriter
            PostReleaseForModifiedPageWriter

            The filter notification callback routine is invoked before the operation request is passed to lower-level filter drivers and the underlying file system. In the callback routine, the filter driver should perform any needed processing and immediately return STATUS_SUCCESS. If a filter driver's callback routine returns a status value other than STATUS_SUCCESS, this causes the operation request to fail. Repeated failure of certain requests, such as locking requests, can halt system progress. Thus, filter drivers should fail such a request only when absolutely necessary. When failing these requests, the filter driver should return an error status value that describes the error as completely and accurately as possible.

            Note??A filter driver's notification callback routine cannot fail a request to release a file system resource. If a filter driver returns a status value other than STATUS_SUCCESS from any of the following notification callback routines, the status value is ignored.

            • PreReleaseForSectionSynchronization
            • PreReleaseForCcFlush
            • PreReleaseForModifiedPageWriter

            The filter completion callback routine is invoked after the operation request is passed to lower-level filter drivers and the underlying file system. In the completion callback routine, the filter driver must perform any needed processing and immediately return.

            The callback routines defined by FsRtlRegisterFileSystemFilterCallbacks supersede the following fast I/O callback routines, which are obsolete and should not be used by file system filter drivers:

            • AcquireForCcFlush
            • AcquireFileForNtCreateSection
            • AcquireForModWrite
            • ReleaseForCcFlush
            • ReleaseFileForNtCreateSection
            • ReleaseForModWrite

            Requirements

            Versions: This routine is available on Update Rollup for Windows 2000 Service Pack 4 (SP4) and on Microsoft Windows XP and later.

            IRQL:?Any level

            Headers: Declared in Ntifs.h. Include Ntifs.h.

            无码国内精品久久人妻蜜桃| 亚洲色欲久久久综合网| 俺来也俺去啦久久综合网| 中文字幕精品久久| 2021国产精品久久精品| 狠狠色婷婷久久一区二区三区| 国产精品久久久久久久久鸭 | 日韩欧美亚洲国产精品字幕久久久| 久久综合五月丁香久久激情| 久久精品蜜芽亚洲国产AV| 久久久久久久综合日本| 久久国产精品成人片免费| 久久精品国产清自在天天线| 久久精品国产亚洲av水果派| 日韩影院久久| 91精品婷婷国产综合久久| 伊人久久大香线蕉综合Av| 久久亚洲精品视频| 久久精品国产亚洲精品2020| 久久久久亚洲爆乳少妇无 | 国产精品欧美亚洲韩国日本久久 | 精品久久久无码中文字幕| 日韩精品久久久久久免费| 天天综合久久一二三区| 国内精品久久久久久不卡影院 | 亚洲国产天堂久久综合网站| 亚洲精品乱码久久久久久蜜桃图片| 欧美粉嫩小泬久久久久久久 | 国产高潮国产高潮久久久91 | 久久久久久久波多野结衣高潮 | 久久国产福利免费| 国产精品美女久久久久AV福利 | 久久精品免费一区二区三区| 青草国产精品久久久久久| 性欧美丰满熟妇XXXX性久久久 | 久久精品亚洲欧美日韩久久| 久久91综合国产91久久精品| 国产精品久久国产精品99盘| 色噜噜狠狠先锋影音久久| 久久久精品一区二区三区| 色综合久久最新中文字幕|