NT4.0 DllInitialize not called for kernel Dll?

Hi,

One of my colleague is testing a driver that uses kernel Dll on NT 4.0 (the
driver is successfully tested on Win2k and above). The dll is built based on
my kernel dll project. The problem is DllInitialize is not called (It is
called in Win2k). BTW My code does nothing in DllInitialize. The dll is
loaded into memory and call to exported function can be made. Since he did
significant initialization in that routine, his kernel dll does not work as
a result. Obvious solution is to call DllInitialize in whatever the driver
that uses the dll with reference counting done by the dll itself if it is
built with 4.0 DDK.

I’ll appreciate if Gurus could comment on this behavior. I’ll appreciate if
Microsoft peopel could give authoritive answer to that (such as, we decided
to add this feature in Win2k and beyond but we could remove it in the
future, use it at your own peril).

Thanks.

Bi

W2k and later have ‘improved’ support for kernel dlls, including, amoung
other features, an actual call to your dll dllInitialize routine :slight_smile: NT4
and earlier are missing this feature.

Another way way to work around this is to have a dll api your dll clients
are required to invoke to ‘register’ and have this routine call
dllInitialize if appropriate.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: Bi Chen
To: “NT Developers Interest List”
Date: Fri, 25 Oct 2002 16:05:00 -0700
Subject: [ntdev] NT4.0 DllInitialize not called for kernel Dll?

> Hi,
>
> One of my colleague is testing a driver that uses kernel Dll on NT 4.0
> (the
> driver is successfully tested on Win2k and above). The dll is built
> based on
> my kernel dll project. The problem is DllInitialize is not called (It
> is
> called in Win2k). BTW My code does nothing in DllInitialize. The dll is
> loaded into memory and call to exported function can be made. Since he
> did
> significant initialization in that routine, his kernel dll does not
> work as
> a result. Obvious solution is to call DllInitialize in whatever the
> driver
> that uses the dll with reference counting done by the dll itself if it
> is
> built with 4.0 DDK.
>
> I’ll appreciate if Gurus could comment on this behavior. I’ll
> appreciate if
> Microsoft peopel could give authoritive answer to that (such as, we
> decided
> to add this feature in Win2k and beyond but we could remove it in the
> future, use it at your own peril).
>
> Thanks.
>
> Bi
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%
>

Thanks Mark.

I found out I could not call DllInitialize directly on NT4.0 even I exported
it to library. What I suggested my collegue to do is exactly like you
recommended, export another init function that keep reference count of the
time it is called. Of cause, it only does initialization once. In this way,
NT 4.0 and Win2k and XP can have the same code. On Win2k and above, that
init function will be called by DllInitialize first. So the later call to it
in DriverEntry will do nothing but return success. This worked.

Bi

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Friday, October 25, 2002 6:27 PM
To: NT Developers Interest List
Subject: [ntdev] Re: NT4.0 DllInitialize not called for kernel Dll?

W2k and later have ‘improved’ support for kernel dlls, including, amoung
other features, an actual call to your dll dllInitialize routine :slight_smile: NT4
and earlier are missing this feature.

Another way way to work around this is to have a dll api your dll clients
are required to invoke to ‘register’ and have this routine call
dllInitialize if appropriate.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: Bi Chen
To: “NT Developers Interest List”
Date: Fri, 25 Oct 2002 16:05:00 -0700
Subject: [ntdev] NT4.0 DllInitialize not called for kernel Dll?

> Hi,
>
> One of my colleague is testing a driver that uses kernel Dll on NT 4.0
> (the
> driver is successfully tested on Win2k and above). The dll is built
> based on
> my kernel dll project. The problem is DllInitialize is not called (It
> is
> called in Win2k). BTW My code does nothing in DllInitialize. The dll is
> loaded into memory and call to exported function can be made. Since he
> did
> significant initialization in that routine, his kernel dll does not
> work as
> a result. Obvious solution is to call DllInitialize in whatever the
> driver
> that uses the dll with reference counting done by the dll itself if it
> is
> built with 4.0 DDK.
>
> I’ll appreciate if Gurus could comment on this behavior. I’ll
> appreciate if
> Microsoft peopel could give authoritive answer to that (such as, we
> decided
> to add this feature in Win2k and beyond but we could remove it in the
> future, use it at your own peril).
>
> Thanks.
>
> Bi
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%
>


You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%

NT4.0 DllInitialize not called for kernel Dll?Dll load and unload methods where introduced with Win2k only.
----- Original Message -----
From: Bi Chen
To: NT Developers Interest List
Sent: Saturday, October 26, 2002 2:05 AM
Subject: [ntdev] NT4.0 DllInitialize not called for kernel Dll?

Hi,

One of my colleague is testing a driver that uses kernel Dll on NT 4.0 (the driver is successfully tested on Win2k and above). The dll is built based on my kernel dll project. The problem is DllInitialize is not called (It is called in Win2k). BTW My code does nothing in DllInitialize. The dll is loaded into memory and call to exported function can be made. Since he did significant initialization in that routine, his kernel dll does not work as a result. Obvious solution is to call DllInitialize in whatever the driver that uses the dll with reference counting done by the dll itself if it is built with 4.0 DDK.

I’ll appreciate if Gurus could comment on this behavior. I’ll appreciate if Microsoft peopel could give authoritive answer to that (such as, we decided to add this feature in Win2k and beyond but we could remove it in the future, use it at your own peril).

Thanks.

Bi


You are currently subscribed to ntdev as: xxxxx@rdsor.ro
To unsubscribe send a blank email to %%email.unsub%%