Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting... Please check out the Community Guidelines in the
Announcements and Administration Category.

co-installer uninstall issue

adnanadnan Posts: 166
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%`

Comments

  • Doron_HolanDoron_Holan Posts: 10,360
    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]
    DelFiles = DriversDir
    DelReg = Driver.DelRegistry

    [DriversDir]
    driver.sys

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

    ---
    NTDEV is sponsored by OSR

    Visit the list online at:

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

    To unsubscribe, visit the List Server section of OSR Online at
  • Tim_RobertsTim_Roberts Posts: 12,622
    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.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • adnanadnan Posts: 166
    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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!