Re: Passing buffer to a driver



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

.



Relevant Pages

  • Re: is it ok to fomat new compaq turion laptop?
    ... > Thanks for all the replies and pointers on this. ... > appears to be all the drivers for the machine on the compaq website. ... Also has video out, s-video port, and the hp docking port ... garbage that most laptop makers stick on their systems. ...
    (alt.comp.hardware.pc-homebuilt)
  • programming information for pcHDTVs HD-2000?
    ... Anyone have pointers to programming documentation (other than the drivers ... themselves) for pcHDTV's HD-2000 card? ...
    (comp.os.linux.misc)
  • Re: ATI TV Wonder support
    ... On Tuesday 23 November 2004 02:51 pm, John Baldwin wrote: ... Do you have any pointers of where to get ... >> drivers? ... Would it be better to first make the code Giant-safe, ...
    (freebsd-current)
  • A8N32-Sli Deluxe
    ... you give me some tips and pointers with this board. ... Just looking for smooth install (Os ... Should I stick with the drivers on the supplied cd as for chipset ... version with different download sizes? ...
    (alt.comp.periphs.mainboard.asus)

Loading