Hi all,
Guys, Can anyone tell me how many ways there are to transfer data from km to um?
and if possible an example. thanks
Buffered IRP_MJ_READ
Direct IRP_MJ_READ
Buffered IRP_MJ_DEVICE_CONTROL
Direct IRP_MJ_DEVICE_CONTROL
Mapping kernel memory to user space (a complex and error-prone technique
that in general should be ignored as a possible solution)
The first four are discussed, usually with examples, in most introductory
driver books; and there are tons of examples in the WDK source tree.
Note that in the “direct” modes, you can either transfer data
programmatically to the input buffer (e.g., reading a data value and
storing it in the buffer) or via DMA (obtaining the physical address(es)
of the buffer and programming the device’s DMA controller to write the
data there).
Otherwise, you are asking for a long essay on techniques that are
well-documented both in the Microsoft documentation and every
non-Microsoft driver book in existence. The last technique, mapping
kernel memory to user space, is nearly always a design error and should be
avoided. To give you a hint, experienced driver writers avoid this
because we know how hard it is to get right; newbies almost always latch
onto it as if there is no other way to do it. There are, if you read the
archives of this newsgroup, no compelling reasons to choose this
technique, and a huge list of reasons to avoid it. But some people /like/
juggling bowling balls while standing on thin ice.
Hi all,
Guys, Can anyone tell me how many ways there are to transfer data from km
to um?
and if possible an example. thanks
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Joseph M. Newcomer wrote:
Buffered IRP_MJ_READ
Direct IRP_MJ_READ
Buffered IRP_MJ_DEVICE_CONTROL
Direct IRP_MJ_DEVICE_CONTROL
Mapping kernel memory to user space (a complex and error-prone
technique that in general should be ignored as a possible solution)
WMI
Chris Aseltine wrote:
Joseph M. Newcomer wrote:
> Buffered IRP_MJ_READ
> Direct IRP_MJ_READ
> Buffered IRP_MJ_DEVICE_CONTROL
> Direct IRP_MJ_DEVICE_CONTROL
> Mapping kernel memory to user space (a complex and error-prone
> technique that in general should be ignored as a possible solution)WMI
Don’t know if you want to make it separate but:
Fast I/O IRP_MJ_DEVICE_CONTROL with and buffering method
Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
and dozens of nefarious hacks…
– pa
On 01-Nov-2012 15:51, xxxxx@gmail.com wrote:
Joseph M. Newcomer wrote:
> Buffered IRP_MJ_READ
> Direct IRP_MJ_READ
> Buffered IRP_MJ_DEVICE_CONTROL
> Direct IRP_MJ_DEVICE_CONTROL
> Mapping kernel memory to user space (a complex and error-prone
> technique that in general should be ignored as a possible solution)WMI
>and dozens of nefarious hacks
Exapmles?
Check the list. One of the nefarious hacks is the mapping of kernel
memory into user space. All other techniques (except WMI, which I had
forgotten about) fall into the category of nefarious hacks. Also, among
bad hacks, are exporting kernel events to user space or sending handles to
event objects to a driver. All of these can be thought of as pitiful
attempts to make Windows resemble some RTOS of the programmer’s
experience, and have substantial disadvantages in complexity and achieving
robustness, with little if any gain for the effort.
Another wonderful example is sending an IRP specifying a user-space
buffer, and then “holding” it while the app and the kernel synchronize via
some complex and convoluted scheme, generally the aforementioned event
objects. There is either a desire to keep the driver model within the
programmer’s “comfort zone”, no matter how incompatible this with the
actual design of Windows, or some “intuition” about “efficiency”
unsubstantiated by either actual experience or measured performance.
joe
>and dozens of nefarious hacks
Exapmles?
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
thank you very much guys
On 01-Nov-2012 17:11, xxxxx@arcor.de wrote:
> and dozens of nefarious hacks
Exapmles?
Say, things that good guys can do to nuclear factories
of bad guys
An example of benign hack is DebugView. And there are ETW,
and LPC and pipes … lots of communication paths from kernel.
– pa