Re: Buffer manipulation of an IRP_MJ_READ/WRITE
- From: Peter Jones <PeterJones@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Feb 2008 17:52:00 -0800
I've just realised my mistake with all this; I've been trying to make this a
lot hard than it actually is. The buffer is merely a pointer, so like all
good pointers, I only need increment it to get to the next byte in the
buffer. That really is a proper school boy error, how embarrasing.
Thanks very much for the help Don!
Peter
"Don Burn" wrote:
Take a look at MmGetSystemAddressForMdlSafe, you should not need to lock.
down the pages, since if the call is occurring at DISPATCH_LEVEL the caller
will have locked them down.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
"Peter Jones" <Peter Jones@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7EAE2F8E-B27B-4A41-BC13-05539E763C39@xxxxxxxxxxxxxxxx
Hi all,
I'm pretty new to driver development, but I've been picking things up
fairly
quickly as I've gone along.
To set the scene a little: I've written myself a virtual device driver
that
allows you to use a disk image as a virtual disk on the system, allowing
the
user to read and write data etc, as you would expect a normal disk drive
to.
I'm aiming to get the driver to encrypt/decrypt data on the disk image,
each
time an IRP is issued to read/write. So, effectively performing on the fly
cryptography for the user.
Since the file system attached to the device works on a 512 byte size
sector, it should be a relatively simple process to perform encryption at
the
sector level. This is where my problem is though.
For a read opertion, I'm allocating a buffer using ExAllocatePool,
performing the read operation, then grabbing the system address for the
MDL
supplied in IRP->MdlAddress. After the operation is complete, theread
buffer
is then copied across into the system buffer address supplied by the MDL.
From what I can tell, I need to lock the paged memory using
MmProbeAndLockPages and then get an array of the memory pages using
MmMdlGetPfnArray. After this though, I'm a little unclear as how to
actually
manipulate the data I need.
Are there any methods for being able to manipulate the read/write buffers
used when processing an IRP? Ideally I need to be able to access
individual
bytes from the buffer.
Any help is greatly appreciated.
Thanks in advance,
Peter
- References:
- Re: Buffer manipulation of an IRP_MJ_READ/WRITE
- From: Don Burn
- Re: Buffer manipulation of an IRP_MJ_READ/WRITE
- Prev by Date: Mirror Driver Sample and Test Application
- Next by Date: DTM studio - insert a custom dll to test ISDN druver.
- Previous by thread: Re: Buffer manipulation of an IRP_MJ_READ/WRITE
- Next by thread: Re: Buffer manipulation of an IRP_MJ_READ/WRITE
- Index(es):
Relevant Pages
|