]> wimlib.net Git - wimlib/blobdiff - src/integrity.c
Rewritten functions for reading and writing resources
[wimlib] / src / integrity.c
index e310716130bfa79084a0a6b789286d623441a8c6..12968bf91004a0b2e54d6b59c677c5e8c5f261c2 100644 (file)
@@ -135,11 +135,14 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status)
                *status = WIM_INTEGRITY_NONEXISTENT;
                return 0;
        }
                *status = WIM_INTEGRITY_NONEXISTENT;
                return 0;
        }
-       ctype = wim_resource_compression_type(w, res_entry);
        if (res_entry->original_size < 12) {
                ERROR("Integrity table is too short");
                return WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
        }
        if (res_entry->original_size < 12) {
                ERROR("Integrity table is too short");
                return WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
        }
+       if (res_entry->flags & WIM_RESHDR_FLAG_COMPRESSED) {
+               ERROR("Didn't expect a compressed integrity table");
+               return WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
+       }
 
        /* Read the integrity table into memory. */
        buf = MALLOC(res_entry->original_size);
 
        /* Read the integrity table into memory. */
        buf = MALLOC(res_entry->original_size);
@@ -149,15 +152,14 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status)
                ret = WIMLIB_ERR_NOMEM;
                goto out;
        }
                ret = WIMLIB_ERR_NOMEM;
                goto out;
        }
-       ret = read_full_resource(w->fp, res_entry->size,
-                                res_entry->original_size,
-                                res_entry->offset, ctype, buf);
+       ret = read_uncompressed_resource(w->fp, res_entry->offset,
+                                        res_entry->original_size, buf);
        if (ret != 0) {
                ERROR("Failed to read integrity table (size = %"PRIu64", "
                      "original_size = %"PRIu64", offset = "
        if (ret != 0) {
                ERROR("Failed to read integrity table (size = %"PRIu64", "
                      "original_size = %"PRIu64", offset = "
-                     "%"PRIu64", ctype = %d",
+                     "%"PRIu64")",
                      (u64)res_entry->size, res_entry->original_size,
                      (u64)res_entry->size, res_entry->original_size,
-                     res_entry->offset, ctype);
+                     res_entry->offset);
                goto out;
        }
 
                goto out;
        }