[Libguestfs] [PATCH 5/7] v2v: adapt the subkey in Enum registry to windows version

Cédric Bosdonnat cbosdonnat at suse.com
Tue Apr 5 11:47:31 UTC 2016


We need to adapt the Services\viostor\Enum\PCI\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00 subkey
to what windows actually uses.
---
 v2v/windows_virtio.ml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
index 8a0b529..dfb7b71 100644
--- a/v2v/windows_virtio.ml
+++ b/v2v/windows_virtio.ml
@@ -139,15 +139,18 @@ and add_viostor_to_registry g inspect root current_cs driverdir =
   if (major == 6 && minor >= 2) || major >= 7 then (* Windows >= 8 *)
     add_viostor_to_driver_database g root arch current_cs driverdir
   else                          (* Windows <= 7 *)
-    add_viostor_to_critical_device_database g root current_cs
+    add_viostor_to_critical_device_database g root current_cs major
 
-and add_viostor_to_critical_device_database g root current_cs =
+and add_viostor_to_critical_device_database g root current_cs major =
   (* See http://rwmj.wordpress.com/2010/04/30/tip-install-a-device-driver-in-a-windows-vm/
    * NB: All these edits are in the HKLM\SYSTEM hive.  No other
    * hive may be modified here.
    *)
   let driver = "viostor.sys" in
   let driver_name = Filename.chop_extension driver in
+  (* Windows 2k3 uses '&0&', windows 2k8 '&2&' *)
+  let subkey =
+    if (major == 5) then "3&13c0b0c5&0" else "3&13c0b0c5&2" in
   let regedits = [
       [ current_cs; "Control"; "CriticalDeviceDatabase"; "pci#ven_1af4&dev_1001&subsys_00000000" ],
       [ "Service", REG_SZ driver_name;
@@ -190,7 +193,7 @@ and add_viostor_to_critical_device_database g root current_cs =
       [ "5", REG_DWORD 0x1_l ];
 
       [ current_cs; "Services"; driver_name; "Enum" ],
-      [ "0", REG_SZ "PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\3&13c0b0c5&0&20";
+      [ "0", REG_SZ (sprintf "PCI\\VEN_1AF4&DEV_1001&SUBSYS_00021AF4&REV_00\\%s&20" subkey);
         "Count", REG_DWORD 0x1_l;
         "NextInstance", REG_DWORD 0x1_l ];
     ] in
-- 
2.6.2




More information about the Libguestfs mailing list