DIFxApp, driver uninstall and expected behaviour

I have a hardware driver that I’m installing using DIFxApp via WiX. The
installation works fine, but during uninstall the driver always gets
uninstalled, despite setting ‘DeleteFiles=“No”’. That leaves the device
in Device Manager as “Unknown Device”, and that entry must be removed
before it reverts to the generic device.

Since DIFx seems so intent on removing the driver, I’m wondering what
the expected behaviour is during uninstall. From reading various
Microsoft documentation recently I was under the impression that when
uninstalling a driver package using Windows Installer, the driver was
supposed to be left in a functional state. For a PCI device driver
should I be using DPinst instead?


Bruce Cran

Bruce Cran wrote:

I have a hardware driver that I’m installing using DIFxApp via WiX. The
installation works fine, but during uninstall the driver always gets
uninstalled, despite setting ‘DeleteFiles=“No”’. That leaves the device
in Device Manager as “Unknown Device”, and that entry must be removed
before it reverts to the generic device.

The DeleteFiles entry only affects whether the driver files themselves
are removed from disk. Uninstall always does an uninstall. If you do a
“scan for hardware changes”, it should match your device to the proper
driver, assuming there is a generic one. What class of device is this?

What do you mean by “removed”?

Since DIFx seems so intent on removing the driver, I’m wondering what
the expected behaviour is during uninstall. From reading various
Microsoft documentation recently I was under the impression that when
uninstalling a driver package using Windows Installer, the driver was
supposed to be left in a functional state.

That sentence is a little confused. The uninstalled driver will
certainly not be functional any more. When you uninstall a driver
package, the driver stack for that device will be torn down and the
drivers unloaded. Because the INF is now gone, the next time Device
Manager tries to find a matching driver, it won’t find yours any more.

For a PCI device driver should I be using DPinst instead?

That’s what I use, but WiX should be able to do the same thing. DPinst
calls into the same APIs as DIFxApp.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

[preceding babble to ensure Lyris does not bounce this again because it is
scared of the first line looking like a command]

DeleteFiles=No is not the same as “do not uninstall my driver”.

As for how to get DIFxAPP to leave your driver ‘installed’ I have no clue.
I suppose you could conspire to hack you MSI to not actually run the DIFxAPP
custom action which removes the driver or to remove the entry from the
driver table or some such.

If you want your driver to remain, why are you uninstalling the package
which delivers the driver? Perhaps a different factoring of the deployment
elements is the answer to the ‘outer’ problem. Like you have suggested,
perhaps using DPINST to deliver (and leave in place) the driver.

Good Luck,
Dave Cattley

On 18/11/2011 17:29, Tim Roberts wrote:

The DeleteFiles entry only affects whether the driver files themselves
are removed from disk. Uninstall always does an uninstall. If you do a
“scan for hardware changes”, it should match your device to the proper
driver, assuming there is a generic one. What class of device is this?
What do you mean by “removed”?

The device is a Mass Storage Controller with a custom setup class. When
we uninstall the package the device disappears, and re-appears under
“Other Devices” as an “Unknown Device”. Re-scanning doesn’t change
anything, and only when the “Unknown Device” is uninstalled does a scan
for changes cause the “Mass Storage Controller” entry to re-appear. I
suspect I need to study the log files more to understand what’s going wrong.

That sentence is a little confused. The uninstalled driver will
certainly not be functional any more. When you uninstall a driver
package, the driver stack for that device will be torn down and the
drivers unloaded. Because the INF is now gone, the next time Device
Manager tries to find a matching driver, it won’t find yours any more.

I think I was a bit confused about the statement on
http://msdn.microsoft.com/en-us/library/windows/hardware/ff545015(v=vs.85).aspx:

“Device installation applications /must not/ do the following:
Delete the installed driver files from the system during the uninstall
operation, even if the hardware is removed.”

I now understand that that means that entries in the DriverStore will be
removed and the driver removed, but the .sys file etc. will remain.
Does anyone know the reasoning behind leaving them on the system?


Bruce Cran

I think the reason this is occurring is because your installer changed the
device class to something ‘other’ than “Mass Storage Controller”.

When the device appears under “Unknown Device” what does Device Manager say
its device class property is?

In any event here is a suggestion to consider:

Create a custom action that does the equivalent of DEVCON delete on your
device instances. This will cause them to really be gone (as DevNodes) and
when PCI re-enumerates them a-new they will get default treatment.

Good Luck,
Dave Cattley

On 18/11/2011 19:40, David R. Cattley wrote:

I think the reason this is occurring is because your installer changed the
device class to something ‘other’ than “Mass Storage Controller”.

When the device appears under “Unknown Device” what does Device Manager say
its device class property is?

In any event here is a suggestion to consider:

Create a custom action that does the equivalent of DEVCON delete on your
device instances. This will cause them to really be gone (as DevNodes) and
when PCI re-enumerates them a-new they will get default treatment.

The class name is “Other devices”. Running “dpinst /U driver.inf” has
the same effect, so in the end I just bundled devcon and dpinst into the
installer and ran “devcon remove” first followed by “dpinst /U”.


Bruce Cran

OT perhaps but IIRC DEVCON as-is may not be redistributable (perhaps that
has changed). You might want build your own utility derived from devcon
sample sources.

Good Luck,
Dave Cattley

Correct, you can’t ship a binary named devcon

d

debt from my phone


From: David R. Cattley
Sent: 11/23/2011 1:36 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DIFxApp, driver uninstall and expected behaviour

OT perhaps but IIRC DEVCON as-is may not be redistributable (perhaps that
has changed). You might want build your own utility derived from devcon
sample sources.

Good Luck,
Dave Cattley


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

FYI, devcon binary is available on MS downloads.
http://support.microsoft.com/kb/311272

– pa

On 24-Nov-2011 00:13, Doron Holan wrote:

Correct, you can’t ship a binary named devcon

d


From: David R. Cattley
Sent: 11/23/2011 1:36 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DIFxApp, driver uninstall and expected behaviour

OT perhaps but IIRC DEVCON as-is may not be redistributable (perhaps that
has changed). You might want build your own utility derived from devcon
sample sources.

Good Luck,
Dave Cattley

It is not redistributable from that page either: “DevCon is not redistributable. It is provided for use as a debugging and development tool. You can freely modify DevCon for private use. The”

d

debt from my phone


From: Pavel A
Sent: 11/23/2011 8:02 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] DIFxApp, driver uninstall and expected behaviour

FYI, devcon binary is available on MS downloads.
http://support.microsoft.com/kb/311272

– pa

On 24-Nov-2011 00:13, Doron Holan wrote:

Correct, you can’t ship a binary named devcon

d


From: David R. Cattley
Sent: 11/23/2011 1:36 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] DIFxApp, driver uninstall and expected behaviour

OT perhaps but IIRC DEVCON as-is may not be redistributable (perhaps that
has changed). You might want build your own utility derived from devcon
sample sources.

Good Luck,
Dave Cattley


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