Skip to content

Commit

Permalink
Uninstall needs to be case insensitive
Browse files Browse the repository at this point in the history
When looking for rootnode to remove, we sometimes had difference in only
case. Additionally, make sure multiple remove attempts does not BSOD.
  • Loading branch information
lundman committed Feb 6, 2020
1 parent 856b1e2 commit 3d81ae2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 12 additions & 4 deletions ZFSin/zfs/module/zfs/zfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6781,14 +6781,22 @@ zfs_ioc_unregister_fs(void)
dprintf("%s: datasets still busy: %llu pool(s)\n", __func__, zfs_module_busy);
return zfs_module_busy;
}
IoUnregisterFsRegistrationChange(WIN_DriverObject, DriverNotificationRoutine);
IoUnregisterFileSystem(fsDiskDeviceObject);
IoDeleteDevice(fsDiskDeviceObject);
IoDeleteDevice(ioctlDeviceObject);
if (fsDiskDeviceObject != NULL) {
IoUnregisterFsRegistrationChange(WIN_DriverObject, DriverNotificationRoutine);
IoUnregisterFileSystem(fsDiskDeviceObject);
IoDeleteDevice(fsDiskDeviceObject);
fsDiskDeviceObject = NULL;
IoDeleteDevice(ioctlDeviceObject);
ioctlDeviceObject = NULL;
}
#if 0
// Do not unload these, so that the zfsinstaller uninstall can
// find the devnode to trigger uninstall.
if (STOR_DriverUnload != NULL) {
STOR_DriverUnload(WIN_DriverObject);
STOR_DriverUnload = NULL;
}
#endif
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions zfsinstaller/zfsinstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ DWORD send_zfs_ioc_unregister_fs(void)
#include <cfgmgr32.h>
#include <newdev.h>

#define ZFS_ROOTDEV "ROOT\\ZFSin"
#define ZFS_ROOTDEV "Root\\ZFSin"
// DevCon uses LoadLib() - but lets just static link
#pragma comment(lib, "Newdev.lib")

Expand Down Expand Up @@ -372,7 +372,7 @@ DWORD uninstallRootDevice(char *inf)
if (DeviceInfoSet == INVALID_HANDLE_VALUE)
goto final;

printf("%s: open\n", __func__);
printf("%s: looking for device rootnode to remove...\n", __func__);

DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (int i = 0; SetupDiEnumDeviceInfo(DeviceInfoSet, i, &DeviceInfoData); i++)
Expand Down Expand Up @@ -408,7 +408,7 @@ DWORD uninstallRootDevice(char *inf)
// Compare each entry in the buffer multi-sz list with our HardwareID.
for (p = buffer; *p && (p < &buffer[buffersize]); p += strlen(p) + sizeof(char)) {
//printf("%s: comparing '%s' with '%s'\n", __func__, "ROOT\\ZFSin", p);
if (!strcmp(ZFS_ROOTDEV, p)) {
if (!_stricmp(ZFS_ROOTDEV, p)) {

printf("%s: device found, removing ... \n", __func__);

Expand Down

0 comments on commit 3d81ae2

Please sign in to comment.