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

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

?? fspyctx.c

?? 一個文件過濾驅動程序的例子
?? C
?? 第 1 頁 / 共 4 頁
字號:
            SpyFreeContext( pContext );

            INC_STATS(TotalContextNonDeferredFrees);
            INC_LOCAL_STATS(deleteNowCount);

        } else {

            //
            //  Someone still has a pointer to it, it will get deleted
            //  later when they release
            //

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

    SPY_LOG_PRINT( SPYDEBUG_TRACE_CONTEXT_OPS,
                   ("FileSpy!SpyDeleteAllContexts:   %3d deleted now, %3d deferred, %3d close contention  \"%wZ\"\n",
                    deleteNowCount,
                    deleteDeferredCount,
                    deleteInCallbackCount,
                    &devExt->NLExtHeader.DeviceName) );
}


VOID
SpyDeleteContext (
    IN PDEVICE_OBJECT DeviceObject,
    IN PSPY_STREAM_CONTEXT pContext
    )
/*++

Routine Description:

    Unlink and release the given context.

Arguments:

    DeviceObject - Device to operate on

    pContext - The context to delete

Return Value:

    None.

--*/
{
    PFILESPY_DEVICE_EXTENSION devExt = DeviceObject->DeviceExtension;
    PFSRTL_PER_STREAM_CONTEXT ctxCtrl;

    PAGED_CODE();
    ASSERT(IS_FILESPY_DEVICE_OBJECT(DeviceObject));

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

    //
    //  Acquire list lock
    //

    SpyAcquireContextLockExclusive( devExt );

    //
    //  Remove from extension list (if still in it)
    //

    if (FlagOn(pContext->Flags,CTXFL_InExtensionList)) {

        RemoveEntryList( &pContext->ExtensionLink );
        RtlInterlockedClearBitsDiscardReturn(&pContext->Flags,CTXFL_InExtensionList);
    }

    //
    //  See if still in stream list.
    //

    if (!FlagOn(pContext->Flags,CTXFL_InStreamList)) {

        //
        //  Not in stream list, release lock and return
        //

        SpyReleaseContextLock( devExt );

    } else {

        //
        //  Remove from Stream list
        //

        ctxCtrl = FsRtlRemovePerStreamContext( pContext->Stream,
                                               devExt,
                                               NULL );
        //
        //  Always clear the flag wether we found it in the list or not.  We
        //  can have the flag set and not be in the list if after we acquired
        //  the context list lock we context swapped and the file system
        //  is right now in SpyDeleteContextCallback waiting on the list lock.
        //

        RtlInterlockedClearBitsDiscardReturn(&pContext->Flags,CTXFL_InStreamList);

        //
        //  Release list lock
        //

        SpyReleaseContextLock( devExt );

        //
        //  The context is now deleted from all of the lists and the lock is
        //  removed.  We need to see if we found this entry on the systems context
        //  list.  If not that means the callback was in the middle of trying
        //  to free this (while we were) and has already deleted it.
        //  If we found a structure then delete it now ourselves.
        //

        if (NULL != ctxCtrl) {

            ASSERT(pContext == CONTAINING_RECORD(ctxCtrl,SPY_STREAM_CONTEXT,ContextCtrl));

            //
            //  Decrement USE count, free context if zero
            //

            ASSERT(pContext->UseCount > 0);

            if (InterlockedDecrement( &pContext->UseCount ) <= 0) {

                INC_STATS(TotalContextNonDeferredFrees);
                SpyFreeContext( pContext );

            } else {

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

        } else {

            INC_STATS(TotalContextsNotFoundInStreamList);
        }
    }
}


VOID
SpyDeleteContextCallback (
    IN PVOID Context
    )
/*++

Routine Description:

    This is called by base file systems when a context needs to be deleted.

Arguments:

    Context - The context structure being deleted

Return Value:

    None.

--*/
{
    PSPY_STREAM_CONTEXT pContext = Context;
    PFILESPY_DEVICE_EXTENSION devExt;

    PAGED_CODE();

    devExt = (PFILESPY_DEVICE_EXTENSION)pContext->ContextCtrl.OwnerId;

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

    //
    //  When we get here we have already been removed from the stream list (by
    //  the calling file system), flag that this has happened.
    //

    RtlInterlockedClearBitsDiscardReturn(&pContext->Flags,CTXFL_InStreamList);

    //
    //  Lock the context list lock in the extension
    //

    SpyAcquireContextLockExclusive( devExt );

    //
    //  See if we are still linked into the extension list.  If not then skip
    //  the unlinking.  This can happen if someone is trying to delete this
    //  context at the same time as we are.
    //

    if (FlagOn(pContext->Flags,CTXFL_InExtensionList)) {

        RemoveEntryList( &pContext->ExtensionLink );
        RtlInterlockedClearBitsDiscardReturn(&pContext->Flags,CTXFL_InExtensionList);
    }

    SpyReleaseContextLock( devExt );

    //
    //  Decrement USE count, free context if zero
    //

    ASSERT(pContext->UseCount > 0);

    if (InterlockedDecrement( &pContext->UseCount ) <= 0) {

        INC_STATS(TotalContextCtxCallbackFrees);
        SpyFreeContext( pContext );

    } else {

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


VOID
SpyLinkContext (
    IN PDEVICE_OBJECT DeviceObject,
    IN PFILE_OBJECT FileObject,
    IN OUT PSPY_STREAM_CONTEXT *ppContext
    )
/*++

Routine Description:

    This will link the given context into the context list for the given
    device as well as into the given stream.

    NOTE:   It is possible for this entry to already exist in the table since
            between the time we initially looked and the time we inserted
            (which is now) someone else may have inserted one.  If we find an
            entry that already exists we will free the entry passed in and
            return the entry found.

Arguments:

    DeviceObject - Device we are operating on

    FileObject - Represents the stream to link the context into

    ppContext - Enters with the context to link, returns with the context
            to use.  They may be different if the given context already
            exists.

Return Value:

    None.

--*/
{
    PFILESPY_DEVICE_EXTENSION devExt = DeviceObject->DeviceExtension;
    NTSTATUS status;
    PSPY_STREAM_CONTEXT pContext = *ppContext;
    PSPY_STREAM_CONTEXT ctx;
    PFSRTL_PER_STREAM_CONTEXT ctxCtrl;

    PAGED_CODE();
    ASSERT(IS_FILESPY_DEVICE_OBJECT(DeviceObject));
    ASSERT(FileObject->FsContext != NULL);
    ASSERT(pContext != NULL);

    //
    //  If this is marked as a temporary context, return now.  Because we
    //  don't bump the reference count, when it is release it to be freed.
    //

    if (FlagOn(pContext->Flags,CTXFL_Temporary)) {

        ASSERT(!FlagOn(pContext->Flags,CTXFL_InExtensionList));
        return;
    }

    //
    //  We need to figure out if a duplicate entry already exists on
    //  the context list for this file object.  Acquire our list lock
    //  and then see if it exists.  If not, insert into the stream and
    //  volume lists.  If so, then simply free this new entry and return
    //  the original.
    //
    //  This can happen when:
    //  - Someone created an entry at the exact same time as we were
    //    creating an entry.
    //  - When someone does a create with overwrite or supersede we
    //    do not have the information yet to see if a context already
    //    exists.  Because of this we have to create a new context
    //    every time.  During post-create we then see if one already
    //    exists.
    //

    //
    //  Initialize the context control structure.  We do this now so we
    //  don't have to do it while the lock is held (even if we might
    //  have to free it because of a duplicate found)
    //

    FsRtlInitPerStreamContext( &pContext->ContextCtrl,
                               devExt,
                               NULL,
                               SpyDeleteContextCallback );

    //
    //  Save the stream we are associated with.
    //

    pContext->Stream = FsRtlGetPerStreamContextPointer(FileObject);

    //
    //  Acquire list lock exclusively
    //

    SpyAcquireContextLockExclusive( devExt );

    ASSERT(pContext->UseCount == 1);
    ASSERT(!FlagOn(pContext->Flags,CTXFL_InExtensionList));
    ASSERT(!FlagOn(pContext->Flags,CTXFL_Temporary));

    //
    //  See if we have an entry already on the list
    //

    ctxCtrl = FsRtlLookupPerStreamContext( FsRtlGetPerStreamContextPointer(FileObject),
                                           devExt,
                                           NULL );

    if (NULL != ctxCtrl) {

        //
        //  The context already exists so free the new one we just
        //  created.  First increment the use count on the one we found in
        //  the list.
        //

        ctx = CONTAINING_RECORD(ctxCtrl,SPY_STREAM_CONTEXT,ContextCtrl);

        ASSERT(ctx->Stream == FsRtlGetPerStreamContextPointer(FileObject));
        ASSERT(FlagOn(ctx->Flags,CTXFL_InExtensionList));
        ASSERT(ctx->UseCount > 0);

        //
        //  Bump ref count and release lock
        //

        InterlockedIncrement( &ctx->UseCount );

        SpyReleaseContextLock( devExt );

        //
        //  Since this cache is across opens on the same stream there are
        //  cases where the names will be different even though they are the
        //  same file.  These cases are:
        //      - One open could be by short name where another open
        //        is by long name.
        //      - This does not presently strip extended stream names like
        //        :$DATA
        //  When enabled this will display to the debugger screen when the
        //  names don't exactly match.  You can also break on this difference.
        //

        if (!RtlEqualUnicodeString( &pContext->Name,&ctx->Name,TRUE )) {

            SPY_LOG_PRINT( SPYDEBUG_TRACE_MISMATCHED_NAMES,
                           ("FileSpy!SpyLinkContext:        Old Name:   (%p) Fl=%02x Use=%d \"%wZ\"\n"
                            "                               New Name:   (%p) Fl=%02x Use=%d \"%wZ\"\n",
                            ctx,
                            ctx->Flags,
                            ctx->UseCount,
                            &ctx->Name,
                            pContext,
                            pContext->Flags,
                            pContext->UseCount,
                            &pContext->Name) );

            if (FlagOn(gFileSpyDebugLevel,SPYDEBUG_ASSERT_MISMATCHED_NAMES)) {

                DbgBreakPoint();
            }
        }

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

        //
        //  Free the new structure because it was already resident.  Note
        //  that this entry has never been linked into any lists so we know
        //  no one else has a reference to it.  Decrement use count to keep
        //  the ASSERTS happy then free the memory.
        //

        INC_STATS(TotalContextDuplicateFrees);

        pContext->UseCount--;
        SpyFreeContext( pContext );

        //
        //  Return the one we found in the list
        //

        *ppContext = ctx;

    } else {

        //
        //  The new context did not exist, insert this new one.
        //

        //
        //  Link into Stream context.  This can fail for the following
        //  reasons:
        //      This is a paging file
        //      This is a volume open
        //  If this happens then don't bump the reference count and it will be
        //  freed when the caller is done with it.
        //

        status = FsRtlInsertPerStreamContext( FsRtlGetPerStreamContextPointer(FileObject),
                                              &pContext->ContextCtrl );

        if (NT_SUCCESS(status)) {

            //
            //  Increment the USE count (because it is added to the stream)
            //

            InterlockedIncrement( &pContext->UseCount );

            //
            //  Link into Device extension
            //

            InsertHeadList( &devExt->CtxList, &pContext->ExtensionLink );

            //
            //  Mark that we have been inserted into both lists.  We don't have
            //  to do this interlocked because no one can access this entry
            //  until we release the context lock.
            //

            SetFlag( pContext->Flags, CTXFL_InExtensionList|CTXFL_InStreamList );

        }

        //
        //  Release lock
        //

        SpyReleaseContextLock( devExt );
    }
}


/***************************************************************************++

Routine Description:

    This will allocate and initialize a context structure but it does NOT
    link it into the context hash list.

Arguments:

Return Value:

--***************************************************************************/
NTSTATUS
SpyCreateContext (
    IN PDEVICE_OBJECT DeviceObject,
    IN PFILE_OBJECT FileObject,
    IN NAME_LOOKUP_FLAGS LookupFlags,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久激五月天综合精品| 一区二区三区视频在线观看| 在线观看国产一区二区| 成人精品一区二区三区中文字幕 | 亚洲激情图片一区| 亚洲制服丝袜在线| 亚洲一级在线观看| 天堂一区二区在线免费观看| 亚洲国产中文字幕在线视频综合| 伊人一区二区三区| 日韩精品福利网| 老鸭窝一区二区久久精品| 久久国产精品72免费观看| 国产成人午夜精品影院观看视频| 国产成人亚洲精品青草天美| 成人伦理片在线| 在线观看一区二区视频| 欧美精品日韩综合在线| 精品捆绑美女sm三区| 久久精品视频网| 亚洲欧美一区二区三区极速播放 | 久久精品国产免费| 国产凹凸在线观看一区二区| 92国产精品观看| 欧美一区二区三区色| 国产日韩v精品一区二区| 亚洲三级电影全部在线观看高清| 一区二区三区日韩在线观看| 美女久久久精品| eeuss鲁片一区二区三区在线看| 色哟哟精品一区| 欧美成人三级电影在线| 日韩一区欧美小说| 日韩高清不卡一区二区三区| 福利91精品一区二区三区| 欧洲av一区二区嗯嗯嗯啊| 欧美va亚洲va国产综合| 成人免费在线播放视频| 亚洲一区二区在线视频| 国产精品1区2区3区在线观看| 91美女福利视频| 久久嫩草精品久久久久| 亚洲一区二区高清| 成人短视频下载| 欧美va亚洲va香蕉在线| 亚洲无线码一区二区三区| 国产成人免费视频网站| 欧美日韩精品电影| 中文字幕视频一区| 久久成人久久鬼色| 欧美色偷偷大香| 亚洲男女毛片无遮挡| 国产成人午夜片在线观看高清观看| 欧美日韩亚州综合| 亚洲精品视频在线看| 国产福利一区二区| 精品成a人在线观看| 日韩精品免费专区| 欧美在线播放高清精品| 成人欧美一区二区三区黑人麻豆 | 日韩高清在线观看| 欧美日韩综合在线| 亚洲女同一区二区| 白白色 亚洲乱淫| 久久天天做天天爱综合色| 免费观看在线综合色| 7878成人国产在线观看| 亚洲一二三级电影| 色av综合在线| 一区二区在线观看免费视频播放| 99久久婷婷国产综合精品| 欧美国产欧美综合| voyeur盗摄精品| 国产精品你懂的| 成人av午夜电影| 成人欧美一区二区三区白人 | 亚洲免费观看高清| 色综合久久天天综合网| 一区二区三区蜜桃网| 欧美在线免费观看视频| 亚洲h在线观看| 3d成人h动漫网站入口| 免费不卡在线视频| 欧美tk丨vk视频| 懂色av一区二区三区免费观看| 国产欧美中文在线| 91久久精品网| 日本va欧美va欧美va精品| 久久久久久夜精品精品免费| 精品亚洲成a人在线观看| 亚洲男同性恋视频| 在线不卡中文字幕| 国产麻豆日韩欧美久久| 91啪在线观看| 亚洲欧美一区二区不卡| 欧美日韩高清影院| 九九精品视频在线看| 中文在线一区二区| 亚洲摸摸操操av| 色香色香欲天天天影视综合网| 中文字幕亚洲电影| 久久久噜噜噜久久中文字幕色伊伊 | 久久综合丝袜日本网| 日韩小视频在线观看专区| 精品视频一区三区九区| 在线视频综合导航| 色噜噜狠狠色综合欧洲selulu| 成人黄色电影在线| 大桥未久av一区二区三区中文| 国产乱子伦视频一区二区三区| 裸体健美xxxx欧美裸体表演| 奇米色一区二区| 久久精品国产99国产| 麻豆精品精品国产自在97香蕉| 亚洲综合无码一区二区| 亚洲国产视频a| 日韩av一区二| 麻豆精品在线看| 国产高清久久久| 97aⅴ精品视频一二三区| 波多野结衣亚洲一区| 99久久精品国产导航| 91黄色激情网站| 欧美性受极品xxxx喷水| 欧美高清视频在线高清观看mv色露露十八 | 懂色av一区二区三区免费观看| 粉嫩av一区二区三区在线播放| 国产乱子伦一区二区三区国色天香| 国产福利一区在线观看| 成人app下载| 欧美性感一类影片在线播放| 欧美老女人在线| 久久蜜桃一区二区| 综合久久久久综合| 日日摸夜夜添夜夜添亚洲女人| 精品一区二区综合| 成人免费视频视频在线观看免费| av成人动漫在线观看| 在线播放亚洲一区| 国产人成亚洲第一网站在线播放| 亚洲天堂成人网| 免费成人小视频| 99精品视频一区二区| 欧美高清hd18日本| 欧美激情在线一区二区| 亚洲小说春色综合另类电影| 激情久久五月天| 色婷婷精品久久二区二区蜜臀av| 欧美二区三区91| 国产精品三级电影| 日韩高清不卡一区二区三区| 北岛玲一区二区三区四区| 欧美顶级少妇做爰| 亚洲私人黄色宅男| 韩国成人在线视频| 欧美在线色视频| 国产欧美视频一区二区| 天堂久久久久va久久久久| 成人永久看片免费视频天堂| 3d成人h动漫网站入口| 亚洲蜜桃精久久久久久久| 精品一区二区三区不卡| 欧美午夜电影一区| 国产精品伦理一区二区| 奇米888四色在线精品| 色综合欧美在线视频区| 国产免费成人在线视频| 青娱乐精品视频| 欧美怡红院视频| 亚洲人精品午夜| 成人aa视频在线观看| 欧美大度的电影原声| 婷婷丁香久久五月婷婷| 99在线热播精品免费| 国产三区在线成人av| 久久精品噜噜噜成人88aⅴ | 99麻豆久久久国产精品免费| 日韩一二三区视频| 亚洲国产成人精品视频| 91麻豆精东视频| 国产精品对白交换视频| 国产在线播放一区三区四| 欧美一级日韩免费不卡| 午夜电影久久久| 欧美性做爰猛烈叫床潮| 亚洲精品国产视频| 91麻豆精品在线观看| 亚洲视频一二三| 91麻豆swag| 亚洲免费在线播放| 91麻豆.com| 夜夜嗨av一区二区三区四季av| 成人av网站在线| 国产精品久久久久久久蜜臀| 国产91露脸合集magnet| 欧美国产综合一区二区| 成av人片一区二区| 亚洲欧洲精品一区二区三区 | 欧美一区二区视频在线观看2020| 亚洲成人第一页|