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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fspyctx.c

?? 一個文件過濾驅(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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产91亚洲一区二区三区婷婷| 亚洲第一电影网| 国产精品亚洲成人| 欧美国产成人在线| 91亚洲精品久久久蜜桃网站| 亚洲毛片av在线| 欧美精品久久久久久久多人混战| 美女在线视频一区| 欧美韩日一区二区三区| 色婷婷精品久久二区二区蜜臀av| 香蕉成人啪国产精品视频综合网 | 久久婷婷色综合| 大胆欧美人体老妇| 亚洲一本大道在线| 日韩精品一区二区在线观看| 国产精品18久久久久久久久久久久 | 中文字幕一区二区三区四区 | 日韩精品电影在线观看| 亚洲国产综合人成综合网站| 欧美一区二区视频在线观看| 国产精品一区久久久久| 夜夜揉揉日日人人青青一国产精品| 欧美电影在哪看比较好| 国产馆精品极品| 亚洲无线码一区二区三区| 久久伊99综合婷婷久久伊| 一本大道综合伊人精品热热| 蜜桃久久久久久久| 亚洲欧美日韩综合aⅴ视频| 在线不卡免费欧美| 成年人网站91| 久久av资源网| 夜色激情一区二区| 国产精品天干天干在观线| 欧美精品视频www在线观看| 国产成人在线视频网站| 日韩av电影免费观看高清完整版 | 国产日产亚洲精品系列| 在线电影欧美成精品| 国产成人免费av在线| 日韩精品亚洲一区二区三区免费| 日本一区二区三区久久久久久久久不 | 国产无一区二区| 91精品国产入口| 欧美性欧美巨大黑白大战| 国产91精品露脸国语对白| 青娱乐精品视频| 亚洲精品成人精品456| 久久久久国产一区二区三区四区| 在线视频国内一区二区| 成人三级在线视频| 国产一区二区调教| 日本不卡一二三| 亚洲综合色成人| 亚洲欧美电影院| 中文字幕av一区二区三区| 精品国免费一区二区三区| 欧美另类一区二区三区| 色八戒一区二区三区| 丁香婷婷深情五月亚洲| 国产酒店精品激情| 蜜桃91丨九色丨蝌蚪91桃色| 亚洲第一av色| 亚洲国产欧美一区二区三区丁香婷| 国产精品视频一区二区三区不卡| 久久女同性恋中文字幕| 精品人在线二区三区| 91精品国产91综合久久蜜臀| 欧美色手机在线观看| 欧美艳星brazzers| 在线精品视频一区二区三四 | 欧美性视频一区二区三区| 色婷婷av一区二区三区软件| 99热精品国产| 99热国产精品| 色综合久久六月婷婷中文字幕| a级精品国产片在线观看| 北条麻妃国产九九精品视频| 国产91丝袜在线18| 成人h动漫精品一区二区 | 91日韩在线专区| 91网站在线播放| 欧美专区日韩专区| 欧美揉bbbbb揉bbbbb| 欧美美女激情18p| 欧美一区二区三区视频免费 | 国产精品视频一二| 亚洲欧洲精品成人久久奇米网| 中文字幕在线不卡一区二区三区| 国产精品久久久久天堂| 亚洲免费视频中文字幕| 亚洲电影一级黄| 青青草伊人久久| 狠狠狠色丁香婷婷综合激情| 粉嫩蜜臀av国产精品网站| 99在线热播精品免费| 欧美色图第一页| 精品欧美黑人一区二区三区| 国产拍揄自揄精品视频麻豆| **欧美大码日韩| 亚洲韩国一区二区三区| 麻豆国产欧美日韩综合精品二区| 国产真实乱子伦精品视频| 成人免费视频caoporn| 色噜噜狠狠色综合欧洲selulu| 欧美美女网站色| 国产婷婷一区二区| 亚洲综合成人在线视频| 久色婷婷小香蕉久久| 国产成人aaa| 欧美色倩网站大全免费| 精品捆绑美女sm三区| 最新不卡av在线| 秋霞电影网一区二区| thepron国产精品| 日韩无一区二区| 亚洲欧美日韩国产一区二区三区 | 欧美日韩亚洲综合在线 | 色香蕉久久蜜桃| 精品国产伦一区二区三区观看方式 | 欧美日韩一级视频| 久久精品综合网| 亚洲国产精品尤物yw在线观看| 国产精品99久久久久久久vr| 欧美三级日韩三级国产三级| 久久午夜免费电影| 亚洲香肠在线观看| 丁香六月久久综合狠狠色| 777午夜精品免费视频| 国产精品久久久久久久岛一牛影视 | 日韩欧美国产电影| 亚洲美女视频在线| 成人免费观看av| 精品国产百合女同互慰| 亚洲国产视频一区| 99免费精品视频| 国产亚洲精品福利| 狂野欧美性猛交blacked| 欧美性淫爽ww久久久久无| 欧美国产视频在线| 精品一区中文字幕| 91精品国产麻豆| 亚洲bt欧美bt精品777| 色视频一区二区| 国产精品久久久久久久裸模| 久久99精品国产麻豆婷婷| 欧美日韩一卡二卡三卡 | 午夜精品久久久久久久久| 97久久人人超碰| 欧美激情中文不卡| 狠狠色狠狠色综合日日91app| 欧美一区二区大片| 丝袜国产日韩另类美女| 欧洲中文字幕精品| 亚洲激情自拍视频| 91美女视频网站| 成人欧美一区二区三区视频网页 | 欧美色图天堂网| 亚洲精品日韩一| 91视频免费看| 亚洲图片欧美激情| 91麻豆精品秘密| 亚洲欧美中日韩| 91在线国产福利| 自拍视频在线观看一区二区| 成人a区在线观看| 自拍偷在线精品自拍偷无码专区| 99久久综合国产精品| 亚洲欧美在线观看| 日本丶国产丶欧美色综合| 一区二区在线观看免费| 欧美日韩一区二区三区不卡| 亚洲成人久久影院| 在线不卡一区二区| 蜜臀av性久久久久蜜臀aⅴ| 精品精品国产高清一毛片一天堂| 国产一区视频网站| 国产精品久久久久久久久免费樱桃| 不卡影院免费观看| 亚洲影院久久精品| 91精品国产麻豆国产自产在线| 九九精品一区二区| 国产精品入口麻豆九色| 9人人澡人人爽人人精品| 亚洲国产视频在线| 日韩欧美亚洲一区二区| 国产精品综合二区| 综合电影一区二区三区| 欧美区一区二区三区| 经典三级视频一区| 国产日韩欧美精品在线| 91网站在线播放| 日本午夜精品视频在线观看 | 欧美唯美清纯偷拍| 美女性感视频久久| 国产精品日韩成人| 欧洲亚洲精品在线| 久久精工是国产品牌吗| 欧美激情在线观看视频免费| 91豆麻精品91久久久久久|