From d490e6e2a9cb3e421556ed3e50e0665ec955a418 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 20 May 2013 20:18:18 -0500 Subject: [PATCH] verify_dentry(): Allow multiple DOS names per inode (for UDF) --- include/wimlib/dentry.h | 5 ++++- src/ntfs-3g_apply.c | 3 ++- src/verify.c | 8 ++++++++ src/win32_apply.c | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/wimlib/dentry.h b/include/wimlib/dentry.h index e515abec..3b0de793 100644 --- a/include/wimlib/dentry.h +++ b/include/wimlib/dentry.h @@ -157,10 +157,13 @@ struct wim_dentry { /* Does this dentry need to be extracted? */ u8 needs_extraction : 1; + u8 not_extracted : 1; + /* Only used during NTFS capture */ u8 is_win32_name : 1; - u8 not_extracted : 1; + /* Set to 1 if an inode has multiple DOS names. */ + u8 dos_name_invalid : 1; /* Temporary list */ struct list_head tmp_list; diff --git a/src/ntfs-3g_apply.c b/src/ntfs-3g_apply.c index ffe3a8b0..0de2bb04 100644 --- a/src/ntfs-3g_apply.c +++ b/src/ntfs-3g_apply.c @@ -458,7 +458,8 @@ do_apply_dentry_ntfs(struct wim_dentry *dentry, ntfs_inode *dir_ni, } /* Set DOS (short) name if given */ - if (dentry_has_short_name(dentry)) { + if (dentry_has_short_name(dentry) && !dentry->dos_name_invalid) + { char *short_name_mbs; size_t short_name_mbs_nbytes; ret = utf16le_to_tstr(dentry->short_name, diff --git a/src/verify.c b/src/verify.c index 56e77ef7..a4be1f8b 100644 --- a/src/verify.c +++ b/src/verify.c @@ -104,11 +104,19 @@ verify_inode(struct wim_inode *inode, const WIMStruct *w) inode_for_each_dentry(dentry, inode) { if (dentry_has_short_name(dentry)) { if (dentry_with_dos_name) { + /* This was previously an error, but if we + * capture a WIM from UDF on Windows, hard links + * are supported but DOS names are automatically + * generated for all names for an inode. */ + #if 0 ERROR("Hard-linked file has a DOS name at " "both `%"TS"' and `%"TS"'", dentry_full_path(dentry_with_dos_name), dentry_full_path(dentry)); return WIMLIB_ERR_INVALID_DENTRY; + #else + dentry->dos_name_invalid = 1; + #endif } dentry_with_dos_name = dentry; } diff --git a/src/win32_apply.c b/src/win32_apply.c index 972224ef..f022e1d0 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -734,7 +734,7 @@ win32_finish_extract_stream(HANDLE h, const struct wim_dentry *dentry, return ret; } - if (dentry_has_short_name(dentry)) + if (dentry_has_short_name(dentry) && !dentry->dos_name_invalid) SetFileShortNameW(h, dentry->short_name); else if (running_on_windows_7_or_later()) SetFileShortNameW(h, L""); -- 2.43.0