Functional Driver.

Hello.

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.

Many thanks.

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

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.co.uk
Sent: Tuesday, July 17, 2012 3:15 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Functional Driver.

Hello.

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.

Many thanks.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

xxxxx@hotmail.co.uk wrote:

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.