+ xmlNode *next_image;
+ xmlAttr *index_attr, *next_index_attr;
+
+ /* Free the IMAGE element for the deleted image. Then, shift all
+ * higher-indexed IMAGE elements down by 1, in the process re-assigning
+ * their INDEX attributes. */
+
+ next_image = info->images[image - 1];
+ next_index_attr = unlink_index_attribute(next_image);
+ unlink_and_free_tree(next_image);
+
+ while (image < info->image_count) {
+ index_attr = next_index_attr;
+ next_image = info->images[image];
+ next_index_attr = unlink_index_attribute(next_image);
+ xmlAddChild(next_image, (xmlNode *)index_attr);
+ info->images[image - 1] = next_image;
+ image++;
+ }
+
+ xmlFreeProp(next_index_attr);
+ info->image_count--;
+}
+
+/* Architecture constants are from w64 mingw winnt.h */
+#define PROCESSOR_ARCHITECTURE_INTEL 0
+#define PROCESSOR_ARCHITECTURE_MIPS 1
+#define PROCESSOR_ARCHITECTURE_ALPHA 2
+#define PROCESSOR_ARCHITECTURE_PPC 3
+#define PROCESSOR_ARCHITECTURE_SHX 4
+#define PROCESSOR_ARCHITECTURE_ARM 5
+#define PROCESSOR_ARCHITECTURE_IA64 6
+#define PROCESSOR_ARCHITECTURE_ALPHA64 7
+#define PROCESSOR_ARCHITECTURE_MSIL 8
+#define PROCESSOR_ARCHITECTURE_AMD64 9
+#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
+#define PROCESSOR_ARCHITECTURE_ARM64 12
+
+static const tchar *
+describe_arch(u64 arch)
+{
+ static const tchar * const descriptions[] = {
+ [PROCESSOR_ARCHITECTURE_INTEL] = T("x86"),
+ [PROCESSOR_ARCHITECTURE_MIPS] = T("MIPS"),
+ [PROCESSOR_ARCHITECTURE_ARM] = T("ARM"),
+ [PROCESSOR_ARCHITECTURE_IA64] = T("ia64"),
+ [PROCESSOR_ARCHITECTURE_AMD64] = T("x86_64"),
+ [PROCESSOR_ARCHITECTURE_ARM64] = T("ARM64"),
+ };
+
+ if (arch < ARRAY_LEN(descriptions) && descriptions[arch] != NULL)
+ return descriptions[arch];
+
+ return T("unknown");
+}
+
+/* Print information from the WINDOWS element, if present. */
+static void
+print_windows_info(struct wim_xml_info *info, xmlNode *image_node)
+{
+ xmlNode *windows_node;
+ xmlNode *langs_node;
+ xmlNode *version_node;
+ const tchar *text;
+
+ windows_node = xml_get_node_by_path(image_node, "WINDOWS");
+ if (!windows_node)
+ return;
+
+ tprintf(T("Architecture: %"TS"\n"),
+ describe_arch(xml_get_number_by_path(windows_node, "ARCH")));
+
+ text = xml_get_ttext_by_path(info, windows_node, "PRODUCTNAME");
+ if (text)
+ tprintf(T("Product Name: %"TS"\n"), text);
+
+ text = xml_get_ttext_by_path(info, windows_node, "EDITIONID");
+ if (text)
+ tprintf(T("Edition ID: %"TS"\n"), text);
+
+ text = xml_get_ttext_by_path(info, windows_node, "INSTALLATIONTYPE");
+ if (text)
+ tprintf(T("Installation Type: %"TS"\n"), text);
+
+ text = xml_get_ttext_by_path(info, windows_node, "HAL");
+ if (text)
+ tprintf(T("HAL: %"TS"\n"), text);