I have what I imagine is a common problem:
I have a legacy NDIS driver that is started/stopped dynamicaly by
StartService/ControlService. The problem is that user-mode EXE's, in
multiple user accounts, need to start, and perhaps stop, the service,
multiple times, simultaneously, during their normal courses of
execution.
Unfortunately, it seems that the policy of:
ControlService (hDriverService, SERVICE_CONTROL_STOP, &status);
...is to force a true stop of the service, always, irrespective of how
many StartService calls were invoked to start the driver.
I could do what I am doing now, which is simply let the driver stay
loaded until reboot, but I was wondering what is the proper way to
handle this situation.
TIA,
-Le Chaud Lapin-
Rewriting the driver as PnP is the proper way, then use SetupDiXxx instead of
SC API.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
ma...@storagecraft.com
http://www.storagecraft.com
Hi Max,
How does that help?
For instance, what would be the equivalent function pairs for open/
close?
-Le Chaud Lapin-
Frankly speaking, Windows starting from w2k has only limited support for
non-PnP drivers _for real hardware_, so, it is a good idea to go PnP.
But this an NDISPROT-based protocol driver.
-Le Chaud Lapin-
Then why is it "legacy"? is it NDIS4? is there any ProtocolBind/UnbindAdapter
functions in it?
5.1.
There is no AddDevice, and the the WDM flag is not being set in PE
header. [I think I learned this from you a while back].
It seems that this is a common problem, especially with applications
that disgorge a driver from their internal resource image table
dynamically at run-time. If multiple instances of such an application
is run, there will have to be some time of coordination among those
applications to make sure that the driver is not prematurely unloaded.
Seems like the coordination could not be done via the driver itself,
lest a race condition occurs (but with extremely small probability).
-Le Chaud Lapin-