If it’s of any help, as an inexperienced driver developer I originally used
the scheme mentioned, i.e. allocating user memory, passing the pointers to
the driver, then letting the driver write to user memory.
This works fine, after doing all the correct things to lock down the user
memory and access it from the kernel - not major hassles. Synchronisation is
easy too, really, using say circular buffers and and some shared read write
index locations.
I’m also interested to infer from Don’s message that this is a reasonable
idea for very fast transfers (this info filed for future projects).
However I took the advice on this forum to rearrange things as I was nervous
about having the driver happily writing into user memory even if my app
failed. True, if it all works perfectly, the removal of the app should
notify the driver safely but what if I made a mistake with my user
allocation, say I freed the memory by mistake, or some other thing I haven’t
even thought about happened.
So I changed it to let the app allocate all the buffers, and then used the
standard mechanisms for reading and writing user data into the driver. It
didn’t take long to do this and I feel a bit safer. I also feel more in
control of the buffers as they are kernel allocated. I’m not aware of any
perfomance issues.
I did find it useful to add an iocontrol function to inspect the various
realtime parameters in the driver from the app, as these had become
invisible after the change. Being able to monitor the driver working in real
time from the app has been immensely useful and saved a lot of debugging
time…
BTW I have an axiom to propose: whatever method you choose to implement a
driver function, you’ll find out afterwards that it was the wrong method…
Mike
----- Original Message -----
From: Don Burn
Newsgroups: ntdev
To: Windows System Software Devs Interest List
Sent: Monday, May 14, 2007 11:04 AM
Subject: Re:[ntdev] [newbie] SystemAddressMDLSafe BSOD query
How do yuou think you will synchronize the application and the driver? How
will you handle detecting the application going away (crashing or being
terminated)? How will you handle not enough buffer space?
This is an incredibly poor design for a driver, that has been discussed
many times in this forum. Loon for subjects like “event sharing” to see
that this is a bad idea. Unless you are doing extremely fast I/O (i.e.
over 100MB/sec) doing this will just add incredibly to your work, and make
your driver likely to crash. As a newbie you should not be trying this.
–
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
wrote in message news:xxxxx@ntdev…
> Exactly… thats my point… I dont want to use IRPs… I just want to
> store all the buffer addresses at one go and make the driver write to
> those continuously… which inturn my app will read.
>
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer