[Libguestfs] [PATCH 5/7] v2v: adapt the subkey in Enum registry to windows version
Richard W.M. Jones
rjones at redhat.com
Tue Apr 5 12:18:58 UTC 2016
On Tue, Apr 05, 2016 at 01:47:31PM +0200, Cédric Bosdonnat wrote:
> 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
This is OK, but maybe we can just pass the 'inspect' struct down into
add_viostor_to_critical_device_database (between g & root parameters)?
Maybe we'll need to use other inspection data in future.
We really ought to collect all these parameters into a struct :-)
Rich.
> -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
>
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
More information about the Libguestfs
mailing list