#include "io.h"
#include "timestamp.h"
#include "lookup_table.h"
+#include "sha1.h"
#include <unistd.h>
#include <sys/stat.h>
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);*/
{
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
}
/*
}
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 */
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 */