]> wimlib.net Git - wimlib/blobdiff - src/xml.c
Return new error code when trying to open encrypted WIM
[wimlib] / src / xml.c
index 920eeeb5e1194db05f90a1c88a0d61ed607fbd4e..cafc14f4788cda5722cba8e837d2ce33ce097db5 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -566,6 +566,16 @@ xml_read_wim_info(const xmlNode *wim_node, struct wim_info **wim_info_ret)
                                i++;
                        } else if (node_name_is(child, "TOTALBYTES")) {
                                wim_info->total_bytes = node_get_u64(child);
+                       } else if (node_name_is(child, "ESD")) {
+                               xmlNode *esdchild;
+                               for_node_child(child, esdchild) {
+                                       if (node_is_element(esdchild) &&
+                                           node_name_is(esdchild, "ENCRYPTED"))
+                                       {
+                                               ret = WIMLIB_ERR_WIM_IS_ENCRYPTED;
+                                               goto err;
+                                       }
+                               }
                        }
                }
 
@@ -690,7 +700,7 @@ xml_write_strings_from_specs(xmlTextWriter *writer,
        for (size_t i = 0; i < num_specs; i++) {
                int rc = xml_write_string(writer, specs[i].name,
                                      *(const tchar * const *)
-                                       (struct_with_strings + specs[i].offset));
+                                       (struct_with_strings + specs[i].offset));
                if (rc)
                        return rc;
        }
@@ -1092,7 +1102,6 @@ xml_get_max_image_name_len(const WIMStruct *wim)
        return max_len;
 }
 
-#ifdef ENABLE_CUSTOM_MEMORY_ALLOCATOR
 void
 xml_set_memory_allocator(void *(*malloc_func)(size_t),
                         void (*free_func)(void *),
@@ -1100,7 +1109,6 @@ xml_set_memory_allocator(void *(*malloc_func)(size_t),
 {
        xmlMemSetup(free_func, malloc_func, realloc_func, STRDUP);
 }
-#endif
 
 static int
 calculate_dentry_statistics(struct wim_dentry *dentry, void *arg)
@@ -1521,8 +1529,7 @@ write_wim_xml_data(WIMStruct *wim, int image, u64 total_bytes,
                                             0,
                                             out_reshdr,
                                             NULL,
-                                            write_resource_flags,
-                                            &wim->lzx_context);
+                                            write_resource_flags);
        FREE(xml_data);
        DEBUG("ret=%d", ret);
        return ret;