- /* Undocumented padding between file name and short name. This probably
- * is supposed to be a terminating null character. */
- p += 2;
-
- /* Read the short filename. */
- short_name = MALLOC(short_name_len);
- if (!short_name) {
- ERROR("Failed to allocate %hu bytes for short filename",
- short_name_len);
- ret = WIMLIB_ERR_NOMEM;
- goto out_free_file_name_utf8;
+ /* Align the calculated size */
+ calculated_size = (calculated_size + 7) & ~7;
+
+ if (dentry->length > calculated_size) {
+ /* Weird; the dentry says it's longer than it should be. Note
+ * that the length field does NOT include the size of the
+ * alternate stream entries. */
+
+ /* Strangely, some directory entries inexplicably have a little
+ * over 70 bytes of extra data. The exact amount of data seems
+ * to be 72 bytes, but it is aligned on the next 8-byte
+ * boundary. It does NOT seem to be alternate data stream
+ * entries. Here's an example of the aligned data:
+ *
+ * 01000000 40000000 6c786bba c58ede11 b0bb0026 1870892a b6adb76f
+ * e63a3e46 8fca8653 0d2effa1 6c786bba c58ede11 b0bb0026 1870892a
+ * 00000000 00000000 00000000 00000000
+ *
+ * Here's one interpretation of how the data is laid out.
+ *
+ * struct unknown {
+ * u32 field1; (always 0x00000001)
+ * u32 field2; (always 0x40000000)
+ * u8 data[48]; (???)
+ * u64 reserved1; (always 0)
+ * u64 reserved2; (always 0)
+ * };*/
+ WARNING("Dentry for file or directory `%s' has %zu extra "
+ "bytes of data",
+ file_name_utf8, dentry->length - calculated_size);