How Access SRB buffer data in filter driver?
I'm writing a upper filter driver to a stream minidriver (DDK sample -
testcap.sys in my project) and try to
modify the stream data in the filter.
I write my filter based on the document :
http://www.cswl.com/whiteppr/tech/wdm.html
But how can I access the buffer data in the filter driver?
Any suggestion would be apprieciated, and thank you in advance.
Here's something about my idea.
in minidriver, I find the srb has the irp point:
0: kd> ??*pSrb (0x81921c78 struct _HW_STREAM_REQUEST_BLOCK *)
struct _HW_STREAM_REQUEST_BLOCK
+0x000 SizeOfThisPacket : 0x4c
+0x004 Command : 0 ( SRB_READ_DATA )
....
+0x018 CommandData : _CommandData
union _CommandData
+0x000 DataBufferArray : 0x81c038f8 (KSSTREAM_HEADER)
+0x000 StreamBuffer : 0x81c038f8
+0x000 .......
+0x01c NumberOfBuffers : 1
+0x020 TimeoutCounter : 0xf
+0x024 TimeoutOriginal : 0xf
+0x028 NextSRB : (null)
+0x02c Irp : 0x81f2a008
+0x030 Flags : 3
.....
and in the irp, I found the Irp->AssociatedIrp->SystemBuffer has the same
value with the pSrb->CommandData
(KSSTREAM_HEADER):
0: kd> ??*pSrb->Irp
struct _IRP
+0x000 Type : 6
+0x002 Size : 0x190
........
+0x00c AssociatedIrp : __unnamed
0: kd> ??pSrb->Irp->AssociatedIrp
union __unnamed
+0x000 MasterIrp : 0x81c038f8
+0x000 IrpCount : -2118108936
+0x000 SystemBuffer : 0x81c038f8
+0x010 ThreadListEntry : _LIST_ENTRY [ 0x81c275c8 - 0x821da018 ]
+0x018 IoStatus : _IO_STATUS_BLOCK
+0x020 RequestorMode : 1 ''
so I ajudge that Irp->AssociatedIrp->SystemBuffer is the stream data buffer,
but I found that when minidriver
complete the SRB (calling
StreamClassStreamNotification(StreamRequestComplete, ...)), the stream class
driver
(I took it for granted as I used "ba" command in Windbg)change the value of
pSrb->CommandData.Data. so in the
complete routine in filter driver, the stream data buffer can't access.