]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Remove CoInstaller from INF
authorOwen Smith <owen.smith@cloud.com>
Fri, 29 Sep 2023 08:03:14 +0000 (09:03 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 2 Oct 2023 08:36:05 +0000 (09:36 +0100)
Windows 11 22H2 WHQL requires INF files pass "InfVerif /k", which highlights
several issues
- PnpLockdown=1 needs to be specified
- CoInstallers are no longer allowed

The CoInstaller has several functions that will need alternative solutions:
- The AllowUpdate mechanism is no longer possible
- The safety checks that ensure interface versionings remain compatible
- The updating of various system config registry values

Interface safety checks need to be handled by changes to child device bindings,
and assuming upgrade via emulated devices is safe. The unplug keys are cleared
in the INF to revert to emulated on the next boot, incase the current child
drivers rely on an interface that is no longer present (note: in this case,
child drivers will need updating).

Also updates unplug_interface.h and device bindings so that this driver is only
loaded on a later XenBus that has removed the XenBus CoInstaller.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
include/unplug_interface.h
src/xenvbd.inf

index 46c5dd4fc443f1d46bc699dbf16643a018b33423..9bad29079449b3a161b45a350d7274b42f1f3e5f 100644 (file)
@@ -85,6 +85,20 @@ typedef VOID
     IN  BOOLEAN                     Make
     );
 
+/*! \typedef XENBUS_UNPLUG_GETSTATE
+    \brief Has a type of emulated device been unplugged
+
+    \param Interface The interface header
+    \param Type The type of device
+
+    \return TRUE The type of device has been unplugged this boot
+*/
+typedef BOOLEAN
+(*XENBUS_UNPLUG_GETSTATE)(
+    IN  PINTERFACE                  Interface,
+    IN  XENBUS_UNPLUG_DEVICE_TYPE   Type
+    );
+
 // {73db6517-3d06-4937-989f-199b7501e229}
 DEFINE_GUID(GUID_XENBUS_UNPLUG_INTERFACE,
 0x73db6517, 0x3d06, 0x4937, 0x98, 0x9f, 0x19, 0x9b, 0x75, 0x01, 0xe2, 0x29);
@@ -100,7 +114,19 @@ struct _XENBUS_UNPLUG_INTERFACE_V1 {
     XENBUS_UNPLUG_REQUEST   UnplugRequest;
 };
 
-typedef struct _XENBUS_UNPLUG_INTERFACE_V1 XENBUS_UNPLUG_INTERFACE, *PXENBUS_UNPLUG_INTERFACE;
+/*! \struct _XENBUS_UNPLUG_INTERFACE_V2
+    \brief UNPLUG interface version 2
+    \ingroup interfaces
+*/
+struct _XENBUS_UNPLUG_INTERFACE_V2 {
+    INTERFACE               Interface;
+    XENBUS_UNPLUG_ACQUIRE   UnplugAcquire;
+    XENBUS_UNPLUG_RELEASE   UnplugRelease;
+    XENBUS_UNPLUG_REQUEST   UnplugRequest;
+    XENBUS_UNPLUG_GETSTATE  UnplugGetState;
+};
+
+typedef struct _XENBUS_UNPLUG_INTERFACE_V2 XENBUS_UNPLUG_INTERFACE, *PXENBUS_UNPLUG_INTERFACE;
 
 /*! \def XENBUS_UNPLUG
     \brief Macro at assist in method invocation
@@ -111,6 +137,6 @@ typedef struct _XENBUS_UNPLUG_INTERFACE_V1 XENBUS_UNPLUG_INTERFACE, *PXENBUS_UNP
 #endif  // _WINDLL
 
 #define XENBUS_UNPLUG_INTERFACE_VERSION_MIN  1
-#define XENBUS_UNPLUG_INTERFACE_VERSION_MAX  1
+#define XENBUS_UNPLUG_INTERFACE_VERSION_MAX  2
 
 #endif  // _XENBUS_UNPLUG_INTERFACE_H
index 94553d73ee6b7c1e4a4edb1e2d8e53f2f968a039..8bb7998410a1d1d2f726fa2ab461f0e4acb02b1c 100644 (file)
@@ -37,10 +37,10 @@ Provider=%Vendor%
 CatalogFile=xenvbd.cat
 DriverVer=@INF_DATE@,@MAJOR_VERSION@.@MINOR_VERSION@.@MICRO_VERSION@.@BUILD_NUMBER@
 DriverPackageDisplayName=%DiskDesc%
+PnpLockdown=1
 
 [DestinationDirs] 
 DefaultDestDir=12 
-CoInst_CopyFiles=11
 
 [SourceDisksNames]
 0=%DiskDesc%
@@ -49,15 +49,14 @@ CoInst_CopyFiles=11
 xenvbd.sys=0,,
 xencrsh.sys=0,,
 xendisk.sys=0,,
-xenvbd_coinst.dll=0,,
 
 [Manufacturer] 
 %Vendor%=Inst,NT@INF_ARCH@
 
 [Inst.NT@INF_ARCH@]
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_09000009
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_09000009
-%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_09000009
+%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@@VENDOR_DEVICE_ID@&DEV_VBD&REV_0900000A
+%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0001&DEV_VBD&REV_0900000A
+%XenVbdName%=XenVbd_Inst,XENBUS\VEN_@VENDOR_PREFIX@0002&DEV_VBD&REV_0900000A
 
 [XenVbd_Inst] 
 CopyFiles=XenVbd_Copyfiles
@@ -96,7 +95,7 @@ StartType=%SERVICE_BOOT_START%
 ErrorControl=%SERVICE_ERROR_NORMAL% 
 ServiceBinary=%12%\xenvbd.sys 
 LoadOrderGroup="Scsi Miniport"
-AddReg=XenVbd_Parameters
+AddReg=XenVbd_Parameters, XenVbd_Unplug, XenVbd_Extras
 
 [XenVbd_Parameters] 
 HKR,"Parameters",,0x00000010
@@ -106,23 +105,26 @@ HKR,"Parameters","RequestKey",0x00000000,%RequestKey%
 HKR,"Parameters","max-ring-page-order",0x00010001,0x00000001
 HKR,"Parameters","multi-queue-max-queues",0x00010001,0x00000002
 
-[XenVbd_Inst.CoInstallers]
-CopyFiles=CoInst_CopyFiles
-AddReg=CoInst_AddReg
+[XenVbd_Unplug]
+HKLM,%UnplugKey%,"DISKS",0x00010001,0
 
-[CoInst_CopyFiles]
-xenvbd_coinst_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dll,xenvbd_coinst.dll
+[XenVbd_Extras]
+HKLM,%PnpKey%,"DisableCDDB",0x00010001,0
+HKLM,%PnpKey%,"DontStartRawDevices",0x00010001,0
+HKLM,%PartMgrKey%,"SanPolicy",0x00010001,1
+HKLM,%DiskKey%,"TimeOutValue",0x00010001,120
 
-[CoInst_AddReg]
-HKR,,CoInstallers32,0x00010000,"xenvbd_coinst_@MAJOR_VERSION@_@MINOR_VERSION@_@MICRO_VERSION@_@BUILD_NUMBER@.dll,Entry"
-
-[Strings] 
+[Strings]
 
 Vendor = "@VENDOR_NAME@"
 DiskDesc = "@PRODUCT_NAME@ PV Storage Host Adapter Package" 
 XenVbdName= "@PRODUCT_NAME@ PV Storage Host Adapter"
 XenDiskName= "@PRODUCT_NAME@ PV Storage Filter"
 RequestKey="SYSTEM\CurrentControlSet\Services\xenbus_monitor\Request"
+UnplugKey="SYSTEM\CurrentControlSet\Services\XEN\Unplug"
+PnpKey="SYSTEM\CurrentControlSet\Control\Pnp"
+PartMgrKey="SYSTEM\CurrentControlSet\Services\PartMgr\Parameters"
+DiskKey="SYSTEM\CurrentControlSet\Services\Disk"
 
 SERVICE_BOOT_START = 0x0 
 SERVICE_SYSTEM_START = 0x1