HardwareKey was not being closed in normal operation.
SoftwareKey only requires KEY_READ access.
Move DriverRequestReboot() to the point it is required to avoid a 'goto' in
the error handlers.
Signed-off-by: Owen Smith <owen.smith@cloud.com>
goto fail2;
status = RegistryOpenSoftwareKey(__PdoGetDeviceObject(Pdo),
- KEY_ALL_ACCESS,
+ KEY_READ,
&SoftwareKey);
if (!NT_SUCCESS(status))
goto fail3;
if (Pdo->HasAlias || !PdoUnplugRequested(Pdo)) {
PdoUnplugRequest(Pdo, TRUE);
+ DriverRequestReboot();
status = STATUS_PNP_REBOOT_REQUIRED;
goto fail9;
}
-
//
// If there is a stack bound then restore any settings that
// may have been saved from an aliasing device.
__FreeMibTable(Table);
+ RegistryCloseKey(HardwareKey);
RegistryCloseKey(SoftwareKey);
return STATUS_SUCCESS;
fail10:
Error("fail10\n");
- __FreeMibTable(Table);
-
- goto fail6;
-
fail9:
Error("fail9\n");
- DriverRequestReboot();
__FreeMibTable(Table);
fail8: