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

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

?? context.c

?? miniFilter.rar所有框架代碼以及對應的PPT資料,可以直接拿來進行修改即可完成各種驅動,是你開發微軟新過濾構架驅動所必下資料
?? C
?? 第 1 頁 / 共 2 頁
字號:

            if (ContextCreated != NULL) *ContextCreated = TRUE;
        }
    }

    *StreamContext = streamContext;

    return status;
}




NTSTATUS
CtxCreateStreamContext (
    __deref_out PCTX_STREAM_CONTEXT *StreamContext
    )
/*++

Routine Description:

    This routine creates a new stream context

Arguments:

    StreamContext         - Returns the stream context

Return Value:

    Status

--*/
{
    NTSTATUS status;
    PCTX_STREAM_CONTEXT streamContext;

    PAGED_CODE();

    //
    //  Allocate a stream context
    //

    DebugTrace( DEBUG_TRACE_STREAM_CONTEXT_OPERATIONS,
                ("[Ctx]: Allocating stream context \n") );

    status = FltAllocateContext( Globals.Filter,
                                 FLT_STREAM_CONTEXT,
                                 CTX_STREAM_CONTEXT_SIZE,
                                 PagedPool,
                                 &streamContext );

    if (!NT_SUCCESS( status )) {

        DebugTrace( DEBUG_TRACE_STREAM_CONTEXT_OPERATIONS | DEBUG_TRACE_ERROR,
                    ("[Ctx]: Failed to allocate stream context with status 0x%x \n",
                     status) );
        return status;
    }

    //
    //  Initialize the newly created context
    //

    RtlZeroMemory( streamContext, CTX_STREAM_CONTEXT_SIZE );

    streamContext->Resource = CtxAllocateResource();
    if(streamContext->Resource == NULL) {

        FltReleaseContext( streamContext );
        return STATUS_INSUFFICIENT_RESOURCES;
    }
    ExInitializeResourceLite( streamContext->Resource );

    *StreamContext = streamContext;

    return STATUS_SUCCESS;
}


NTSTATUS
CtxUpdateNameInStreamContext (
    __in PUNICODE_STRING DirectoryName,
    __inout PCTX_STREAM_CONTEXT StreamContext
    )
/*++

Routine Description:

    This routine updates the name of the target in the supplied stream context

Arguments:

    DirectoryName         - Supplies the directory name
    StreamContext    - Returns the updated name in the stream context

Return Value:

    Status

Note:

    The caller must synchronize access to the context. This routine does no
    synchronization

--*/
{
    NTSTATUS status;

    PAGED_CODE();

    //
    //  Free any existing name
    //

    if (StreamContext->FileName.Buffer != NULL) {

        CtxFreeUnicodeString(&StreamContext->FileName);
    }


    //
    //  Allocate and copy off the directory name
    //

    StreamContext->FileName.MaximumLength = DirectoryName->Length;
    status = CtxAllocateUnicodeString(&StreamContext->FileName);
    if (NT_SUCCESS(status)) {

        RtlCopyUnicodeString(&StreamContext->FileName, DirectoryName);
    }

    return status;
}




NTSTATUS
CtxCreateOrReplaceStreamHandleContext (
    __in PFLT_CALLBACK_DATA Cbd,
    __in BOOLEAN ReplaceIfExists,
    __deref_out PCTX_STREAMHANDLE_CONTEXT *StreamHandleContext,
    __out_opt PBOOLEAN ContextReplaced
    )
/*++

Routine Description:

    This routine creates a stream handle context for the target stream
    handle. Optionally, if the context already exists, this routine
    replaces it with the new context and releases the old context

Arguments:

    Cbd                   - Supplies a pointer to the callbackData which
                            declares the requested operation.
    ReplaceIfExists       - Supplies if the stream handle context must be
                            replaced if already present
    StreamContext         - Returns the stream context
    ContextReplaced       - Returns if an existing context was replaced

Return Value:

    Status

--*/
{
    NTSTATUS status;
    PCTX_STREAMHANDLE_CONTEXT streamHandleContext;
    PCTX_STREAMHANDLE_CONTEXT oldStreamHandleContext;

    PAGED_CODE();

    *StreamHandleContext = NULL;
    if (ContextReplaced != NULL) *ContextReplaced = FALSE;

    //
    //  Create a stream context
    //

    DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                ("[Ctx]: Creating stream handle context (FileObject = %p, Instance = %p)\n",
                 Cbd->Iopb->TargetFileObject,
                 Cbd->Iopb->TargetInstance) );

    status = CtxCreateStreamHandleContext( &streamHandleContext );

    if (!NT_SUCCESS( status )) {

        DebugTrace( DEBUG_TRACE_ERROR | DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                    ("[Ctx]: Failed to create stream context with status 0x%x. (FileObject = %p, Instance = %p)\n",
                    status,
                    Cbd->Iopb->TargetFileObject,
                    Cbd->Iopb->TargetInstance) );

        return status;
    }

    //
    //  Set the new context we just allocated on the file object
    //

    DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                ("[Ctx]: Setting stream context %p (FileObject = %p, Instance = %p, ReplaceIfExists = %x)\n",
                 streamHandleContext,
                 Cbd->Iopb->TargetFileObject,
                 Cbd->Iopb->TargetInstance,
                 ReplaceIfExists) );

    status = FltSetStreamHandleContext( Cbd->Iopb->TargetInstance,
                                        Cbd->Iopb->TargetFileObject,
                                        ReplaceIfExists ? FLT_SET_CONTEXT_REPLACE_IF_EXISTS : FLT_SET_CONTEXT_KEEP_IF_EXISTS,
                                        streamHandleContext,
                                        &oldStreamHandleContext );

    if (!NT_SUCCESS( status )) {

        DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                    ("[Ctx]: Failed to set stream handle context with status 0x%x. (FileObject = %p, Instance = %p)\n",
                    status,
                    Cbd->Iopb->TargetFileObject,
                    Cbd->Iopb->TargetInstance) );

        //
        //  We release the context here because FltSetStreamContext failed
        //
        //  If FltSetStreamContext succeeded then the context will be returned
        //  to the caller. The caller will use the context and then release it
        //  when he is done with the context.
        //

        DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                    ("[Ctx]: Releasing stream handle context %p (FileObject = %p, Instance = %p)\n",
                     streamHandleContext,
                     Cbd->Iopb->TargetFileObject,
                     Cbd->Iopb->TargetInstance) );

        FltReleaseContext( streamHandleContext );

        if (status != STATUS_FLT_CONTEXT_ALREADY_DEFINED) {

            //
            //  FltSetStreamContext failed for a reason other than the context already
            //  existing on the stream. So the object now does not have any context set
            //  on it. So we return failure to the caller.
            //

            DebugTrace( DEBUG_TRACE_ERROR | DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                        ("[Ctx]: Failed to set stream context with status 0x%x != STATUS_FLT_CONTEXT_ALREADY_DEFINED. (FileObject = %p, Instance = %p)\n",
                        status,
                        Cbd->Iopb->TargetFileObject,
                        Cbd->Iopb->TargetInstance) );

            return status;
        }

        //
        //  We will reach here only if we have failed with STATUS_FLT_CONTEXT_ALREADY_DEFINED
        //  and we can fail with that code only if the context already exists and we have used
        //  the FLT_SET_CONTEXT_KEEP_IF_EXISTS flag

        ASSERT( ReplaceIfExists  == FALSE );

        //
        //  Race condition. Someone has set a context after we queried it.
        //  Use the already set context instead
        //

        DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                    ("[Ctx]: Stream context already defined. Retaining old stream context %p (FileObject = %p, Instance = %p)\n",
                     oldStreamHandleContext,
                     Cbd->Iopb->TargetFileObject,
                     Cbd->Iopb->TargetInstance) );

        //
        //  Return the existing context. Note that the new context that we allocated has already been
        //  realeased above.
        //

        streamHandleContext = oldStreamHandleContext;
        status = STATUS_SUCCESS;

    } else {

        //
        //  FltSetStreamContext has suceeded. The new context will be returned
        //  to the caller. The caller will use the context and then release it
        //  when he is done with the context.
        //
        //  However, if we have replaced an existing context then we need to
        //  release the old context so as to decrement the ref count on it.
        //
        //  Note that the memory allocated to the objects within the context
        //  will be freed in the context cleanup and must not be done here.
        //

        if ( ReplaceIfExists &&
             oldStreamHandleContext != NULL) {

            DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                        ("[Ctx]: Releasing old stream handle context %p (FileObject = %p, Instance = %p)\n",
                         oldStreamHandleContext,
                         Cbd->Iopb->TargetFileObject,
                         Cbd->Iopb->TargetInstance) );

            FltReleaseContext( oldStreamHandleContext );
            if (ContextReplaced != NULL) *ContextReplaced = TRUE;
        }
    }

    *StreamHandleContext = streamHandleContext;

    return status;
}





NTSTATUS
CtxCreateStreamHandleContext (
    __deref_out PCTX_STREAMHANDLE_CONTEXT *StreamHandleContext
    )
/*++

Routine Description:

    This routine creates a new stream context

Arguments:

    StreamContext         - Returns the stream context

Return Value:

    Status

--*/
{
    NTSTATUS status;
    PCTX_STREAMHANDLE_CONTEXT streamHandleContext;

    PAGED_CODE();

    //
    //  Allocate a stream context
    //

    DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS,
                ("[Ctx]: Allocating stream handle context \n") );

    status = FltAllocateContext( Globals.Filter,
                                 FLT_STREAMHANDLE_CONTEXT,
                                 CTX_STREAMHANDLE_CONTEXT_SIZE,
                                 PagedPool,
                                 &streamHandleContext );

    if (!NT_SUCCESS( status )) {

        DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS | DEBUG_TRACE_ERROR,
                    ("[Ctx]: Failed to allocate stream handle context with status 0x%x \n",
                     status) );

        return status;
    }

    //
    //  Initialize the newly created context
    //

    RtlZeroMemory( streamHandleContext, CTX_STREAMHANDLE_CONTEXT_SIZE );

    streamHandleContext->Resource = CtxAllocateResource();
    if(streamHandleContext->Resource == NULL) {

        FltReleaseContext( streamHandleContext );
        return STATUS_INSUFFICIENT_RESOURCES;
    }
    ExInitializeResourceLite( streamHandleContext->Resource );

    *StreamHandleContext = streamHandleContext;

    return STATUS_SUCCESS;
}



NTSTATUS
CtxUpdateNameInStreamHandleContext (
    __in PUNICODE_STRING DirectoryName,
    __inout PCTX_STREAMHANDLE_CONTEXT StreamHandleContext
    )
/*++

Routine Description:

    This routine updates the name of the target in the supplied stream handle context

Arguments:

    DirectoryName             - Supplies the directory name
    StreamHandleContext   - Returns the updated name in the stream context

Return Value:

    Status

Note:

    The caller must synchronize access to the context. This routine does no
    synchronization

--*/
{
    NTSTATUS status;

    PAGED_CODE();

    //
    //  Free any existing name
    //

    if (StreamHandleContext->FileName.Buffer != NULL) {

        CtxFreeUnicodeString(&StreamHandleContext->FileName);
    }


    //
    //  Allocate and copy off the directory name
    //

    StreamHandleContext->FileName.MaximumLength = DirectoryName->Length;
    status = CtxAllocateUnicodeString(&StreamHandleContext->FileName);
    if (NT_SUCCESS(status)) {

        RtlCopyUnicodeString(&StreamHandleContext->FileName, DirectoryName);
    }

    return status;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品电影在线| www.欧美日韩国产在线| 成人天堂资源www在线| 欧美视频在线播放| 中文字幕精品三区| 久久成人免费网站| 欧美欧美午夜aⅴ在线观看| 国产精品美女久久久久久| 免费精品视频在线| 欧美在线999| 亚洲欧美电影院| 大胆亚洲人体视频| 精品精品欲导航| 日韩av成人高清| 欧美影院精品一区| 亚洲九九爱视频| 99re这里都是精品| 国产精品美女久久久久av爽李琼| 激情伊人五月天久久综合| 欧美日本视频在线| 性久久久久久久| 欧美日韩一本到| 亚洲成人av一区| 欧美乱妇23p| 日韩中文字幕区一区有砖一区 | 国产一区二区精品久久99| 欧美日韩高清在线| 午夜电影一区二区| 在线观看精品一区| 亚洲bt欧美bt精品| 51午夜精品国产| 五月婷婷综合在线| 777午夜精品视频在线播放| 日韩福利视频导航| 精品剧情v国产在线观看在线| 蜜臀av一区二区在线免费观看| 精品国产免费一区二区三区香蕉 | 欧美裸体bbwbbwbbw| 亚洲国产成人av网| 欧美人体做爰大胆视频| 蜜臀av性久久久久蜜臀aⅴ| 日韩情涩欧美日韩视频| 国产一区二区三区在线看麻豆| 久久久夜色精品亚洲| 成人一道本在线| 亚洲视频中文字幕| 欧美日韩国产小视频| 久久电影网电视剧免费观看| 久久九九全国免费| 91视频国产观看| 日韩中文字幕不卡| 国产欧美精品一区二区色综合朱莉| 成人av网站大全| 性做久久久久久| 久久美女艺术照精彩视频福利播放| 国产成人av电影在线播放| 亚洲欧美一区二区三区久本道91 | 日韩精品一区二区三区四区| 国内成+人亚洲+欧美+综合在线| 日本一区二区三区久久久久久久久不| av不卡在线观看| 天堂在线一区二区| 国产婷婷精品av在线| 欧美在线色视频| 国产酒店精品激情| 亚洲福利视频一区二区| 久久久久成人黄色影片| 色婷婷综合激情| 国产精品资源在线观看| 亚洲成国产人片在线观看| 久久久国产综合精品女国产盗摄| 色94色欧美sute亚洲13| 狠狠色丁香婷综合久久| 一个色综合网站| 欧美韩日一区二区三区四区| 欧美乱熟臀69xxxxxx| 97久久精品人人做人人爽50路| 蜜桃久久精品一区二区| 一区二区三区在线影院| 欧美极品xxx| 日韩一卡二卡三卡国产欧美| 成人国产在线观看| 国产精品一区在线观看乱码| 奇米影视在线99精品| 亚洲激情图片qvod| 国产精品乱码一区二区三区软件| 欧美本精品男人aⅴ天堂| 欧美亚洲禁片免费| 91香蕉国产在线观看软件| 国产精品一区不卡| 久久精品国产免费看久久精品| 亚洲成人自拍偷拍| 亚洲欧美日韩人成在线播放| 欧美激情在线一区二区三区| 日韩精品一区在线| 制服.丝袜.亚洲.另类.中文| 在线视频欧美区| 成人一区在线看| 国产乱子伦视频一区二区三区| 日本亚洲三级在线| 日韩精品免费视频人成| 亚洲成av人片在线观看无码| 亚洲精品成人a在线观看| 国产精品美女久久久久aⅴ国产馆| 久久久夜色精品亚洲| 精品国产免费人成在线观看| 91 com成人网| 在线不卡中文字幕播放| 欧美日韩极品在线观看一区| 欧美日本一区二区三区| 91精品麻豆日日躁夜夜躁| 欧美久久久久久久久中文字幕| 欧美日韩aaaaaa| 欧美一卡二卡三卡| 日韩视频一区在线观看| 欧美一区二区人人喊爽| 欧美一级片在线观看| 日韩精品中文字幕一区二区三区| 日韩免费视频一区二区| 精品国产91亚洲一区二区三区婷婷| 欧美白人最猛性xxxxx69交| 26uuu欧美日本| 国产欧美一区二区三区在线老狼| 国产人成亚洲第一网站在线播放| 久久精品综合网| 国产精品大尺度| 亚洲国产另类av| 美洲天堂一区二卡三卡四卡视频| 久久99九九99精品| 成人午夜电影久久影院| 99精品久久只有精品| 欧美日韩一区二区电影| 在线91免费看| 国产婷婷色一区二区三区在线| 国产精品九色蝌蚪自拍| 亚洲一区电影777| 久久精品国产亚洲一区二区三区| 国产精品影音先锋| 色婷婷亚洲婷婷| 日韩精品一区在线| 亚洲欧美在线观看| 日韩一区精品视频| 国产69精品久久久久777| 日本伦理一区二区| www激情久久| 亚洲精品亚洲人成人网| 久久电影网站中文字幕| 91视频免费播放| 欧美成人性福生活免费看| 中文字幕一区二区三区四区| 日韩精品免费视频人成| 成人免费视频网站在线观看| 欧美美女一区二区| 国产日韩精品视频一区| 三级亚洲高清视频| 成人丝袜高跟foot| 日韩一区二区三区电影| 亚洲欧洲av另类| 久久99精品国产.久久久久| 成人久久18免费网站麻豆| 6080日韩午夜伦伦午夜伦| 亚洲欧洲在线观看av| 麻豆精品新av中文字幕| 欧美在线观看视频一区二区 | 一区二区免费看| 国产成人久久精品77777最新版本| 欧美日韩美女一区二区| 国产精品不卡视频| 国产在线精品一区二区三区不卡| 欧美日韩一级黄| 亚洲美女屁股眼交| www.欧美.com| 久久久精品中文字幕麻豆发布| 偷偷要91色婷婷| 色婷婷久久久亚洲一区二区三区| 国产欧美一二三区| 久久精品国产亚洲一区二区三区| 欧美欧美午夜aⅴ在线观看| 亚洲三级电影网站| 成人深夜视频在线观看| 亚洲精品一线二线三线无人区| 日本亚洲三级在线| 欧美久久一二区| 五月婷婷激情综合| 欧美日韩国产片| 夜夜精品浪潮av一区二区三区| 91亚洲精品乱码久久久久久蜜桃| 国产亚洲美州欧州综合国| 黄页视频在线91| 欧美刺激脚交jootjob| 蜜桃久久精品一区二区| 日韩一级大片在线| 蜜臀av一区二区在线免费观看| 9191久久久久久久久久久| 日日摸夜夜添夜夜添国产精品| 欧美日免费三级在线| 婷婷中文字幕综合| 7777精品伊人久久久大香线蕉完整版 | 国产精品一品视频| 久久精品一区四区|