欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > Npfs!NpFsdWrite函数和Npfs!NpCommonWrite函数和Npfs!NpWriteDataQueue函数中的DeferredList

Npfs!NpFsdWrite函数和Npfs!NpCommonWrite函数和Npfs!NpWriteDataQueue函数中的DeferredList

2025/4/4 15:29:41 来源:https://blog.csdn.net/sitelist/article/details/146897741  浏览:    关键词:Npfs!NpFsdWrite函数和Npfs!NpCommonWrite函数和Npfs!NpWriteDataQueue函数中的DeferredList

印子:继续第八部分
https://chenghao.blog.csdn.net/article/details/146724782
第八部分:Npfs!NpFsdWrite函数到nt!IopfCompleteRequest函数

1: kd> kc 9
 #
00 nt!IopfCompleteRequest
01 Npfs!NpFsdWrite
02 nt!IofCallDriver
03 nt!IopSynchronousServiceTail
04 nt!NtWriteFile
05 nt!_KiSystemService
06 SharedUserData!SystemCallStub
07 ntdll!ZwWriteFile
08 RPCRT4!UTIL_WriteFile

第一部分:
1: kd> kv 3
 # ChildEBP RetAddr  Args to Child              
00 f794ab9c baaf50e5 e179e288 00000001 007b3990 Npfs!NpWriteDataQueue (FPO: [Non-Fpo]) (CONV: stdcall) [d:\srv03rtm\base\fs\npfs\writesup.c @ 88]
01 f794ac14 baaf52f6 895824b8 007b3990 00000030 Npfs!NpCommonWrite+0x1b5 (FPO: [Non-Fpo]) (CONV: stdcall) [d:\srv03rtm\base\fs\npfs\write.c @ 457]
02 f794ac54 80a2675c 895a5038 8979ef68 80a03598 Npfs!NpFsdWrite+0xcc (FPO: [Non-Fpo]) (CONV: stdcall) [d:\srv03rtm\base\fs\npfs\write.c @ 93]

第二部分:
NTSTATUS
NpFsdWrite (
    IN PNPFS_DEVICE_OBJECT NpfsDeviceObject,
    IN PIRP Irp
    )
{
    InitializeListHead (&DeferredList);

    (VOID) NpCommonWrite( IrpSp->FileObject,
                          Irp->UserBuffer,
                          IrpSp->Parameters.Write.Length,
                          Irp->Tail.Overlay.Thread,
                          &Iosb,
                          Irp,
                          &DeferredList );

第三部分:
BOOLEAN
NpCommonWrite (
    IN PFILE_OBJECT FileObject,
    IN PVOID WriteBuffer,
    IN ULONG WriteLength,
    IN PETHREAD UserThread,
    OUT PIO_STATUS_BLOCK Iosb,
    IN PIRP Irp OPTIONAL,
    IN PLIST_ENTRY DeferredList
    )
{
。。。。。。
        Iosb->Status = NpWriteDataQueue( WriteQueue,
                                         ReadMode,
                                         WriteBuffer,
                                         WriteLength,
                                         Ccb->Fcb->Specific.Fcb.NamedPipeType,
                                         &WriteRemaining,
                                         Ccb,
                                         NamedPipeEnd,
                                         UserThread,
                                         DeferredList );

第四部分:
NTSTATUS
NpWriteDataQueue (
    IN PDATA_QUEUE WriteQueue,
    IN READ_MODE ReadMode,
    IN PUCHAR WriteBuffer,
    IN ULONG WriteLength,
    IN NAMED_PIPE_TYPE PipeType,
    OUT PULONG WriteRemaining,
    IN PCCB Ccb,
    IN NAMED_PIPE_END NamedPipeEnd,
    IN PETHREAD UserThread,
    IN PLIST_ENTRY DeferredList
    )

{
。。。。。。

        if (*WriteRemaining == 0) {

            DebugTrace(0, Dbg, "Finished up the write remaining\n", 0);

            //**** ASSERT( ReadIrp->IoStatus.Information != 0 );

            NpDeferredCompleteRequest( ReadIrp, STATUS_SUCCESS, DeferredList );


#define NpDeferredCompleteRequest(IRP,STATUS,LIST) {           \
    (IRP)->IoStatus.Status = STATUS;                           \
    InsertTailList ((LIST), &(IRP)->Tail.Overlay.ListEntry);   \
}

第五部分:


    (VOID) NpCommonWrite( IrpSp->FileObject,
                          Irp->UserBuffer,
                          IrpSp->Parameters.Write.Length,
                          Irp->Tail.Overlay.Thread,
                          &Iosb,
                          Irp,
                          &DeferredList );

    NpReleaseVcb();

    //
    // Complete any deferred IRPs now we have dropped the locks
    //
    NpCompleteDeferredIrps (&DeferredList);

VOID
FORCEINLINE
NpCompleteDeferredIrps (
    IN PLIST_ENTRY DeferredList
    )
{
    PIRP Irp;
    PLIST_ENTRY Entry, NextEntry;

    Entry = DeferredList->Flink;
    while (Entry != DeferredList) {
        Irp = CONTAINING_RECORD (Entry, IRP, Tail.Overlay.ListEntry);
        NextEntry = Entry->Flink;
        NpCompleteRequest (Irp, Irp->IoStatus.Status);
        Entry = NextEntry;
    }
}


#define NpCompleteRequest(IRP,STATUS) FsRtlCompleteRequest( (IRP), (STATUS) );

#define FsRtlCompleteRequest(IRP,STATUS) {         \
    (IRP)->IoStatus.Status = (STATUS);             \
    IoCompleteRequest( (IRP), IO_DISK_INCREMENT ); \
}

#define IO_DISK_INCREMENT               1

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词