- struct lookup_table_entry *lte;
-
- lte = dentry_first_lte(dentry, w->lookup_table);
-
- if ((extract_flags & (WIMLIB_EXTRACT_FLAG_SYMLINK |
- WIMLIB_EXTRACT_FLAG_HARDLINK)) && lte) {
- if (lte->out_refcnt++ != 0)
- return extract_regular_file_linked(dentry, output_dir,
- output_path,
- extract_flags, lte);
- lte->file_on_disk = STRDUP(output_path);
- if (!lte->file_on_disk)
- return WIMLIB_ERR_NOMEM;
+ struct apply_args *args = _args;
+ int ret;
+
+ dentry->needs_extraction = 1;
+
+ if (dentry == args->extract_root)
+ return 0;
+
+ if (dentry_is_dot_or_dotdot(dentry)) {
+ /* WIM files shouldn't contain . or .. entries. But if they are
+ * there, don't attempt to extract them. */
+ WARNING("Skipping extraction of unexpected . or .. file \"%"TS"\"",
+ dentry_full_path(dentry));
+ goto skip_dentry;
+ }
+
+#ifdef __WIN32__
+ struct wim_dentry *other;
+ list_for_each_entry(other, &dentry->case_insensitive_conflict_list,
+ case_insensitive_conflict_list)
+ {
+ if (other->needs_extraction) {
+ if (args->extract_flags & WIMLIB_EXTRACT_FLAG_ALL_CASE_CONFLICTS)
+ {
+ WARNING("\"%"TS"\" has the same case-insensitive "
+ "name as \"%"TS"\"; extracting dummy name instead",
+ dentry_full_path(dentry),
+ dentry_full_path(other));
+ goto out_replace;
+ } else {
+ WARNING("Not extracting \"%"TS"\": has same case-insensitive "
+ "name as \"%"TS"\"",
+ dentry_full_path(dentry),
+ dentry_full_path(other));
+ goto skip_dentry;
+ }
+ }
+ }
+#endif
+
+ if (file_name_valid(dentry->file_name, dentry->file_name_nbytes / 2, false)) {
+#ifdef __WIN32__
+ dentry->extraction_name = dentry->file_name;
+ dentry->extraction_name_nchars = dentry->file_name_nbytes / 2;
+ return 0;
+#else
+ return utf16le_to_tstr(dentry->file_name,
+ dentry->file_name_nbytes,
+ &dentry->extraction_name,
+ &dentry->extraction_name_nchars);
+#endif
+ } else {
+ if (args->extract_flags & WIMLIB_EXTRACT_FLAG_REPLACE_INVALID_FILENAMES)
+ {
+ WARNING("\"%"TS"\" has an invalid filename "
+ "that is not supported on this platform; "
+ "extracting dummy name instead",
+ dentry_full_path(dentry));
+ goto out_replace;
+ } else {
+ WARNING("Not extracting \"%"TS"\": has an invalid filename "
+ "that is not supported on this platform",
+ dentry_full_path(dentry));
+ goto skip_dentry;
+ }