+xml_delete_image(struct wim_xml_info *info, int image)
+{
+ 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)