]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Verious fixes for WHQL
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 17 Sep 2013 14:58:10 +0000 (15:58 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 17 Sep 2013 14:58:10 +0000 (15:58 +0100)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/coinst/coinst.c
src/common/registry.c
src/xenbus.inf
src/xenbus/fdo.c
src/xenfilt/driver.c
src/xenfilt/fdo.c
src/xenfilt/unplug.c

index 3d3677f7c1751f162512a99e683519ee78b84958..2e4e002c0fd4233fb64c7985c781d0889f4b48e3 100644 (file)
@@ -98,8 +98,8 @@ __Log(
 #define Log(_Format, ...) \
         __Log(__MODULE__ "|" __FUNCTION__ ": " _Format, __VA_ARGS__)
 
-static PTCHAR
-GetErrorMessage(
+static FORCEINLINE PTCHAR
+__GetErrorMessage(
     IN  DWORD   Error
     )
 {
@@ -126,8 +126,8 @@ GetErrorMessage(
     return Message;
 }
 
-static const CHAR *
-FunctionName(
+static FORCEINLINE const CHAR *
+__FunctionName(
     IN  DI_FUNCTION Function
     )
 {
@@ -205,7 +205,7 @@ fail1:
 
     {
         PTCHAR  Message;
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -251,7 +251,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -352,7 +352,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -404,7 +404,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -556,7 +556,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -588,7 +588,7 @@ fail1:
 
     {
         PTCHAR  Message;
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -635,7 +635,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -699,7 +699,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -793,7 +793,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -877,7 +877,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -925,7 +925,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -997,7 +997,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1005,57 +1005,6 @@ fail1:
     return NULL;
 }
 
-static BOOLEAN
-SetFriendlyName(
-    IN  HDEVINFO            DeviceInfoSet,
-    IN  PSP_DEVINFO_DATA    DeviceInfoData,
-    IN  WORD                DeviceId,
-    IN  BOOLEAN             Active
-    )
-{
-    TCHAR                   FriendlyName[MAX_PATH];
-    DWORD                   FriendlyNameLength;
-    HRESULT                 Result;
-    HRESULT                 Error;
-
-    Result = StringCbPrintf(FriendlyName,
-                            MAX_PATH,
-                            "XenServer PV Bus (%04X) %s",
-                            DeviceId,
-                            (Active)? "[ACTIVE]" : "");
-    if (!SUCCEEDED(Result))
-        goto fail1;
-
-    Log("%s", FriendlyName);
-
-    FriendlyNameLength = (DWORD)(strlen(FriendlyName) + sizeof (TCHAR));
-
-    if (!SetupDiSetDeviceRegistryProperty(DeviceInfoSet,
-                                          DeviceInfoData,
-                                          SPDRP_FRIENDLYNAME,
-                                          (PBYTE)FriendlyName,
-                                          FriendlyNameLength))
-        goto fail2;
-
-    return TRUE;
-
-fail2:
-    Log("fail2");
-
-fail1:
-    Error = GetLastError();
-
-    {
-        PTCHAR  Message;
-
-        Message = GetErrorMessage(Error);
-        Log("fail1 (%s)", Message);
-        LocalFree(Message);
-    }
-
-    return FALSE;
-}
-
 static BOOLEAN
 AllowInstall(
     VOID
@@ -1217,7 +1166,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1507,7 +1456,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1526,7 +1475,6 @@ __DifInstallPostProcess(
     PTCHAR                          DeviceInstance;
     PTCHAR                          ActiveDeviceInstance;
     DWORD                           DeviceId;
-    BOOLEAN                         Active;
     BOOLEAN                         Success;
 
     Log("====>");
@@ -1554,32 +1502,21 @@ __DifInstallPostProcess(
         goto fail4;
     }
 
-    Active = (ActiveDeviceInstance != NULL &&
-              strcmp(DeviceInstance, ActiveDeviceInstance) == 0) ?
-             TRUE :
-             FALSE;
-
-    Success = SetFriendlyName(DeviceInfoSet,
-                              DeviceInfoData,
-                              (WORD)DeviceId,
-                              Active);
-    if (!Success)
-        goto fail5;
-
-    if (!Active)
+    if (ActiveDeviceInstance == NULL ||
+        strcmp(DeviceInstance, ActiveDeviceInstance) != 0)
         goto done;
 
     Success = InstallFilter(&GUID_DEVCLASS_SYSTEM, "XENFILT");
     if (!Success)
-        goto fail6;
+        goto fail5;
 
     Success = InstallFilter(&GUID_DEVCLASS_HDC, "XENFILT");
     if (!Success)
-        goto fail7;
+        goto fail6;
 
     Success = RequestReboot(DeviceInfoSet, DeviceInfoData);
     if (!Success)
-        goto fail8;
+        goto fail7;
 
 done:
     if (ActiveDeviceInstance != NULL)
@@ -1591,19 +1528,16 @@ done:
 
     return NO_ERROR;
 
-fail8:
-    Log("fail8");
-
-    (VOID) RemoveFilter(&GUID_DEVCLASS_HDC, "XENFILT");
-
 fail7:
     Log("fail7");
 
-    (VOID) RemoveFilter(&GUID_DEVCLASS_SYSTEM, "XENFILT");
+    (VOID) RemoveFilter(&GUID_DEVCLASS_HDC, "XENFILT");
 
 fail6:
     Log("fail6");
 
+    (VOID) RemoveFilter(&GUID_DEVCLASS_SYSTEM, "XENFILT");
+
 fail5:
     Log("fail5");
 
@@ -1627,7 +1561,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1666,7 +1600,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1751,7 +1685,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1789,7 +1723,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1828,7 +1762,7 @@ fail1:
     {
         PTCHAR  Message;
 
-        Message = GetErrorMessage(Error);
+        Message = __GetErrorMessage(Error);
         Log("fail1 (%s)", Message);
         LocalFree(Message);
     }
@@ -1852,10 +1786,10 @@ Entry(
 
     if (!Context->PostProcessing) {
         Log("%s PreProcessing",
-            FunctionName(Function));
+            __FunctionName(Function));
     } else {
         Log("%s PostProcessing (%08x)",
-            FunctionName(Function),
+            __FunctionName(Function),
             Context->InstallResult);
     }
 
index 13833a2cc8c4bdbe15552bc10c753b9dcbe4945f..87b0853899fc7b81e19df09bbd210caea1c4ba83 100644 (file)
@@ -182,7 +182,7 @@ RegistryOpenHardwareKey(
     if (!NT_SUCCESS(status))
         goto fail4;
 
-    Info->Name[Info->NameLength] = '\0';
+    Info->Name[Info->NameLength / sizeof (WCHAR)] = '\0';
 
     Cursor = wcsrchr(Info->Name, L'\\');
     ASSERT(Cursor != NULL);
index 674af5ebd94a3ec9ee4f5866ba947dce97843f3e..ab0f337e0eb248f5c657fa5cccd270a0fe9b5879 100644 (file)
@@ -96,13 +96,16 @@ StartType=%SERVICE_BOOT_START%
 ErrorControl=%SERVICE_ERROR_NORMAL% 
 ServiceBinary=%12%\xenfilt.sys 
 LoadOrderGroup="Boot Bus Extender"
-AddReg = XenFilt_Parameters
+AddReg = XenFilt_Parameters, XenFilt_Unplug
 
 [XenFilt_Parameters]
 HKR,"Parameters",,0x00000010
 HKR,"Parameters","ACPI\PNP0A03",0x00000000,"DEVICE"
 HKR,"Parameters","PCIIDE\IDEChannel",0x00000000,"DISK"
 
+[XenFilt_Unplug]
+HKR,"Unplug",,0x00000010
+
 [XenBus_Inst.CoInstallers]
 CopyFiles=CoInst_CopyFiles
 AddReg=CoInst_AddReg
index 68e991913fffc3e0fb281e5dfc9925ff63413344..cb0db9d2b87c9ed9a0bcbc449f3d89c911436d49 100644 (file)
@@ -629,6 +629,8 @@ __FdoEnumerate(
     )
 {
     BOOLEAN             NeedInvalidate;
+    HANDLE              ParametersKey;
+    ULONG               Enumerate;
     PLIST_ENTRY         ListEntry;
     ULONG               Index;
 
@@ -636,6 +638,23 @@ __FdoEnumerate(
 
     NeedInvalidate = FALSE;
 
+    ParametersKey = DriverGetParametersKey();
+
+    if (ParametersKey != NULL) {
+        NTSTATUS    status;
+
+        status = RegistryQueryDwordValue(ParametersKey,
+                                         "Enumerate",
+                                         &Enumerate);
+        if (!NT_SUCCESS(status))
+            Enumerate = 1;
+    } else {
+        Enumerate = 1;
+    }
+
+    if (Enumerate == 0)
+        goto done;
+
     __FdoAcquireMutex(Fdo);
 
     ListEntry = Fdo->Dx->ListEntry.Flink;
@@ -698,6 +717,7 @@ __FdoEnumerate(
 
     __FdoReleaseMutex(Fdo);
 
+done:
     Trace("<====\n");
 
     return NeedInvalidate;
@@ -2800,6 +2820,11 @@ FdoQueryPnpDeviceState(
         State |= PNP_DEVICE_NOT_DISABLEABLE;
     }
 
+    if (!__FdoIsActive(Fdo)) {
+        Info("%s: not active\n", __FdoGetName(Fdo));
+        State |= PNP_DEVICE_DONT_DISPLAY_IN_UI;
+    }
+
     Irp->IoStatus.Information = State;
     Irp->IoStatus.Status = STATUS_SUCCESS;
 
index 36e36f5b4b8a291bad49bb82e4e93f0e10293eb3..31f7022e8d77c698322b10a64f812f82c60b37ff 100644 (file)
@@ -422,10 +422,7 @@ DriverEntry(
     if (NT_SUCCESS(status))
         __DriverSetParametersKey(ParametersKey);
 
-    status = RegistryCreateSubKey(ServiceKey, 
-                                  "Unplug", 
-                                  REG_OPTION_NON_VOLATILE, 
-                                  &UnplugKey);
+    status = RegistryOpenSubKey(ServiceKey, "Unplug", KEY_READ, &UnplugKey);
     if (!NT_SUCCESS(status))
         goto fail3;
 
index 79e4b8ed9fe387e9d2c0467289f6ca4384a264fe..e7dd9fd5c293255323ccf97134c940bd8214712b 100644 (file)
@@ -359,6 +359,30 @@ FdoReleaseMutex(
         FdoDestroy(Fdo);
 }
 
+PXENFILT_EMULATED_INTERFACE
+FdoGetEmulatedInterface(
+    IN  PXENFILT_FDO     Fdo
+    )
+{
+    return &Fdo->EmulatedInterface;
+}
+
+static FORCEINLINE PXENFILT_UNPLUG_INTERFACE
+__FdoGetUnplugInterface(
+    IN  PXENFILT_FDO     Fdo
+    )
+{
+    return &Fdo->UnplugInterface;
+}
+
+PXENFILT_UNPLUG_INTERFACE
+FdoGetUnplugInterface(
+    IN  PXENFILT_FDO     Fdo
+    )
+{
+    return __FdoGetUnplugInterface(Fdo);
+}
+
 static FORCEINLINE VOID
 __FdoEnumerate(
     IN  PXENFILT_FDO        Fdo,
@@ -437,36 +461,27 @@ fail1:
     Error("fail1 (%08x)\n", status);
 }
 
-static FORCEINLINE NTSTATUS
+static FORCEINLINE VOID
 __FdoS4ToS3(
-    IN  PXENFILT_FDO    Fdo
+    IN  PXENFILT_FDO            Fdo
     )
 {
-    KIRQL               Irql;
-    NTSTATUS            status;
+    KIRQL                       Irql;
+    PXENFILT_UNPLUG_INTERFACE   UnplugInterface;
 
     ASSERT3U(__FdoGetSystemPowerState(Fdo), ==, PowerSystemHibernate);
 
     KeRaiseIrql(DISPATCH_LEVEL, &Irql); // Flush out any attempt to use pageable memory
 
-    status = UnplugInitialize(&Fdo->UnplugInterface);
-    if (!NT_SUCCESS(status))
-        goto fail1;
-
-    __FdoSetSystemPowerState(Fdo, PowerSystemSleeping3);
+    UnplugInterface = __FdoGetUnplugInterface(Fdo);
 
-    KeLowerIrql(Irql);
+    UNPLUG(Acquire, UnplugInterface);
+    UNPLUG(Replay, UnplugInterface);
+    UNPLUG(Release, UnplugInterface);
 
-    Trace("<====\n");
-
-    return STATUS_SUCCESS;
-
-fail1:
-    Error("fail1 (%08x)\n", status);
+    __FdoSetSystemPowerState(Fdo, PowerSystemSleeping3);
 
     KeLowerIrql(Irql);
-
-    return status;
 }
 
 static FORCEINLINE VOID
@@ -476,27 +491,9 @@ __FdoS3ToS4(
 {
     ASSERT3U(__FdoGetSystemPowerState(Fdo), ==, PowerSystemSleeping3);
 
-    UnplugTeardown(&Fdo->UnplugInterface);
-
     __FdoSetSystemPowerState(Fdo, PowerSystemHibernate);
 }
 
-PXENFILT_EMULATED_INTERFACE
-FdoGetEmulatedInterface(
-    IN  PXENFILT_FDO     Fdo
-    )
-{
-    return &Fdo->EmulatedInterface;
-}
-
-PXENFILT_UNPLUG_INTERFACE
-FdoGetUnplugInterface(
-    IN  PXENFILT_FDO     Fdo
-    )
-{
-    return &Fdo->UnplugInterface;
-}
-
 __drv_functionClass(IO_COMPLETION_ROUTINE)
 __drv_sameIRQL
 static NTSTATUS
@@ -571,10 +568,8 @@ FdoStartDevice(
 
     __FdoSetSystemPowerState(Fdo, PowerSystemHibernate);
 
-    status = __FdoS4ToS3(Fdo);
-    if (!NT_SUCCESS(status))
-        goto fail3;
-
+    __FdoS4ToS3(Fdo);
+    
     __FdoSetSystemPowerState(Fdo, PowerSystemWorking);
 
     __FdoSetDevicePowerState(Fdo, PowerDeviceD0);
@@ -592,11 +587,6 @@ FdoStartDevice(
 
     return status;
 
-fail3:
-    Error("fail3\n");
-
-    __FdoSetSystemPowerState(Fdo, PowerSystemShutdown);
-
 fail2:
     Error("fail2\n");
 
@@ -1369,7 +1359,7 @@ __FdoSetSystemPowerUp(
     if (SystemState < PowerSystemHibernate &&
         __FdoGetSystemPowerState(Fdo) >= PowerSystemHibernate) {
         __FdoSetSystemPowerState(Fdo, PowerSystemHibernate);
-        (VOID) __FdoS4ToS3(Fdo);
+        __FdoS4ToS3(Fdo);
     }
 
     __FdoSetSystemPowerState(Fdo, SystemState);
@@ -2002,6 +1992,10 @@ FdoCreate(
     if (!NT_SUCCESS(status))
         goto fail8;
 
+    status = UnplugInitialize(&Fdo->UnplugInterface);
+    if (!NT_SUCCESS(status))
+        goto fail9;
+
     InitializeMutex(&Fdo->Mutex);
     InitializeListHead(&Dx->ListEntry);
     Fdo->References = 1;
@@ -2021,6 +2015,11 @@ FdoCreate(
 
     return STATUS_SUCCESS;
 
+fail9:
+    Error("fail9\n");
+
+    EmulatedTeardown(&Fdo->EmulatedInterface);
+
 fail8:
     Error("fail8\n");
 
@@ -2092,6 +2091,8 @@ FdoDestroy(
 
     RtlZeroMemory(&Fdo->Mutex, sizeof (MUTEX));
 
+    UnplugTeardown(&Fdo->UnplugInterface);
+
     EmulatedTeardown(&Fdo->EmulatedInterface);
 
     Fdo->Type = XENFILT_EMULATED_OBJECT_TYPE_INVALID;
index 0ec306be207d249874e928b6367f9d77b80acfd8..55764eb6f84cc49c0b645e6b4fdc0947a99a2615 100644 (file)
@@ -59,20 +59,27 @@ static XENFILT_UNPLUG_CONTEXT   UnplugContext;
 
 static FORCEINLINE NTSTATUS
 __UnplugPreamble(
-    IN  PXENFILT_UNPLUG_CONTEXT Context
+    IN  PXENFILT_UNPLUG_CONTEXT Context,
+    IN  BOOLEAN                 Locked
     )
 {
-    KIRQL                       Irql;
+    KIRQL                       Irql = PASSIVE_LEVEL;
     USHORT                      Magic;
     UCHAR                       Version;
     NTSTATUS                    status;
 
-    AcquireHighLock(&Context->Lock, &Irql);
+    if (!Locked)
+        AcquireHighLock(&Context->Lock, &Irql);
 
     // See docs/misc/hvm-emulated-unplug.markdown for details of the
     // protocol in use here
 
     Magic = READ_PORT_USHORT((PUSHORT)0x10);
+    
+    if (Magic == 0xd249) {
+        Context->BlackListed = TRUE;
+        goto done;
+    }
 
     status = STATUS_NOT_SUPPORTED;
     if (Magic != 0x49d2)
@@ -91,17 +98,22 @@ __UnplugPreamble(
             Context->BlackListed = TRUE;
     }
 
-    ReleaseHighLock(&Context->Lock, Irql);
+done:
+    LogPrintf(LOG_LEVEL_WARNING,
+              "UNPLUG: PRE-AMBLE (DRIVERS %s)\n",
+              (Context->BlackListed) ? "BLACKLISTED" : "NOT BLACKLISTED");
 
-    Info("DONE %s\n", (Context->BlackListed) ? "[BLACKLISTED]" : "");
+    if (!Locked)
+        ReleaseHighLock(&Context->Lock, Irql);
 
     return STATUS_SUCCESS;
 
 fail1:
-    ReleaseHighLock(&Context->Lock, Irql);
-
     Error("fail1 (%08x)\n", status);
 
+    if (!Locked)
+        ReleaseHighLock(&Context->Lock, Irql);
+
     return status;
 }
 
@@ -129,10 +141,8 @@ __UnplugDisks(
     status = RegistryQuerySzValue(UnplugKey,
                                   "DISKS",
                                   &ServiceName);
-    if (!NT_SUCCESS(status)) {
-        Info("NO PV SERVICE\n");
+    if (!NT_SUCCESS(status))
         goto done;
-    }
 
     status = RtlStringCbPrintfA(ServiceKeyName,
                                 sizeof (ServiceKeyName),
@@ -144,10 +154,8 @@ __UnplugDisks(
                                 ServiceKeyName,
                                 KEY_READ,
                                 &ServiceKey);
-    if (!NT_SUCCESS(status)) {
-        Info("%Z: NO SERVICE KEY\n", ServiceName);
+    if (!NT_SUCCESS(status))
         goto done;
-    }
 
     status = RegistryQueryDwordValue(ServiceKey,
                                      "Count",
@@ -155,22 +163,21 @@ __UnplugDisks(
     if (!NT_SUCCESS(status))
         Count = 0;
 
-    if (Count == 0) {
-        Info("%Z: NO SERVICE INSTANCES\n", ServiceName);
+    if (Count == 0)
         goto done;
-    }
 
     AcquireHighLock(&Context->Lock, &Irql);
 
     ASSERT(!Context->UnpluggedDisks);
 
     WRITE_PORT_USHORT((PUSHORT)0x10, 0x0001);
+
+    LogPrintf(LOG_LEVEL_WARNING, "UNPLUG: DISKS\n");
+
     Context->UnpluggedDisks = TRUE;
 
     ReleaseHighLock(&Context->Lock, Irql);
 
-    Info("DONE\n");
-
 done:
     if (ServiceKey != NULL)
         RegistryCloseKey(ServiceKey);
@@ -200,10 +207,8 @@ __UnplugNics(
     status = RegistryQuerySzValue(UnplugKey,
                                   "NICS",
                                   &ServiceName);
-    if (!NT_SUCCESS(status)) {
-        Info("NO PV SERVICE\n");
+    if (!NT_SUCCESS(status))
         goto done;
-    }
 
     status = RtlStringCbPrintfA(ServiceKeyName,
                                 sizeof (ServiceKeyName),
@@ -215,10 +220,8 @@ __UnplugNics(
                                 ServiceKeyName,
                                 KEY_READ,
                                 &ServiceKey);
-    if (!NT_SUCCESS(status)) {
-        Info("%Z: NO SERVICE KEY\n", ServiceName);
+    if (!NT_SUCCESS(status))
         goto done;
-    }
 
     status = RegistryQueryDwordValue(ServiceKey,
                                      "Count",
@@ -226,22 +229,21 @@ __UnplugNics(
     if (!NT_SUCCESS(status))
         Count = 0;
 
-    if (Count == 0) {
-        Info("%Z: NO SERVICE INSTANCES\n", ServiceName);
+    if (Count == 0)
         goto done;
-    }
 
     AcquireHighLock(&Context->Lock, &Irql);
 
     ASSERT(!Context->UnpluggedNics);
 
     WRITE_PORT_USHORT((PUSHORT)0x10, 0x0002);
+
+    LogPrintf(LOG_LEVEL_WARNING, "UNPLUG: NICS\n");
+
     Context->UnpluggedNics = TRUE;
 
     ReleaseHighLock(&Context->Lock, Irql);
 
-    Info("DONE\n");
-
 done:
     if (ServiceKey != NULL)
         RegistryCloseKey(ServiceKey);
@@ -256,14 +258,22 @@ UnplugReplay(
     )
 {
     KIRQL                       Irql;
+    NTSTATUS                    status;
 
     AcquireHighLock(&Context->Lock, &Irql);
 
-    if (Context->UnpluggedDisks)
+    status = __UnplugPreamble(Context, TRUE);
+    ASSERT(NT_SUCCESS(status));
+
+    if (Context->UnpluggedDisks) {
         WRITE_PORT_USHORT((PUSHORT)0x10, 0x0001);
+        LogPrintf(LOG_LEVEL_WARNING, "UNPLUG: DISKS\n");
+    }
 
-    if (Context->UnpluggedNics)
+    if (Context->UnpluggedNics) {
         WRITE_PORT_USHORT((PUSHORT)0x10, 0x0002);
+        LogPrintf(LOG_LEVEL_WARNING, "UNPLUG: NICS\n");
+    }
     
     ReleaseHighLock(&Context->Lock, Irql);
 }
@@ -313,7 +323,7 @@ UnplugInitialize(
 
     InitializeHighLock(&Context->Lock);
 
-    status = __UnplugPreamble(Context);
+    status = __UnplugPreamble(Context, FALSE);
     if (!NT_SUCCESS(status))
         goto fail1;
 
@@ -360,8 +370,6 @@ UnplugTeardown(
 
     ASSERT(IsZeroMemory(Context, sizeof (XENFILT_UNPLUG_CONTEXT)));
 
-    Info("DONE\n");
-
 done:
     RtlZeroMemory(Interface, sizeof (XENFILT_UNPLUG_INTERFACE));