Someone pointed out to me that the WiX/Difxapp based installer we use does not, on uninstallation, remove the .sys file from Windows\System32\Drivers. We use a renamed devcon.exe to remove the device node, and the files staged in Windows\System32\DriverStore\FileRepository are all getting cleaned up as expected.
In the WiX script we include the difxapp:Driver element, and I tried setting the attribute DeleteFiles="yes". That didn't work. Why not? Well...https://technet.microsoft.com/en-us/ff549843(v=vs.96)
From that link, "Starting with Windows 7, the DIFxApp configuration flag to remove installed files, together with the DriverDeleteFiles attribute, are ignored by the operating system. Binary files, which were copied to a system when a driver package was installed, can no longer be deleted by using DIFxApp."
I'm not sure I understand the thinking here, and I have yet to find any explanation. Microsoft is free to do as it pleases, but when they don't explain their reasoning, well-meaning developers may violate some unspoken intent.
Should I create a custom uninstall action to manually clean up the .sys file? Or does Microsoft have good reason to keep that file in place until the day the disk is formatted? (I personally don't worry much if the file is left behind, but I do need to justify this to management if there's a reason for it.)
The sheer breadth of Microsoft's documentation means that sections fall out of date, unnoticed, and recommend entirely the wrong things. Look here, for instance:https://docs.microsoft.com/en-us/windows-hardware/drivers/install/using-the-difx-tools-to-uninstall-driver-packages
From that page: "We recommend that you only use the DIFx tools to create driver uninstallers. Applications that use the DIFx tools to uninstall drivers are designed to work correctly with future versions of Windows. Although other approaches might be successful with the current versions of Windows, they may not work correctly with future versions."
Fantastic! I'm state-of-the-art. Happy dance! Oh, wait:https://docs.microsoft.com/en-us/windows-hardware/drivers/install/difx-guidelines
In which we learn, "Starting in Windows 10 Version 1607 (Redstone 1), the Driver Install Frameworks (DIFx) tools are no longer included in the WDK. Instead, we recommend providing your driver as a standalone package that doesn't require an installer, ideally through Windows Update."
(I *will* make use of Microsoft's issue reporting to flag the outdated page; in my experience, they are quite responsive. I encourage everyone to make generous use of their reporting system to address documentation issues.)
This change was well discussed on this very forum, by the way, though in the end it seemed short on conclusions:https://osronline.com/ShowThread.cfm?link=282146