From: Paul Durrant Date: Thu, 3 Sep 2015 16:36:43 +0000 (+0100) Subject: Clear unplug requests from co-installer X-Git-Tag: 8.1.0-rc1^0 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=59797d160517e47a249e67f030bb5d2943f8177a;p=pvdrivers%2Fwin%2Fxenvbd.git Clear unplug requests from co-installer When XENVBD is uninstalled there is no suitable notification in kernel which can be used to clear any remaining unplug requests. This leads to a certain 0x7B bugcheck on reboot. This patch therefore does the job from the co-installer since this seems to be the only way. Signed-off-by: Paul Durrant --- diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c index 9069435..7f421c9 100644 --- a/src/coinst/coinst.c +++ b/src/coinst/coinst.c @@ -46,6 +46,9 @@ __user_code; #define SERVICE_KEY(_Driver) \ SERVICES_KEY ## "\\" ## #_Driver +#define UNPLUG_KEY \ + SERVICE_KEY(XEN) ## "\\Unplug" + #define STATUS_KEY \ SERVICE_KEY(XENVBD) ## "\\Status" @@ -182,6 +185,53 @@ __FunctionName( #undef _NAME } +static BOOLEAN +ClearUnplugRequest( + IN PTCHAR ClassName + ) +{ + HKEY UnplugKey; + HRESULT Error; + + Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, + UNPLUG_KEY, + 0, + KEY_ALL_ACCESS, + &UnplugKey); + if (Error != ERROR_SUCCESS) { + SetLastError(Error); + goto fail1; + } + + Error = RegDeleteValue(UnplugKey, ClassName); + if (Error != ERROR_SUCCESS) { + SetLastError(Error); + goto fail2; + } + + RegCloseKey(UnplugKey); + + return TRUE; + +fail2: + Log("fail2"); + + RegCloseKey(UnplugKey); + +fail1: + Error = GetLastError(); + + { + PTCHAR Message; + + Message = __GetErrorMessage(Error); + Log("fail1 (%s)", Message); + LocalFree(Message); + } + + return FALSE; +} + static BOOLEAN OverrideGroupPolicyOptions( ) @@ -566,7 +616,9 @@ __DifRemovePreProcess( UNREFERENCED_PARAMETER(DeviceInfoData); UNREFERENCED_PARAMETER(Context); - Log("====>"); + Log("<===>"); + + (VOID) ClearUnplugRequest("DISKS"); return NO_ERROR; }