- Sharing memory between kernel and user space
- Posted by Rajesh on December 4th, 2003
Hello,
I"m new to device driver development. I have this problem
where a data structure is contantly updated by user
application and driver should act on it. I"m using event
to notify the driver of the data structure change.
Now the problem is the memory should be created in the
driver and the address is to be passed to application. The
reverse way is possible by METHOD_OUT_DIRECT.
Can anybody help me in this. The memory in driver is
mapped to nopagedpool memory. How do the application can
obtain address to this memory? And how do I synchronise?
Thank you in Advance.
With Regards
Rajesh Kamath
- Posted by Maxim S. Shatskih on December 4th, 2003
Use MmMapLockedPages(UserMode) in the driver. Do not forget to unmap in CLEANUP
path, so the process will exit without the mapping. Otherwise, you will have a
BSOD.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
- Posted by Algol on December 4th, 2003
Hi, this is full of interest for me guys
Before using "MmMapLockedPages(UserMode)" in the driver are you initialisin
the MDL with IoAllocateMdl( ...)
And in the user application how are you hooking the memory buffer
J.C
- Posted by Maxim S. Shatskih on December 4th, 2003
Yes.
MmMapLockedPages just returns you the user address which is used directly.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
- Posted by Algol on December 4th, 2003
Thanks Maxim
J.C. ***_
- Posted by Rajesh on December 8th, 2003
You mean to say in the user application all I have to do
is pass an IOCTL to retrieve the address returned by
MmMapLockedPages in the OutputBuffer. Am I right.
With Regards
- Posted by Rajesh on December 8th, 2003
Its already been answered in the list.
Thank you All.