能力值:
( LV7,RANK:100 )
|
-
-
2 楼
在 HelloDDKQueryInformation例程中, 我单步了一下, 发现pIrp->MdlAddress一直是空的, 相反,
pIrp->AssociatedIrp.SystemBuffer却是可以使用的, 真是不解
|
能力值:
( LV5,RANK:70 )
|
-
-
3 楼
DO_DIRECT_IO 的输入缓冲区仍然使用SystemBuffer,只有输出缓冲区才使用mdl
|
能力值:
( LV7,RANK:100 )
|
-
-
4 楼
这就矛盾了, 我用DO_DIRECT_IO的时候, 不管ReadFile或者WriteFile, 在驱动里面都可以用mdl呀
|
能力值:
( LV5,RANK:70 )
|
-
-
5 楼
详情请参考驱动开发技术详解一书
|
能力值:
( LV7,RANK:100 )
|
-
-
6 楼
我就是看的这本书, 上面说的是如果是DO_BUFFERED_IO, 则缓冲区用的是SystemBuffer;
如果是DO_DIRECT_IO则用的是mdl
|
能力值:
( LV2,RANK:10 )
|
-
-
7 楼
直接方式的话 输入缓冲区还是SystemBuffer 输出变成mdl
|
能力值:
( LV2,RANK:10 )
|
-
-
8 楼
1,DO_BUFFERED_IO
(1)Read
irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithQuota...
irp->UserBuffer = Buffer //保存地址用于复制SystemBuffer给Ring3
(2)Write
irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithQuota...
RtlCopyMemory( rp->AssociatedIrp.SystemBuffer, Buffer, Length)
2,DO_DIRECTOR_IO
(1)Read/Write
IoAllocateMdl( Buffer, Length, FALSE, TRUE, irp );
3,Neither
(1)Read/Write
irp->UserBuffer = Buffer
////////////////////////////////////////////////////////
DeviceIoControl
METHOD_BUFFERED
irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithQuota(poolType,MAX(
InputBufferLength,OutputBufferLength))
RtlCopyMemory( rp->AssociatedIrp.SystemBuffer, InputBuffer,
InputBufferLength)
irp->UserBuffer = OutputBuffer;
METHOD_IO/OUT_DIRECTORY
irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithQuota(poolType,
InputBufferLength );
RtlCopyMemory( irp->AssociatedIrp.SystemBuffer,InputBuffer,
InputBufferLength );
IoAllocateMdl( OutputBuffer,OutputBufferLength,FALSE,TRUE,irp );
METHOD_NEITHER
irp->UserBuffer = OutputBuffer;
irpSp->Parameters.DeviceIoControl.Type3InputBuffer = InputBuffer;
QueryInformationFile
irp->UserBuffer = FileInformation;
irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithQuota..
irpSp->Parameters.QueryFile.Length = Length;
irpSp->Parameters.QueryFile.FileInformationClass = FileInformationClass;
设置irp->Flags |= IRP_BUFFERED_IO...!
SetInformationFile
irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithQuota..
rpSp->Parameters.SetFile.Length = Length;
irpSp->Parameters.SetFile.FileInformationClass = FileInformationClass;
设置irp->Flags |= IRP_BUFFERED_IO...!
///////////////////////////////////////////////////////////////////
1,当需要从Ring3传送数据到Ring0时,(BUFFERED/DIRECT)都通过SystemBuffer缓冲数据。
2,当需要从Ring0保存数据都Ring3时,(BUFFERED)都需要保存Ring3地址:irp->
UserBuffer = Ring3Buffer。
3,Query/SetInformationFile 都是BUFFERED_IO
|