Exported structures for WDM driver

Hi all,
I’m trying to write a secondary WDM driver to act as a core driver for my main WDM driver. Basically, this core driver will have access to a exported structure which my main WDM driver has access too. The source code and header files where the structure resides has all been compiled and linked to produce a .lib file. I have a few questions:

  1. How do I go about rebuilding a library so that both drivers can access it.

  2. Can my core driver be installed after the main driver has been installed? Both drivers need to access the same device.

  3. Do I need to create another .INF file for the core driver with the same hardware ID string? And if so, how will I insure that this .INF gets called after the Main Driver’s .INF file is called?

I’m not sure if this is what I should be doing so any suggestions are greatly appreciated.
In a nutshell, I just want my core driver to have access to the same structures my main driver has access too.

Thanks.

Why are you creating such an arbitrary split? To provide libray functionality to the function driver? Where is the engineering benefit here? In general, exporting data structures directly is a bad idea in terms of maintainability and synchronization. What does the core driver do vs what tthe main driver does?

d

xxxxx@yahoo.com wrote:

I’m trying to write a secondary WDM driver to act as a core driver for my main WDM driver. Basically, this core driver will have access to a exported structure which my main WDM driver has access too. The source code and header files where the structure resides has all been compiled and linked to produce a .lib file.

Putting the code in a .lib file does NOT mean the structure will be
shared. Modules in a .lib are duplicated in each executable that uses
them. Without linker magic, each driver will get its own copy of the
structure.

I have a few questions:

  1. How do I go about rebuilding a library so that both drivers can access it.

  2. Can my core driver be installed after the main driver has been installed? Both drivers need to access the same device.

  3. Do I need to create another .INF file for the core driver with the same hardware ID string? And if so, how will I insure that this .INF gets called after the Main Driver’s .INF file is called?

So, you are wanting to load an additional driver over an existing one
for a single device? If so, then what you probably need is a filter
driver. That way, your secondary driver will load after the main
driver, and will be directly attached to it. You can send an internal
ioctl from the secondary driver to the main driver to fetch the address
of your shared structure. Google for “upper filter”.

By the way, writing such a filter is very easy in KMDF.


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