linking driver with kernel mode DLL

Hi,
Even after reading the NT insider article about writing kernel mode DLLs, I
have few questions:

Kernel Mode DLL : dll.sys
Kernel mode miniport driver : driver.sys

  1. I want to call some of the exported kernel DLL functions from my
    drivers’s DriverEntry() and MiniportInitialize() functions. How do I make
    sure that dll.sys is loaded before I make the calls.

  2. Do I need to write a separate .INF file to install the dll.sys?

  3. Is there a way from DriverEntry() of driver.sys to load or wait for
    dll.sys to finish loading and then get some event when it is done.

  4. Can we have a kernel mode dll with extension .DLL, i.e. dll.dll? Is
    kernel mode library also a .sys file? ndis.sys, ndis.lib?

  5. Does a kernel mode DLL also creates a .LIB file after compile? What does
    it contain?

thanks
Raj


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> 1. I want to call some of the exported kernel DLL functions from my

drivers’s DriverEntry() and MiniportInitialize() functions. How do I make
sure that dll.sys is loaded before I make the calls.

It will be loaded automatically by import resolution.

  1. Do I need to write a separate .INF file to install the dll.sys?

No, you must not even create the SC database entry for it. SCSIPORT has none.

  1. Is there a way from DriverEntry() of driver.sys to load or wait for
    dll.sys to finish loading and then get some event when it is done.

Loading can be done by import resolution or by ZwLoadDriver if the DLL will have an SC database entry.
For the latter case, write GetProcAddress yourself by parsing the PE header.

  1. Can we have a kernel mode dll with extension .DLL, i.e. dll.dll? Is
    kernel mode library also a .sys file? ndis.sys, ndis.lib?

Never tried, but maybe.

  1. Does a kernel mode DLL also creates a .LIB file after compile? What does
    it contain?

IIRC yes, the usual import library.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> 4. Can we have a kernel mode dll with extension .DLL, i.e. dll.dll? Is

kernel mode library also a .sys file? ndis.sys, ndis.lib?

Never tried, but maybe.

I tried, and it didn’t work. I named the file with a .SYS extension and
things worked fine. There may be away, but note that even ScsiPort is named
ScsiPort.SYS.

Gary


You are currently subscribed to ntdev as: xxxxx@inland.net
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thanks max.

I will be trying it soon, but now if I undertood correctly, then you mean that once I create the dll.sys, then just specify the dll.lib path in the sources file of the driver.sys and then load the miniport (driver.sys) and the dll.sys will be automatically loaded (W2K, as well as NT), without any entry in the registry?

thanks
Raj

----- Original Message -----
From: Maxim S. Shatskih
Sent: Monday, December 31, 2001 5:38 PM
To: NT Developers Interest List
Subject: [ntdev] Re: linking driver with kernel mode DLL

  1. I want to call some of the exported kernel DLL functions from my
    drivers’s DriverEntry() and MiniportInitialize() functions. How do I make
    sure that dll.sys is loaded before I make the calls.

It will be loaded automatically by import resolution.

  1. Do I need to write a separate .INF file to install the dll.sys?

No, you must not even create the SC database entry for it. SCSIPORT has none.

  1. Is there a way from DriverEntry() of driver.sys to load or wait for
    dll.sys to finish loading and then get some event when it is done.

Loading can be done by import resolution or by ZwLoadDriver if the DLL will have an SC database entry.
For the latter case, write GetProcAddress yourself by parsing the PE header.

  1. Can we have a kernel mode dll with extension .DLL, i.e. dll.dll? Is
    kernel mode library also a .sys file? ndis.sys, ndis.lib?

Never tried, but maybe.

  1. Does a kernel mode DLL also creates a .LIB file after compile? What does
    it contain?

IIRC yes, the usual import library.

Max


You are currently subscribed to ntdev as: xxxxx@hotmail.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You do have to at least install the kernel dll into the drivers
directory. Also, I disagree with Max regarding not having the kernel dll
installed as a driver. You can either install it as a legacy (NT4)
driver, or a root enumerated PnP pseudo device, or as max suggests,
simply place it into the default load path so that the kernel loader can
find it. In my opinion the first two choices have the advantage of
having a known install/uninstall method, and they also guarantee that
your dll DriverEntry routine gets called prior to any external eccess to
your dll.

=====================
Mark Roddy
Windows XP/2000/NT Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
xxxxx@hollistech.com
For Windows Device Driver Training: see www.azius.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rajinder Sharma
Sent: Tuesday, January 01, 2002 10:26 PM
To: NT Developers Interest List
Subject: [ntdev] Re: linking driver with kernel mode DLL

Thanks max.

I will be trying it soon, but now if I undertood correctly, then you
mean that once I create the dll.sys, then just specify the dll.lib path
in the sources file of the driver.sys and then load the miniport
(driver.sys) and the dll.sys will be automatically loaded (W2K, as well
as NT), without any entry in the registry?

thanks
Raj

----- Original Message -----
From: Maxim S. Shatskih
Sent: Monday, December 31, 2001 5:38 PM
To: NT Developers Interest List
Subject: [ntdev] Re: linking driver with kernel mode DLL

  1. I want to call some of the exported kernel DLL functions from my
    drivers’s DriverEntry() and MiniportInitialize() functions. How do I
    make
    sure that dll.sys is loaded before I make the calls.

It will be loaded automatically by import resolution.

  1. Do I need to write a separate .INF file to install the dll.sys?

No, you must not even create the SC database entry for it. SCSIPORT has
none.

  1. Is there a way from DriverEntry() of driver.sys to load or wait for
    dll.sys to finish loading and then get some event when it is done.

Loading can be done by import resolution or by ZwLoadDriver if the DLL
will have an SC database entry.
For the latter case, write GetProcAddress yourself by parsing the PE
header.

  1. Can we have a kernel mode dll with extension .DLL, i.e. dll.dll? Is
    kernel mode library also a .sys file? ndis.sys, ndis.lib?

Never tried, but maybe.

  1. Does a kernel mode DLL also creates a .LIB file after compile? What
    does
    it contain?

IIRC yes, the usual import library.

Max


You are currently subscribed to ntdev as: xxxxx@hotmail.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntdev as: xxxxx@hollistech.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com