start wdm driver from application

Hi all,

does anybody know how to start a wdm driver from a application under Windows
98 ?

Thanks in advance
Martin

> does anybody know how to start a wdm driver from a

application under Windows 98 ?

You don’t start WDM drivers. WDM drivers are PNP.
Bus drivers detect and start PNP drivers. The
perticular driver file is initally installed from
info in an inf in the inf directory and hence
forth it is plugged and unplugged by the bus
driver.

You can disable and enable a wdm driver though.
Is that what do you really want to do?

Only non pnp (non wdm) drivers can be started and
stopped.

Hello,

does anybody know how to start a wdm driver from a application under Windows
98 ?

You can write a bus driver (like toaster sample from W2K DDK), install
this driver and have a IO control Interface to your application.
Now you can simulate PNP. Look in the toaster sample.

mathias

Hi,

I think I did not make clear what I really want to do.
I have a wdm driver. I is wdm because it is NT style using wdm.h.
But it is not for a device it just simulates a device and looks like the
driver for a real device (same DeviceIoControl Interface).
Now I am searching for a way to start this driver from a application. I have
done this with a vxd before that’s just calling CreateFile and it works. But
this did not work for .sys drivers.
A other possibility would be to install the driver from my application. The
driver should be started automatically at boot time. But I also do not know
how to do that.

Any hints ?

Best Regards,
Martin

Hi,

I have a wdm driver. I is wdm because it is NT style using wdm.h.
But it is not for a device it just simulates a device and looks like the
driver for a real device (same DeviceIoControl Interface).

Why you are using a WDM driver. You can use a normal Windows NT driver
without PnP handling. This driver is startable at boot time.

Now I am searching for a way to start this driver from a application. I have
done this with a vxd before that’s just calling CreateFile and it works. But
this did not work for .sys drivers.

For normal Windows NT driver this is very simple. You can use some
API function calls ( OpenSCMMangager …) to do this.

A other possibility would be to install the driver from my application. The
driver should be started automatically at boot time. But I also do not know
how to do that.

This is the same, you can install/remove with this API your service

DDK sample src\general\instdrv. !

mathias

I’ve forgotten your original posting. What OS?

Installing the driver programmatically using Service Control Manager APIs
works fine on Windows 2000, but starting it fails if there is no related
devnode that PnP thinks requires your driver in its stack. What you’ll
see is the driver loads, DriverEntry executes fine and returns
STATUS_SUCCESS, then your unload routine is called nonetheless and
your driver is unloaded.

I have one driver that has no associated hardware. To get it loaded, I
had to programmatically create a pseudo device in the root enumeration,
and install my driver as its function driver.

This is a three-pronged effort:
1: user-mode installer uses SetupDi functions to create pseudo device.
2: INF file correlates your driver to the device.
3: Your driver expects to receive AddDevice() call for the pseudo-device.

The installer uses SetupDiCreateDeviceInfoList and SetupDiCreateDeviceInfo,
followed by…

SetupDiSetDeviceRegistryProperty( hDevList,
&devInfo,
SPDRP_HARDWAREID,
(LPBYTE)s_acHardwareID,
sizeof(s_acHardwareID)
);

//Transform the registry element into an actual devnode.

SetupDiCallClassInstaller( DIF_REGISTERDEVICE,
hDevList,
&devInfo
);

UpdateDriverForPlugAndPlayDevices( NULL,
//hwndParent,
s_acHardwareID,
//HardwareId,
pInfFile,
//INF file path,
INSTALLFLAG_FORCE,
//InstallFlags,
&bReboot
//bRebootRequired
);

There is a sample (DDK, I think) that does essentially this. Try a search
with these function and flags names as keywords.


Dave Cox
Hewlett-Packard Co.
HPSO/SMSO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: MARTINGR [mailto:xxxxx@vector-informatik.de]
Sent: Friday, October 20, 2000 1:02 AM
To: NT Developers Interest List
Subject: [ntdev] RE: start wdm driver from application

Hi,

I think I did not make clear what I really want to do.
I have a wdm driver. I is wdm because it is NT style using wdm.h.
But it is not for a device it just simulates a device and looks like the
driver for a real device (same DeviceIoControl Interface).
Now I am searching for a way to start this driver from a application. I have
done this with a vxd before that’s just calling CreateFile and it works. But
this did not work for .sys drivers.
A other possibility would be to install the driver from my application. The
driver should be started automatically at boot time. But I also do not know
how to do that.

Any hints ?

Best Regards,
Martin


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)