TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Microsoft Device Drivers

How to communicate between two different kernel driver?

Microsoft Device Drivers

 
 
Thread Tools Display Modes
Unread 03-12-2007, 10:01 PM   #1
abei
Guest
 
Posts: n/a
How to communicate between two different kernel driver?

We have a function driver which control a real hardware device. Now I want
to write a new kernel driver to communicate with it. What can I do?
Don't tell me write a filter driver, because I do not like this method.
Thank you!

Abei
2007-6-10


 
Unread 03-12-2007, 10:01 PM   #2
Don Burn
Guest
 
Posts: n/a
Re: How to communicate between two different kernel driver?

If your function driver is Plug and Play, look at device interfaces. You
can create an interface in the function driver which is registered, then
the second driver can be notified of the interface.

Of course if your driver communication is just standard I/O there is
nothing that stops you from getting the device object from the function
driver, through one of several mechanisms, and then using IoCallDriver to
call the function device.

I would be curious why you object to a filter driver?


--
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

"abei" <aboutwho_1@163.com> wrote in message
news:%23tyuI91qHHA.1296@TK2MSFTNGP06.phx.gbl...
> We have a function driver which control a real hardware device. Now I
> want to write a new kernel driver to communicate with it. What can I do?
> Don't tell me write a filter driver, because I do not like this method.
> Thank you!
>
> Abei
> 2007-6-10
>



 
Unread 03-12-2007, 10:02 PM   #3
Don Burn
Guest
 
Posts: n/a
Re: How to communicate between two different kernel driver?

You have an exception which you need to debug, go into windbg and when the
crash occurs issue a !analyze -v

I suspect you have not locked down a buffer or something similar.


--
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

"abei" <aboutwho_1@163.com> wrote in message
news:e9$bp06rHHA.4800@TK2MSFTNGP03.phx.gbl...
> Thank you very much!
> Now I can use IoBuildDeviceIoControlRequest to build a IRP, and I can
> send this IRP to lower level driver.
> But when I use IoBuildSynchronousFsdRequest to build a IRP with
> IRP_MJ_WRITE and send it to lower driver, computer will come BSOD with
> code 0x1000007e.
> How can I send IRP with IRP_MJ_READ and IRP_MJ_WRITE?
>
> Abei
>
> "Don Burn" <burn@stopspam.windrvr.com>
> 写入消息新闻:eNEZN52qHHA.3380@TK2MSFTNGP03.phx.gbl ...
>> Comments inline:
>>
>> "abei" <aboutwho_1@163.com> wrote in message
>> news:uF5LAy2qHHA.1200@TK2MSFTNGP04.phx.gbl...
>>> We have found this method(by registering a plug play notification) to
>>> get the function driver's device object, and I even have gotten
>>> function driver's device object successfully. But when I try to use
>>> IoCallDriver to call the function device, I found that I didn't known
>>> how to build the IRP and it's stack location size. and can I build
>>> IRP_MJ_DEVICE_CONTROL\IRP_MJ_READ\IRP_MJ_WRITE ?

>>
>> Take a look at IoBuildDeviceIoControlRequest,
>> IoBuildSynchronousFsdRequest and IoBuildAsynchronousFsdRequest these
>> calls are specifically for creating IRP's for what you want to do.
>>
>>> I object to a filter driver because this driver is the function
>>> driver's owner. I want this driver to issue all operations to function
>>> driver.There are not other drivers from kernel space or applications
>>> from user mode to talk with the function. Can a filter driver take this
>>> job?
>>>

>>
>> Actually, this is a good use for a filter driver. If no one else is
>> supposed to talk to the function driver, then having a filter that owns
>> the function is an excellent choice. The filter can ensure that no one
>> talks to the function driver besides its calls. The filter can the
>> expose the interface it wants for use by others (assuming it is not
>> doing everything in the driver).
>>
>>
>> --
>> 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
>>
>>
>>

>
>



 
Unread 03-12-2007, 10:02 PM   #4
abei
Guest
 
Posts: n/a
Re: How to communicate between two different kernel driver?

Thank you very much!

Our device's function driver is a WDM USB device driver, so it's a Plug and
Play driver.

We have found this method(by registering a plug play notification) to get
the function driver's device object, and I even have gotten function
driver's device object successfully. But when I try to use IoCallDriver to
call the function device, I found that I didn't known how to build the IRP
and it's stack location size. and can I build
IRP_MJ_DEVICE_CONTROL\IRP_MJ_READ\IRP_MJ_WRITE ?

I object to a filter driver because this driver is the function driver's
owner. I want this driver to issue all operations to function driver.There
are not other drivers from kernel space or applications from user mode to
talk with the function. Can a filter driver take this job?

Abei

"Don Burn" <burn@stopspam.windrvr.com> 写入消息新闻:%23SrIYG2qHHA.3456@TK2MSFTNGP02.phx.g bl...
> If your function driver is Plug and Play, look at device interfaces. You
> can create an interface in the function driver which is registered, then
> the second driver can be notified of the interface.
>
> Of course if your driver communication is just standard I/O there is
> nothing that stops you from getting the device object from the function
> driver, through one of several mechanisms, and then using IoCallDriver to
> call the function device.
>
> I would be curious why you object to a filter driver?
>
>
> --
> 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
>
> "abei" <aboutwho_1@163.com> wrote in message
> news:%23tyuI91qHHA.1296@TK2MSFTNGP06.phx.gbl...
>> We have a function driver which control a real hardware device. Now I
>> want to write a new kernel driver to communicate with it. What can I do?
>> Don't tell me write a filter driver, because I do not like this method.
>> Thank you!
>>
>> Abei
>> 2007-6-10
>>

>
>
>



 
Unread 03-12-2007, 10:02 PM   #5
Don Burn
Guest
 
Posts: n/a
Re: How to communicate between two different kernel driver?

Comments inline:

"abei" <aboutwho_1@163.com> wrote in message
news:uF5LAy2qHHA.1200@TK2MSFTNGP04.phx.gbl...
> We have found this method(by registering a plug play notification) to get
> the function driver's device object, and I even have gotten function
> driver's device object successfully. But when I try to use IoCallDriver
> to call the function device, I found that I didn't known how to build the
> IRP and it's stack location size. and can I build
> IRP_MJ_DEVICE_CONTROL\IRP_MJ_READ\IRP_MJ_WRITE ?


Take a look at IoBuildDeviceIoControlRequest, IoBuildSynchronousFsdRequest
and IoBuildAsynchronousFsdRequest these calls are specifically for creating
IRP's for what you want to do.

> I object to a filter driver because this driver is the function driver's
> owner. I want this driver to issue all operations to function
> driver.There are not other drivers from kernel space or applications from
> user mode to talk with the function. Can a filter driver take this job?
>


Actually, this is a good use for a filter driver. If no one else is
supposed to talk to the function driver, then having a filter that owns the
function is an excellent choice. The filter can ensure that no one talks
to the function driver besides its calls. The filter can the expose the
interface it wants for use by others (assuming it is not doing everything
in the driver).


--
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


 
 

Thread Tools
Display Modes



< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 10:12 AM.


vBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2013, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional