]> wimlib.net Git - wimlib/blobdiff - src/wimboot.c
Fix slow progress updating for wimsplit
[wimlib] / src / wimboot.c
index 740db91af75f3c62fa5d54e7dae0af5244d6f2d5..47c4d3a4de40f23154ec7154cfda71ffd5152024 100644 (file)
@@ -7,7 +7,7 @@
  * information about WIMBoot.
  *
  * Note that WIMBoot pointer files are actually implemented on top of the
- * Windows Overlay File System Filter (WOF).  See wof.h for more info.
+ * Windows Overlay Filesystem filter (WOF).  See wof.h for more info.
  */
 
 /*
@@ -511,6 +511,21 @@ prepare_wimoverlay_dat(const struct WimOverlay_dat_header *old_hdr,
        return 0;
 }
 
+static bool
+valid_wim_filename(const struct WimOverlay_dat_entry_2 *entry, size_t name_len)
+{
+       size_t i;
+
+       if (name_len % sizeof(wchar_t))
+               return false;
+       name_len /= sizeof(wchar_t);
+       if (name_len < 2)
+               return false;
+       for (i = 0; i < name_len && entry->wim_file_name[i] != 0; i++)
+               ;
+       return i == name_len - 1;
+}
+
 /*
  * Reads and validates a WimOverlay.dat file.
  *
@@ -686,13 +701,7 @@ retry:
 
                wim_file_name_length = entry_1->entry_2_length -
                                        sizeof(struct WimOverlay_dat_entry_2);
-               if ((wim_file_name_length < 2 * sizeof(wchar_t)) ||
-                   (wim_file_name_length % sizeof(wchar_t) != 0) ||
-                   (wmemchr(entry_2->wim_file_name, L'\0',
-                            wim_file_name_length / sizeof(wchar_t))
-                    != &entry_2->wim_file_name[wim_file_name_length /
-                                               sizeof(wchar_t) - 1]))
-               {
+               if (!valid_wim_filename(entry_2, wim_file_name_length)) {
                        ERROR("\"%ls\": entry %"PRIu32" (2) "
                              "(data source ID 0x%016"PRIx64") "
                              "has invalid WIM file name",
@@ -974,15 +983,7 @@ out_free_in:
        FREE(in);
 out:
        if (ret == WIMLIB_ERR_UNSUPPORTED) {
-       #if 0
-               WARNING(
-               "The version of Windows you are running does not appear to support\n"
-               "        the Windows Overlay File System Filter Driver.  This is normally\n"
-               "        available on Windows 8.1 Update 1 or later.  Therefore, wimlib\n"
-               "        will attempt to update the WimOverlay.dat file directly.\n");
-       #else
                WARNING("WOF driver is not available; updating WimOverlay.dat directly.");
-       #endif
                ret = update_wimoverlay_manually(drive_path + 4, wim_path,
                                                 wim_guid, image,
                                                 data_source_id_ret);