I have been asked to make a functional driver and I need some help.
I can successfully load the driver and keep it loaded if I manually call DeviceAdd from DriverEntry. This is fine but I suspect there maybe another way of doing it. However the issue is successfully executing IrpInternalDeviceControl when it is needed.
While it was attached to some hardware this was all fine and I didn’t need to manually call DeviceAdd. Now I have to manually call it because the driver aunloads itself otherwise.
Am I doing this right, or is there a better way, which I suspect maybe.
How did you install the driver? Devcon install? If so, you need to use devcon update instead. I would strongly recommend that you use KMDF instead of WDM to write your new driver, it is going to save you many weeks of development and test
I have been asked to make a functional driver and I need some help.
I can successfully load the driver and keep it loaded if I manually call DeviceAdd from DriverEntry. This is fine but I suspect there maybe another way of doing it. However the issue is successfully executing IrpInternalDeviceControl when it is needed.
While it was attached to some hardware this was all fine and I didn’t need to manually call DeviceAdd. Now I have to manually call it because the driver aunloads itself otherwise.
Am I doing this right, or is there a better way, which I suspect maybe.
I have been asked to make a functional driver and I need some help.
I can successfully load the driver and keep it loaded if I manually call DeviceAdd from DriverEntry. This is fine but I suspect there maybe another way of doing it. However the issue is successfully executing IrpInternalDeviceControl when it is needed.
Does that mean you are calling another driver, or that another driver is
calling you? InternalDeviceControl is only used for driver-to-driver
communications.
While it was attached to some hardware this was all fine and I didn’t need to manually call DeviceAdd. Now I have to manually call it because the driver aunloads itself otherwise.
So, it used to have hardware, and now it’s a standalone driver that
doesn’t have any hardware?
Am I doing this right, or is there a better way, which I suspect maybe.
That depends. What you have created is a “legacy driver”. It works,
but such a driver doesn’t participate in the plug-and-play game. It can
only be loaded and unloaded via the Service Manager (net start and net
stop). The “modern” way is to make yourself a PnP driver that is
software-enumerated, and use “devcon install” to have the system create
a “fake” hardware device that will trigger the loading of your driver.
That way, you fully participate in PnP and power management.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.