question on whether kernel mode driver can call user mode driver/service?

Hi All,

I am new to windows driver development. I have gone through some of
the WDK documentation.
I have the following basic question

Can a kernel mode WDM driver make calls to the user mode driver or
user mode service hosted by svchost.exe?
For ex: can an AVStream audio/video minidriver make calls to the user
mode driver or service?

Thanks in advance.

Thirupathiah Annapureddy wrote:

I am new to windows driver development. I have gone through some of
the WDK documentation.
I have the following basic question

Can a kernel mode WDM driver make calls to the user mode driver or
user mode service hosted by svchost.exe?
For ex: can an AVStream audio/video minidriver make calls to the user
mode driver or service?

No. Communication always goes from user to kernel.

In the specific case you mention, however, there are some options. If
you are only writing an AVStream driver so you can be a capture device,
in many cases you can write a user-mode DirectShow source filter that
behaves exactly like a streaming capture device.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

Thanks for the quick response.

There are some user-level and kernel level components which depend upon this AV Stream minidriver either directly or indirectly and they do not use DirectShow/Media Foundation.
So Writing a DirectShow filter/Media Foundation Transform is not an option here.

Most of the code that is to be placed in the user mode driver/service is in C++. I understood that there are some constraints about C++ based driver development on the kernel side. Need to understand more about this before I can ask questions.

Thanks a lot

> Can a kernel mode WDM driver make calls to the user mode driver or

user mode service hosted by svchost.exe?
For ex: can an AVStream audio/video minidriver make calls to the user
mode driver or service?

No.

But the user mode code can pend IRPs to the kernel mode code, and the kernel mode code will fill them with call parameters and complete.

This is called “inverted call”.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

>constraints about C++ based driver development on the kernel side.

No runtime support for exceptions.

With templates, you cannot specify whether their instantiation will be paged code or nonpaged.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

xxxxx@gmail.com wrote:

There are some user-level and kernel level components which depend upon this AV Stream minidriver either directly or indirectly and they do not use DirectShow/Media Foundation.
So Writing a DirectShow filter/Media Foundation Transform is not an option here.

How is that going to work? The interface to an AVStream driver is
through the kernel streaming interfaces, and those are designed so that
the client doesn’t know whether the source is user or kernel interface.
There’s no well-defined way to have private access to an AVStream
driver. It can be done, but it’s a hack. If you have a private
interface, perhaps you should isolate a custom driver with a custom
interface, and call THAT from your user-mode source filter.

Most of the code that is to be placed in the user mode driver/service is in C++. I understood that there are some constraints about C++ based driver development on the kernel side. Need to understand more about this before I can ask questions.

AVStream drivers are (virtually) always in C++. As Max said, you can’t
use exceptions, you have to be careful about templates, and you can’t
use STL, but most of the rest of C++ is just fine.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.