ignore the part about the MdlAddress sharing a storage location - I got
it confused with SystemBuffer. Still I’d check to see if it’s valid
when you get the request as that would tell you whether you have a data
corruptor (or perhaps that you’re freeing or completing the IRP before
processing it)
I presume that at the pont you’re making this calculation you either
haven’t returned from your dispatch routine or you have returned
STATUS_PENDING?
-p
-----Original Message-----
From: Peter Wieland
Sent: Monday, February 09, 2004 1:33 PM
To: ‘Windows System Software Devs Interest List’
Subject: RE: [ntdev] invalid address
is the client a user-mode application or another kernel driver?
if the former, are you sure you supplied a buffer to the OutputBuffer
parameter and a non-zero length (DeviceIoControl takes a lot of
parameters and I’ve screwed this up occasioanlly).
if the latter did the client driver actually store an MDL into
MdlAddress? IoCallDriver doesn’t do this for you (though
IoBuildDeviceIoControlRequest would).
did the IRP have a valid MdlAdresss when your dispatch routine was
called? Perhaps you’ve managed to overwrite it somehow (remember it’s
in a union with several other fields). If it’s valid when you get the
irp you can set a write breakpoint in the debugger on &(Irp->MdlAddress)
and see what code is clearing it.
on a design note - why are you holding a spinlock while computing the
number of map registers that you need? That number won’t change out
from under you so you don’t need the lock there. You want to get into
the practice of only holding locks while you’re protecting a shared
resource, not while you’re doing drudge work. Do the drudge work up
front.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of hkeller
Sent: Monday, February 09, 2004 1:14 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] invalid address
Hi,
I’m fairly new at writing kernel mode drivers so please bare with me.
I’m writing an NT4 style driver (because I saw some good examples in the
OSR
book) and I am required to do driver queueing because I can have
simultaneous reads and writes to a PCI card I’m writing the driver for.
I’m using DeviceIoControl in the user app for reads/writes because I
need to specify a DDR address on the PCI card and, of course, a buffer
in the user area. The part of my driver that has to access the BAR0
regs (read/write) works just fine.
My problem revolves around the queueing of IRPs. In my StartReadIrp
code, where I’m deciding whether an IRP should be queued (or canceled) I
have a spinlock set (so I’m at dispatch_level) and when I get to the
code to determine how may map regs I get ( first calling
pMdlVirtualAddress = MmGetMdlVirtualAddress(Irp->MdlAddress)), I get a
violation on the call.
Turns out the Irp->MdlAddress is 0x00000000. Does anyone have any idea
what could cause this? I’m using METHOD_OUT_DIRECT for the IOCTL. Any
help would be appreciated.
Thanks in advance,
Howard Kellerp.s. I also posted this at msdn
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com