- if (dentry == ctx->extract_root || dentry->extraction_skipped)
- return 0;
-
- if (!dentry_is_supported(dentry, &ctx->supported_features))
- goto skip_dentry;
-
- 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__
- if (!ctx->ops->supports_case_sensitive_filenames)
- {
- struct wim_dentry *other;
- list_for_each_entry(other, &dentry->case_insensitive_conflict_list,
- case_insensitive_conflict_list)
- {
- if (ctx->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;
- }
- }
- }
-#else /* __WIN32__ */
- wimlib_assert(ctx->ops->supports_case_sensitive_filenames);
-#endif /* !__WIN32__ */
-
- 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 (ctx->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;
- }
- }
-
-out_replace:
- {
- utf16lechar utf16_name_copy[dentry->file_name_nbytes / 2];
-
- memcpy(utf16_name_copy, dentry->file_name, dentry->file_name_nbytes);
- file_name_valid(utf16_name_copy, dentry->file_name_nbytes / 2, true);
-
- tchar *tchar_name;
- size_t tchar_nchars;
- #ifdef __WIN32__
- tchar_name = utf16_name_copy;
- tchar_nchars = dentry->file_name_nbytes / 2;
- #else
- ret = utf16le_to_tstr(utf16_name_copy,
- dentry->file_name_nbytes,
- &tchar_name, &tchar_nchars);