X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fdentry.c;h=7f418539a0e932ebfa9b4d96b652d6a87b4030df;hb=751a849fe04a9230a661e38429ff4d971f74bdbf;hp=c389652ea157e6d6bc3ee1cee3a9aa7d4daaa9d3;hpb=885632f08c75c1d7bb5d25436231c78f6ad7e0c0;p=wimlib diff --git a/src/dentry.c b/src/dentry.c index c389652e..7f418539 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -32,6 +32,7 @@ #include "io.h" #include "timestamp.h" #include "lookup_table.h" +#include "sha1.h" #include #include @@ -311,10 +312,12 @@ int print_dentry_full_path(struct dentry *dentry, void *ignore) int print_dentry(struct dentry *dentry, void *lookup_table) { struct lookup_table_entry *lte; - + printf("[DENTRY]\n"); printf("Length = %"PRIu64"\n", dentry->length); printf("Attributes = 0x%x\n", dentry->attributes); - /*printf("Security ID = %d\n", dentry->security_id);*/ +#ifdef ENABLE_SECURITY_DATA + printf("Security ID = %d\n", dentry->security_id); +#endif printf("Subdir offset = %"PRIu64"\n", dentry->subdir_offset); /*printf("Unused1 = %"PRIu64"\n", dentry->unused1);*/ /*printf("Unused2 = %"PRIu64"\n", dentry->unused2);*/ @@ -355,8 +358,9 @@ static inline void dentry_common_init(struct dentry *dentry) { memset(dentry, 0, sizeof(struct dentry)); dentry->refcnt = 1; - /* We are currently ignoring the security data. */ - /*dentry->security_id = -1;*/ +#ifdef ENABLE_SECURITY_DATA + dentry->security_id = -1; +#endif } /* @@ -634,8 +638,11 @@ int read_dentry(const u8 metadata_resource[], u64 metadata_resource_len, } p = get_u32(p, &dentry->attributes); - /* Currently ignoring security ID. */ +#ifdef ENABLE_SECURITY_DATA + p = get_u32(p, &dentry->security_id); +#else p += sizeof(u32); +#endif p = get_u64(p, &dentry->subdir_offset); /* 2 unused fields */ @@ -733,14 +740,22 @@ static u8 *write_dentry(const struct dentry *dentry, u8 *p) memset(p, 0, dentry->length); p = put_u64(p, dentry->length); p = put_u32(p, dentry->attributes); - p = put_u32(p, (u32)(-1)); /* security id */ +#ifdef ENABLE_SECURITY_DATA + p = put_u32(p, dentry->security_id); +#else + p = put_u32(p, (u32)(-1)); +#endif p = put_u64(p, dentry->subdir_offset); p = put_u64(p, 0); /* unused1 */ p = put_u64(p, 0); /* unused2 */ p = put_u64(p, dentry->creation_time); p = put_u64(p, dentry->last_access_time); p = put_u64(p, dentry->last_write_time); - p = put_bytes(p, WIM_HASH_SIZE, dentry->hash); + if (!is_empty_file_hash(dentry->hash)) + memcpy(p, dentry->hash, WIM_HASH_SIZE); + else + printf("zero hash for %s\n", dentry->file_name_utf8); + p += WIM_HASH_SIZE; p = put_u32(p, 0); /* reparse_tag */ p = put_u64(p, dentry->hard_link); p = put_u16(p, 0); /*streams */