co-installer uninstall issue

Hi all,
while trying to uninstall a driver.

In co-installer, if I use
InstallHinfSectionW(NULL, NULL, "DefaultUninstall 132 c:\drivers\driver.inf, 0); it removes the file from C:\windows\system32\drivers
but if I use
SetupInstallFilesFromInfSection(inf, NULL, FileQueue, "DefaultUninstall", NULL, 0);
doesn’t return any error, but doesn’t delete the file C:\windows\system32\drivers\driver.sys

INF file
`[DefaultUninstall]
DelFiles = DriversDir
DelReg = Driver.DelRegistry

[DriversDir]
driver.sys

[Driver.DelRegistry]
HKLM,%drvRegistry%,%drvDebugFlags%`

How can you have a coinstaller with a default install (not pnp) inf? What does setupapi.dev.log say?

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com
Sent: Friday, April 6, 2018 8:13:20 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] co-installer uninstall issue

Hi all,
while trying to uninstall a driver.

In co-installer, if I use
InstallHinfSectionW(NULL, NULL, "DefaultUninstall 132 c:\drivers\driver.inf, 0); it removes the file from C:\windows\system32\drivers
but if I use
SetupInstallFilesFromInfSection(inf, NULL, FileQueue, "DefaultUninstall", NULL, 0);
doesn’t return any error, but doesn’t delete the file C:\windows\system32\drivers\driver.sys

INF file
[DefaultUninstall]<br>DelFiles = DriversDir<br>DelReg = Driver.DelRegistry<br><br>[DriversDir]<br>driver.sys<br><br>[Driver.DelRegistry]<br>HKLM,%drvRegistry%,%drvDebugFlags%


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

xxxxx@gmail.com wrote:

Hi all,
while trying to uninstall a driver.

In co-installer, if I use
InstallHinfSectionW(NULL, NULL, "DefaultUninstall 132 c:\drivers\driver.inf, 0); it removes the file from C:\windows\system32\drivers
but if I use
SetupInstallFilesFromInfSection(inf, NULL, FileQueue, "DefaultUninstall", NULL, 0);
doesn’t return any error, but doesn’t delete the file C:\windows\system32\drivers\driver.sys

That just queues up actions that need to be taken.  In order to take the
actions, you have to call SetupInstallFromInfSection.  Are you calling that?

Microsoft’s official policy is to discourage deleting driver files and
registry entries, to make it easier should the device ever appear
again.  As developers, we like to have a way to restore a system to
pristine cleanliness, but that’s contrary to the philosophy.


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

I am calling if (!SetupInstallFromInfSection( NULL, hInf, L"DefaultUninstall", SPINST_FILES, NULL, NULL, 0, NULL, NULL, NULL, NULL ))

But no error from it.

setup.dev.log does show the driver has been removed via ‘SetupDiRemoveDevice’, the driver is removed from the driverStore. The driver service is removed via SetupInstallServicesFromInfSection and then inf file is deleted SetupUninstallOEMInf

I am removing the device via SetupDiRemoveDevice, works fine
then removing the services via SetupInstallServicesFromInfSection(hInf, L"DefaultUninstall.Services", 0)), works fine
then removing the files via SetupInstallFilesFromInfSection + SetupCommitFileQueue + SetupInstallFromInfSection doesn’t work. The driver file is still available in C:\windows\system32\drivers\
then removing the inf file via SetupUninstallOEMInf works fine.