+ /* Work around defective behavior in Windows where paths longer than 260
+ * characters are not supported by default; instead they need to be
+ * turned into absolute paths and prefixed with "\\?\". */
+
+ if (wcsncmp(root_disk_path, L"\\\\?\\", 4)) {
+ dret = GetFullPathName(root_disk_path, WINDOWS_NT_MAX_PATH - 4,
+ &path[4], NULL);
+
+ if (dret == 0 || dret >= WINDOWS_NT_MAX_PATH - 4) {
+ WARNING("Can't get full path name for \"%ls\"", root_disk_path);
+ wmemcpy(path, root_disk_path, path_nchars + 1);
+ } else {
+ wmemcpy(path, L"\\\\?\\", 4);
+ path_nchars = 4 + dret;
+ /* Update pattern prefix */
+ if (params->config != NULL)
+ {
+ params->config->_prefix = TSTRDUP(path);
+ params->config->_prefix_num_tchars = path_nchars;
+ if (params->config->_prefix == NULL)
+ {
+ ret = WIMLIB_ERR_NOMEM;
+ goto out_free_path;
+ }
+ need_prefix_free = true;
+ }
+ }
+ } else {
+ wmemcpy(path, root_disk_path, path_nchars + 1);
+ }