Re: Passing buffer to a driver
- From: Andrew Schweitzer <anschweitzer@xxxxxxxxx>
- Date: Mon, 12 Jan 2009 09:09:45 -0800 (PST)
I got some results, but I'm not sure what they mean. I assume I'm
violating some simple and obvious protocol about passing buffers to
drivers. I thought I read the helped and obeyed the rules, but it
still doesn't work. As far as I can tell, the only thing you need to
do for pointers embedded in parameters to DeviceIoControl is call
MapCallerPtr in the device driver. Is this true? The help also
mentions MapPtrToProcess, but apparently, from news groups and
possibly some confusing references in the help, that is deprecated; in
the private code MapCallPtr seems to call MapPtrToProcess anyway; and
the I got the same results either way (same pointer modification, same
crash). Finally, I discovered that in our code, we don't seem to use
embedded pointers in calls to DeviceIoControl anywhere - they are all
flat pointers. Some are VirtualAlloc'd and possibly newed, most are on
the stack, but none are structures with embedded pointers.
I think I'm missing something simple and obvious... any ideas?
Here's the raw numbers I get:
TestApp - Stack alloc addr: 0C09F4EC
IOCTL - raw embedded pointer 0C09F4EC
IOCTL - mapped pointer 0C09F4EC
Result - Success
TestApp - VirtualAlloc addr: 000D0000
IOCTL - raw embedded pointer 000D0000
IOCTL - mapped pointer 040D0000
Result - Crash:
Exception 'Data Abort' ...
RaiseException: ...'filesys.exe'
Exception 'RaiseException' ...
Halting system
TestApp - new alloc addr: 000B1540
IOCTL - raw embedded pointer 000B1540
IOCTL - mapped pointer 040B1540
Result - Crash:
Data Abort: ...'filesys.exe'
RaiseException: ...'filesys.exe'
IOCTL retuns
Thanks,
Andy
On Jan 9, 4:43 pm, "Dean Ramsier" <ramsiernos...@xxxxxxxxxx> wrote:
I'm not seeing the problem. The difference between the calls (I think) is.
that the stack address is going to start off being a slot based address,
whereas the alloc'ed addresses are going to be slot zero addresses (I
haven't done CE5 in quite a while, so I'm not sure). If there was some
issue with the way the MapCallerPtr function worked this could be a problem.
I'd look at the addresses before and after they were mapped, and correlate
them with the caller process id (which slot is it running in). Maybe that
will give clue...
--
Dean Ramsier - eMVP
BSQUARE Corporation
- Follow-Ups:
- Re: Passing buffer to a driver
- From: Dean Ramsier
- Re: Passing buffer to a driver
- References:
- Passing buffer to a driver
- From: Andrew Schweitzer
- Re: Passing buffer to a driver
- From: Dean Ramsier
- Re: Passing buffer to a driver
- From: Andrew Schweitzer
- Re: Passing buffer to a driver
- From: Dean Ramsier
- Passing buffer to a driver
- Prev by Date: Re: how to add wzcsapi.h to my app
- Next by Date: Re: Jflashmm - 128 MB - Failure
- Previous by thread: Re: Passing buffer to a driver
- Next by thread: Re: Passing buffer to a driver
- Index(es):
Relevant Pages
|
Loading