亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fspyctx.c

?? 一個(gè)文件過濾驅(qū)動程序的例子
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*++

Copyright (c) 1998-1999 Microsoft Corporation

Module Name:

    context.c

Abstract:

    This module contains all of the routines for tracking names using
    the new Stream Context feature.  It does this by attaching a context
    structure to a stream whenever a new name is requested.  It does
    properly handle when files and directories are renamed.

    Note that StreamContexts are a new feature in the system and are not
    supported by all file systems.  All of the standard Microsoft file
    systems support them (NTFS, fat, cdfs, udfs, rdr2) but there may be 3rd
    party file systems that do not.  This is one of the main reasons why
    track names by stream contexts is not enabled by default.

Environment:

    Kernel mode

--*/

#include <ntifs.h>
#include "filespy.h"
#include "fspyKern.h"
#include "namelookup.h"

#if USE_STREAM_CONTEXTS
#if WINVER < 0x0501
#error Stream contexts on only supported on Windows XP or later.
#endif

////////////////////////////////////////////////////////////////////////
//
//                    Local prototypes
//
////////////////////////////////////////////////////////////////////////

VOID
SpyDeleteContextCallback(
    IN PVOID Context
    );


//
// linker commands
//

#ifdef ALLOC_PRAGMA

#pragma alloc_text( PAGE, SpyInitDeviceNamingEnvironment )
#pragma alloc_text( PAGE, SpyCleanupDeviceNamingEnvironment )
#pragma alloc_text( PAGE, SpyDeleteAllContexts )
#pragma alloc_text( PAGE, SpyDeleteContext )
#pragma alloc_text( PAGE, SpyDeleteContextCallback )
#pragma alloc_text( PAGE, SpyLinkContext )
#pragma alloc_text( PAGE, SpyCreateContext )
#pragma alloc_text( PAGE, SpyFindExistingContext )
#pragma alloc_text( PAGE, SpyReleaseContext )

#endif  // ALLOC_PRAGMA

///////////////////////////////////////////////////////////////////////////
//
//                      Context support routines
//
///////////////////////////////////////////////////////////////////////////

VOID
SpyInitNamingEnvironment (
    VOID
    )
/*++

Routine Description:

    Init global variables

Arguments:

    None

Return Value:

    None.

--*/
{
}


VOID
SpyLogIrp (
    IN PIRP Irp,
    OUT PRECORD_LIST RecordList
    )
/*++

Routine Description:

    Records the Irp necessary information according to LoggingFlags in
    RecordList.  For any activity on the Irp path of a device being
    logged, this function should get called twice: once on the IRPs
    originating path and once on the IRPs completion path.

Arguments:

    Irp - The Irp that contains the information we want to record.
    LoggingFlags - The flags that say what to log.
    RecordList - The PRECORD_LIST in which the Irp information is stored.
    Context - if non-zero, an existing context record for this entry.

Return Value:

    None.

--*/
{
    PRECORD_IRP pRecordIrp = &RecordList->LogRecord.Record.RecordIrp;
    PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(Irp);
    PDEVICE_OBJECT deviceObject;
    PFILESPY_DEVICE_EXTENSION devExt;
    PSPY_STREAM_CONTEXT pContext;
    NAME_LOOKUP_FLAGS lookupFlags = 0;
    NTSTATUS status;
    FILE_STANDARD_INFORMATION standardInformation;

    //
    //  Init locals
    //

    deviceObject = pIrpStack->DeviceObject;
    devExt = deviceObject->DeviceExtension;

    //
    // Record the information we use for an originating Irp.  We first
    // need to initialize some of the RECORD_LIST and RECORD_IRP fields.
    // Then get the interesting information from the Irp.
    //

    SetFlag( RecordList->LogRecord.RecordType, RECORD_TYPE_IRP );

    pRecordIrp->IrpMajor        = pIrpStack->MajorFunction;
    pRecordIrp->IrpMinor        = pIrpStack->MinorFunction;
    pRecordIrp->IrpFlags        = Irp->Flags;
    pRecordIrp->FileObject      = (FILE_ID)pIrpStack->FileObject;
    pRecordIrp->DeviceObject    = (FILE_ID)deviceObject;
    pRecordIrp->ProcessId       = (FILE_ID)PsGetCurrentProcessId();
    pRecordIrp->ThreadId        = (FILE_ID)PsGetCurrentThreadId();
    pRecordIrp->Argument1       = pIrpStack->Parameters.Others.Argument1;
    pRecordIrp->Argument2       = pIrpStack->Parameters.Others.Argument2;
    pRecordIrp->Argument3       = pIrpStack->Parameters.Others.Argument3;
    pRecordIrp->Argument4       = pIrpStack->Parameters.Others.Argument4;

    KeQuerySystemTime( &pRecordIrp->OriginatingTime );

    //
    //  Do different things based on the operation
    //

    switch (pIrpStack->MajorFunction) {

        case IRP_MJ_CREATE:

            //
            //                      OPEN/CREATE file
            //
            //  Only record the desired access if this is a CREATE IRP.
            //

            pRecordIrp->DesiredAccess = pIrpStack->Parameters.Create.SecurityContext->DesiredAccess;

            //
            //  Set out name lookup state
            //

            SetFlag( lookupFlags, NLFL_IN_CREATE );

            //
            //  Flag if opening the directory of the given file
            //

            if (FlagOn( pIrpStack->Flags, SL_OPEN_TARGET_DIRECTORY )) {

                SetFlag( lookupFlags, NLFL_OPEN_TARGET_DIR );
            }

            //
            //  Set if opening by ID
            //

            if (FlagOn( pIrpStack->Parameters.Create.Options, FILE_OPEN_BY_FILE_ID )) {

                SetFlag( lookupFlags, NLFL_OPEN_BY_ID );
            }

            //
            //  We are in pre-create, we can not attach a context to the file
            //  object yet so simply create a context.  If it fails no name
            //  will be logged.
            //  Note:  We may already have a context on this file but we can't
            //         find it yet because the FsContext field is not setup yet.
            //         We go ahead and get a context so we will have a name if
            //         the operations fails.  We will detect the duplicate
            //         context during the post-create and delete the new one.
            //

            status = SpyCreateContext( deviceObject,
                                       pIrpStack->FileObject,
                                       lookupFlags,
                                       &pContext );

            if (NT_SUCCESS(status)) {

                SPY_LOG_PRINT( SPYDEBUG_TRACE_CONTEXT_OPS,
                               ("FileSpy!SpyLogIrp:             Created     (%p) Fl=%02x Use=%d \"%wZ\"\n",
                                 pContext,
                                 pContext->Flags,
                                 pContext->UseCount,
                                 &pContext->Name) );

                //
                //  If a context was found save it and mark that to sync back
                //  to the dispatch routine to complete this operation.
                //

                ASSERT(RecordList->NewContext == NULL);
                RecordList->NewContext = pContext;
                SetFlag( RecordList->Flags, RLFL_SYNC_TO_DISPATCH );
            }
            break;

        case IRP_MJ_CLOSE:


            //
            //                      CLOSE FILE
            //
            //  If this is a close we can only look up the name in the name
            //  cache.  It is possible that the close could be occurring
            //  during a cleanup  operation in the file system (i.e., before we
            //  have received the cleanup completion) and requesting the name
            //  would cause a deadlock in the file system.
            //

            SetFlag( lookupFlags, NLFL_ONLY_CHECK_CACHE );
            break;

        case IRP_MJ_SET_INFORMATION:

            if (FileRenameInformation ==
                pIrpStack->Parameters.SetFile.FileInformationClass)
            {

                //
                //                      RENAME FILE
                //
                //  We are doing a rename.  First get a context for the
                //  given file.  If this fails, mark that we don't want to
                //  try and lookup a name.
                //

                status = SpyGetContext( deviceObject,
                                        pIrpStack->FileObject,
                                        lookupFlags,
                                        &pContext );

                if (!NT_SUCCESS(status)) {

                    //
                    //  If we couldn't get a context simply delete all
                    //  existing ones (since we don't know what this rename
                    //  will change) and mark not to do a lookup.
                    //

                    SetFlag( lookupFlags, NLFL_NO_LOOKUP );
                    SpyDeleteAllContexts( deviceObject );
                    break;
                }

                //
                //  We retrieved a context, save it in the record and mark
                //  that we want to handle this during post rename.
                //

                ASSERT(RecordList->NewContext == NULL);
                RecordList->NewContext = pContext;
                SetFlag( RecordList->Flags, RLFL_SYNC_TO_DISPATCH );

                //
                //  We need to decide if we are renaming a file or a
                //  directory because we need to handle this differently
                //

                status = SpyQueryInformationFile( devExt->NLExtHeader.AttachedToDeviceObject,
                                                  pIrpStack->FileObject,
                                                  &standardInformation,
                                                  sizeof( standardInformation ),
                                                  FileStandardInformation,
                                                  NULL );

                if (!NT_SUCCESS(status)) {

                    //
                    //  We can't tell if it is a file or directory, assume
                    //  the worst case and handle it like a directory.
                    //

                    InterlockedIncrement( &devExt->AllContextsTemporary );
                    SpyDeleteAllContexts( deviceObject );
                    SetFlag( RecordList->Flags, RLFL_IS_DIRECTORY );
                    break;
                }

                if (standardInformation.Directory) {

                    //
                    //  Renaming a directory.  Mark that any contexts
                    //  created while the rename is in progress should be
                    //  temporary.  This way there is no window where
                    //  we may get an old stale name.  Then delete all
                    //  existing contexts.  NOTE:  the context we hold will
                    //  not actually be deleted until we release it.
                    //

                    InterlockedIncrement( &devExt->AllContextsTemporary );
                    SpyDeleteAllContexts( deviceObject );
                    SetFlag( RecordList->Flags, RLFL_IS_DIRECTORY );

                } else {

                    //
                    //  We are renaming a file.  Mark the context so it will
                    //  not be used.  This way if someone accesses this file
                    //  while it is being renamed they will lookup the
                    //  name again so we will always get an accurate name.
                    //  This context will be deleted during post rename
                    //  processing
                    //

                    SetFlag( pContext->Flags, CTXFL_DoNotUse);
                }
            }
            break;

    }

    //
    //  If the flag IRP_PAGING_IO is set in this IRP, we cannot query the name
    //  because it can lead to deadlocks.  Therefore, add in the flag so that
    //  we will only try to find the name in our cache.
    //

    if (FlagOn( Irp->Flags, IRP_PAGING_IO )) {

        ASSERT( !FlagOn( lookupFlags, NLFL_NO_LOOKUP ) );

        SetFlag( lookupFlags, NLFL_ONLY_CHECK_CACHE );
    }

    SetFlag( lookupFlags, NLFL_USE_DOS_DEVICE_NAME );

    SpySetName( RecordList,
                deviceObject,
                pIrpStack->FileObject,
                lookupFlags,
                (PSPY_STREAM_CONTEXT)RecordList->NewContext );

}


VOID
SpyLogIrpCompletion (
    IN PIRP Irp,
    PRECORD_LIST RecordList
    )
/*++

Routine Description:

    This routine performs post-operation logging of the IRP.

Arguments:

    DeviceObject - Pointer to device object FileSpy attached to the file system
        filter stack for the volume receiving this I/O request.

    Irp - Pointer to the request packet representing the I/O request.

    Record - RecordList

Return Value:

    None.

--*/
{
    PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(Irp);
    PRECORD_IRP pRecordIrp;
    PDEVICE_OBJECT deviceObject;
    PFILESPY_DEVICE_EXTENSION devExt;
    PSPY_STREAM_CONTEXT pContext;

    //
    //  Init locals
    //

    deviceObject = pIrpStack->DeviceObject;
    devExt = deviceObject->DeviceExtension;

    ASSERT(deviceObject ==
           (PDEVICE_OBJECT)RecordList->LogRecord.Record.RecordIrp.DeviceObject);

    //
    //  Do completion processing based on the operation
    //

    switch (pIrpStack->MajorFunction) {

        case IRP_MJ_CREATE:

            //
            //                  CREATE FILE
            //
            //  NOTE:  When processing CREATE completion IRPS this completion
            //         routine is never called at DISPATCH level, it is always
            //         synchronized back to the dispatch routine.  This is
            //         controlled by the setting of the RLFL_SYNC_TO_DISPATCH
            //         flag in the log record.
            //

            if (NULL != (pContext = RecordList->NewContext)) {

                //
                //  Mark context field so it won't be freed later
                //

                RecordList->NewContext = NULL;

                //
                //  If the operation succeeded and an FsContext is defined,
                //  then attach the context.  Else when the context is
                //  released it will be freed.
                //

                if (NT_SUCCESS(Irp->IoStatus.Status) &&
                    (NULL != pIrpStack->FileObject->FsContext)) {

                    SpyLinkContext( deviceObject,
                                    pIrpStack->FileObject,
                                    &pContext );

                    SPY_LOG_PRINT( SPYDEBUG_TRACE_CONTEXT_OPS,
                                   ("FileSpy!SpyLogIrpCompletion:   Link        (%p) Fl=%02x Use=%d \"%wZ\"\n",
                                     pContext,
                                     pContext->Flags,
                                     pContext->UseCount,
                                     &pContext->Name) );
					KdPrint(("sfilter!SfCreate: %s \n",pContext->Name));
                }

                //
                //  Now release the context
                //

                SpyReleaseContext( pContext );
            }
            break;

        case IRP_MJ_SET_INFORMATION:

            if (FileRenameInformation ==
                pIrpStack->Parameters.SetFile.FileInformationClass)
            {

                //
                //                  RENAMING FILE
                //
                //  NOTE:  When processing RENAME completion IRPS this
                //         completion routine is never called at DISPATCH level,
                //         it is always synchronized back to the dispatch
                //         routine.  This is controlled by the setting of the
                //         RLFL_SYNC_TO_DISPATCH flag in the log record.
                //

                if (NULL != (pContext = RecordList->NewContext)) {

                    //
                    //  Mark context field so it won't be freed later
                    //

                    RecordList->NewContext = NULL;

                    //
                    //  See if renaming a directory

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美tk—视频vk| 久久久久免费观看| 国产乱人伦精品一区二区在线观看 | 日韩精品一卡二卡三卡四卡无卡| 久久综合久久久久88| 色拍拍在线精品视频8848| 久久99久久99| 亚洲一区在线观看免费观看电影高清| 精品国产sm最大网站免费看| 色乱码一区二区三区88| 国产美女一区二区三区| 亚洲电影在线免费观看| 国产欧美久久久精品影院| 欧美一级片免费看| 欧美日韩中文字幕一区| 波多野结衣中文字幕一区| 极品瑜伽女神91| 日本视频在线一区| 亚洲动漫第一页| 亚洲黄色性网站| 亚洲图片你懂的| 国产农村妇女精品| 国产亚洲综合在线| 日韩精品在线一区二区| 欧美一区二区三区视频免费播放 | 综合婷婷亚洲小说| 亚洲国产精品99久久久久久久久| 精品少妇一区二区三区在线视频 | 精品福利一区二区三区免费视频| 欧美日韩成人高清| 欧美视频完全免费看| 欧洲视频一区二区| 色综合久久综合| 色综合天天综合网天天看片| 99久久综合99久久综合网站| 成人午夜av在线| eeuss影院一区二区三区| eeuss鲁一区二区三区| 99久久精品国产网站| 99在线精品一区二区三区| 成人app在线| 色综合 综合色| 欧美亚洲高清一区二区三区不卡| 欧美丝袜丝交足nylons| 欧美日韩亚州综合| 欧美一级午夜免费电影| 日韩三级高清在线| 国产日产欧美一区二区视频| 国产日韩精品一区二区浪潮av | 国产亚洲欧美中文| 中文字幕国产一区| 亚洲三级在线免费| 亚洲黄色片在线观看| 亚洲高清一区二区三区| 日韩制服丝袜av| 精品写真视频在线观看 | 欧美美女网站色| 日韩视频免费直播| 国产亚洲午夜高清国产拍精品| 国产精品视频免费看| 亚洲精品视频一区| 日韩黄色片在线观看| 精品一区二区成人精品| 成人福利视频网站| 欧美亚洲国产一区二区三区va| 337p亚洲精品色噜噜| 久久久久久久电影| 亚洲日本青草视频在线怡红院| 香蕉成人啪国产精品视频综合网| 日本成人在线视频网站| 国产成人av网站| 欧美性色黄大片手机版| 精品少妇一区二区三区视频免付费| 国产人伦精品一区二区| 一区二区高清免费观看影视大全| 天天免费综合色| 成人综合在线观看| 欧美电影一区二区| 国产欧美日韩三区| 五月天激情小说综合| 国产夫妻精品视频| 欧美在线啊v一区| 久久久久99精品一区| 一区二区激情小说| 国产精品一区二区久久精品爱涩| 色域天天综合网| 久久久久亚洲蜜桃| 天使萌一区二区三区免费观看| 国产成人免费在线视频| 欧美日免费三级在线| 国产精品污网站| 老汉av免费一区二区三区| 99精品视频在线观看| 日韩欧美一区二区免费| 亚洲激情自拍视频| 成人永久免费视频| 日韩午夜在线播放| 亚洲成人午夜电影| 成人不卡免费av| www久久精品| 偷拍亚洲欧洲综合| 日本高清不卡视频| 国产欧美va欧美不卡在线| 奇米888四色在线精品| 一本色道久久综合精品竹菊| 2020国产成人综合网| 丝袜美腿一区二区三区| 一本大道久久a久久精品综合| 久久综合久久鬼色| 日本强好片久久久久久aaa| 色婷婷综合激情| 最新不卡av在线| 成人免费看的视频| 国产午夜精品一区二区三区视频 | 欧美精品一区二区三区在线播放| 亚洲va欧美va天堂v国产综合| 色美美综合视频| 亚洲欧洲精品一区二区精品久久久| 久久69国产一区二区蜜臀| 91麻豆精品国产综合久久久久久| 亚洲一区二区三区中文字幕 | 亚洲国产视频一区| 97成人超碰视| 国产精品福利在线播放| 国产精品1区2区3区| 精品国产免费久久| 精品一区二区久久| 欧美成人精品福利| 久久精品99国产国产精| 这里只有精品电影| 亚洲a一区二区| 欧美日韩电影一区| 亚洲高清免费在线| 欧美日韩精品欧美日韩精品 | 亚洲第一在线综合网站| 在线观看亚洲a| 香蕉成人伊视频在线观看| 欧美日本在线观看| 三级不卡在线观看| 欧美一级生活片| 狠狠色丁香久久婷婷综| 久久夜色精品国产噜噜av| 国产在线视频不卡二| 国产午夜亚洲精品理论片色戒| 国产成人日日夜夜| 亚洲欧美偷拍卡通变态| 91精品1区2区| 日韩精品福利网| 久久综合色婷婷| 国产经典欧美精品| 中文字幕一区在线| 色88888久久久久久影院野外| 亚洲国产毛片aaaaa无费看| 欧美一区二区三区四区视频| 韩国精品在线观看| 亚洲国产精品黑人久久久| 一本大道久久a久久综合婷婷 | 成人黄色a**站在线观看| 国产精品成人免费在线| 一本到不卡免费一区二区| 亚洲高清免费一级二级三级| 日韩欧美二区三区| 成人免费黄色在线| 亚洲主播在线观看| 精品久久久久久久久久久久包黑料| 国产美女精品人人做人人爽 | 久久国产精品99久久久久久老狼| 久久久久久一二三区| 91浏览器打开| 美腿丝袜亚洲综合| 欧美国产日韩一二三区| 欧美午夜理伦三级在线观看| 麻豆一区二区三| 亚洲色图都市小说| 日韩欧美一区在线观看| 成人一区二区三区视频在线观看| 一区二区三区四区蜜桃 | 亚洲国产成人在线| 欧美在线视频不卡| 国产乱对白刺激视频不卡| 亚洲欧美色综合| 久久天天做天天爱综合色| 91小视频免费观看| 久久国产福利国产秒拍| 一区二区视频在线| 亚洲精品一区二区三区影院| 一本色道久久综合亚洲aⅴ蜜桃 | 91在线播放网址| 九九在线精品视频| 一区二区三区在线看| 久久久久久麻豆| 欧美日韩国产小视频在线观看| 国产成人aaa| 青草国产精品久久久久久| 亚洲卡通欧美制服中文| 2欧美一区二区三区在线观看视频| 欧美色图第一页| 北条麻妃一区二区三区| 久久国产精品色| 日韩不卡手机在线v区|