---
customize/firstboot.ml | 5 +----
examples/virt-dhcp-address.c | 5 ++---
v2v/convert_windows.ml | 43 +++++++++++++++++--------------------------
v2v/inspect_source.ml | 8 ++++++--
v2v/types.ml | 6 ++++++
v2v/types.mli | 2 ++
v2v/v2v_unit_tests.ml | 4 +++-
7 files changed, 37 insertions(+), 36 deletions(-)
diff --git a/customize/firstboot.ml b/customize/firstboot.ml
index 5489c21..09ffca8 100644
--- a/customize/firstboot.ml
+++ b/customize/firstboot.ml
@@ -313,10 +313,7 @@ echo uninstalling firstboot service
g#write (firstboot_dir // "firstboot.bat") (unix2dos firstboot_script);
(* Open the SYSTEM hive. *)
- let systemroot = g#inspect_get_windows_systemroot root in
- let filename = sprintf "%s/system32/config/SYSTEM" systemroot in
- let filename = g#case_sensitive_path filename in
- Registry.with_hive_write g filename
+ Registry.with_hive_write g (g#inspect_get_windows_system_hive root)
(fun reg ->
let current_cs = g#inspect_get_windows_current_control_set root in
diff --git a/examples/virt-dhcp-address.c b/examples/virt-dhcp-address.c
index df06ebe..0c7e763 100644
--- a/examples/virt-dhcp-address.c
+++ b/examples/virt-dhcp-address.c
@@ -203,9 +203,8 @@ print_dhcp_address_windows (guestfs_h *g, char *root_fs)
size_t i;
char *p;
- /* Locate the SYSTEM hive case-sensitive path. */
- system_path =
- guestfs_case_sensitive_path (g, "/windows/system32/config/system");
+ /* Locate the SYSTEM hive. */
+ system_path = guestfs_inspect_get_windows_system_hive (g, root_fs);
if (!system_path)
exit (EXIT_FAILURE);
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index e929e1c..e259c22 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -68,25 +68,12 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps
=
None
) in
- (* Get the software and system hive files. *)
- let software_hive_filename =
- let filename = sprintf "%s/system32/config/software"
- inspect.i_windows_systemroot in
- let filename = g#case_sensitive_path filename in
- filename in
-
- let system_hive_filename =
- let filename = sprintf "%s/system32/config/system"
- inspect.i_windows_systemroot in
- let filename = g#case_sensitive_path filename in
- filename in
-
(*----------------------------------------------------------------------*)
(* Inspect the Windows guest. *)
(* If the Windows guest appears to be using group policy. *)
let has_group_policy =
- Registry.with_hive_readonly g software_hive_filename
+ Registry.with_hive_readonly g inspect.i_windows_software_hive
(fun reg ->
try
let path = ["Microsoft"; "Windows";
"CurrentVersion";
@@ -129,7 +116,7 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps
=
let xenpv_uninst =
let xenpvreg = "Red Hat Paravirtualized Xen Drivers for Windows(R)" in
- Registry.with_hive_readonly g software_hive_filename
+ Registry.with_hive_readonly g inspect.i_windows_software_hive
(fun reg ->
try
let path = ["Microsoft"; "Windows";
"CurrentVersion"; "Uninstall";
@@ -170,7 +157,7 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps
=
let prltools_uninsts =
let uninsts = ref [] in
- Registry.with_hive_readonly g software_hive_filename
+ Registry.with_hive_readonly g inspect.i_windows_software_hive
(fun reg ->
try
let path = ["Microsoft"; "Windows";
"CurrentVersion"; "Uninstall"] in
@@ -273,20 +260,22 @@ reg delete \"%s\" /v %s /f" strkey name
let key_path = ["Policies"; "Microsoft";
"Windows"; "DeviceInstall";
"Settings"] in
let name = "SuppressNewHWUI" in
- let value = Registry.with_hive_write g software_hive_filename (
- fun reg -> set_reg_val_dword_1 reg key_path name
- ) in
+ let value =
+ Registry.with_hive_write g inspect.i_windows_software_hive (
+ fun reg -> set_reg_val_dword_1 reg key_path name
+ ) in
reg_restore ("HKLM\\Software" :: key_path) name value
(* WinXP 64bit / Win2k3 *)
| 5, 2 ->
let key_path = ["Services"; "PlugPlay";
"Parameters"] in
let name = "SuppressUI" in
- let value = Registry.with_hive_write g system_hive_filename (
- fun reg ->
- let path = inspect.i_windows_current_control_set :: key_path in
- set_reg_val_dword_1 reg path name
- ) in
+ let value =
+ Registry.with_hive_write g inspect.i_windows_system_hive (
+ fun reg ->
+ let path = inspect.i_windows_current_control_set :: key_path in
+ set_reg_val_dword_1 reg path name
+ ) in
reg_restore ("HKLM\\SYSTEM\\CurrentControlSet" :: key_path) name
value
@@ -623,10 +612,12 @@ if errorlevel 3010 exit /b 0
(* Open the system hive for writes and update it. *)
let block_driver, net_driver, video_driver =
- Registry.with_hive_write g system_hive_filename update_system_hive in
+ Registry.with_hive_write g inspect.i_windows_system_hive
+ update_system_hive in
(* Open the software hive for writes and update it. *)
- Registry.with_hive_write g software_hive_filename update_software_hive;
+ Registry.with_hive_write g inspect.i_windows_software_hive
+ update_software_hive;
fix_ntfs_heads ();
diff --git a/v2v/inspect_source.ml b/v2v/inspect_source.ml
index 3b16c42..2b422e0 100644
--- a/v2v/inspect_source.ml
+++ b/v2v/inspect_source.ml
@@ -70,13 +70,15 @@ let rec inspect_source root_choice g =
(* If the guest is Windows, get some Windows-specific inspection
* data, else (for simplicity when accessing) use empty strings.
*)
- let systemroot, current_cs =
+ let systemroot, software_hive, system_hive, current_cs =
match typ with
| "windows" ->
g#inspect_get_windows_systemroot root,
+ g#inspect_get_windows_software_hive root,
+ g#inspect_get_windows_system_hive root,
g#inspect_get_windows_current_control_set root
| _ ->
- "", "" in
+ "", "", "", "" in
let inspect = {
i_root = root;
@@ -94,6 +96,8 @@ let rec inspect_source root_choice g =
i_apps_map = apps_map;
i_firmware = get_firmware_bootable_device g;
i_windows_systemroot = systemroot;
+ i_windows_software_hive = software_hive;
+ i_windows_system_hive = system_hive;
i_windows_current_control_set = current_cs;
} in
debug "%s" (string_of_inspect inspect);
diff --git a/v2v/types.ml b/v2v/types.ml
index 7fd6327..9d94dca 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -325,6 +325,8 @@ type inspect = {
i_apps_map : Guestfs.application2 list StringMap.t;
i_firmware : i_firmware;
i_windows_systemroot : string;
+ i_windows_software_hive : string;
+ i_windows_system_hive : string;
i_windows_current_control_set : string;
}
@@ -342,6 +344,8 @@ i_product_name = %s
i_product_variant = %s
i_firmware = %s
i_windows_systemroot = %s
+i_windows_software_hive = %s
+i_windows_system_hive = %s
i_windows_current_control_set = %s
" inspect.i_root
inspect.i_type
@@ -357,6 +361,8 @@ i_windows_current_control_set = %s
| I_BIOS -> "BIOS"
| I_UEFI devices -> sprintf "UEFI [%s]" (String.concat ", "
devices))
inspect.i_windows_systemroot
+ inspect.i_windows_software_hive
+ inspect.i_windows_system_hive
inspect.i_windows_current_control_set
type mpstat = {
diff --git a/v2v/types.mli b/v2v/types.mli
index df50b1b..48e47b0 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -231,6 +231,8 @@ type inspect = {
(** The list of EFI system partitions for the guest with UEFI,
otherwise the BIOS identifier. *)
i_windows_systemroot : string;
+ i_windows_software_hive : string;
+ i_windows_system_hive : string;
i_windows_current_control_set : string;
}
(** Inspection information. *)
diff --git a/v2v/v2v_unit_tests.ml b/v2v/v2v_unit_tests.ml
index af86afa..bd65788 100644
--- a/v2v/v2v_unit_tests.ml
+++ b/v2v/v2v_unit_tests.ml
@@ -31,7 +31,9 @@ let inspect_defaults = {
i_root = ""; i_package_format = ""; i_package_management =
"";
i_product_name = ""; i_product_variant = ""; i_mountpoints = [];
i_apps = []; i_apps_map = StringMap.empty; i_firmware = I_BIOS;
- i_windows_systemroot = ""; i_windows_current_control_set = "";
+ i_windows_systemroot = "";
+ i_windows_software_hive = ""; i_windows_system_hive = "";
+ i_windows_current_control_set = "";
}
let test_get_ostype ctx =
--
2.10.2