将Windows驱动程序连接到Userland服务 [英] Connecting Windows Driver to Userland Service
问题描述
如何与Windows中的用户区的驱动程序进行通信? (如果有,Vista会有所不同。)我可以以及如何通过驱动程序站点与服务进行通信?
How do I communicate with a driver from the userland in Windows? (Vista if that makes a difference.) Can I, and how, communicate with the service from the driver site?
我实际上不是很懒惰,应该让老板给我买书,但是我不知道是哪本书。在没有正确的术语搜索的情况下,从MSDN猜测命令和部分会花费很多时间和精力。有人可以给我一些术语以在文档中寻找吗?
I am actually not very lazy and should probably get my boss to buy me a book, but I don't know which. And guessing commands and sections from the MSDN is kinda taking a lot of nerves and time without the right terms to search for. Can someone drop me some terms to look for in the documentation?
推荐答案
在线OSR 是编写Windows驱动程序的良好信息。
OSR online is a good source of information on writing windows drivers.
如何以内核模式命名设备(带有访问安全性的链接)。
How to name devices in kernel mode (with a link to access security).
基本路径是:
使用一种命名功能(例如WdfDeviceInitAssignName)命名设备对象。
Name your device object with one of the naming functions (e.g. WdfDeviceInitAssignName).
在服务中您可以执行以下操作:
In the service you do :
hDev = CreateFile( <obj name>, ..., OVERLAPPED )
DeviceIOControl( hDev, .. , OVERLAPPED);
while( !end )
SleepEx( 100, true /*bAltertable*/ );
...
在驱动程序中,您有一个IRP队列,在其中将来自服务的请求排队。当您要调用该服务时,您需要完成一个IRP。
In the driver, you have an IRP queue, in which you queue requests from the service. When you want to call the service, you complete one of the IRPs.
NB:这有点复杂...并且取决于您使用的驱动程序框架/模型用。我只需要在NDIS过滤器驱动程序中执行一次。再问一次,是否需要更多信息。
NB: Its a bit complex ... and depends on the driver framework/model you are working with. I had to do this only once with in a NDIS filter driver. Ask again, if you need more info.
这篇关于将Windows驱动程序连接到Userland服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!