- /* Add \??\ prefix to form the NT namespace path. */
- wmemcpy(path, L"\\??\\", 4);
- path_nchars = dret + 4;
-
- /* Strip trailing slashes. If we don't do this, we may create a path
- * with multiple consecutive backslashes, which for some reason causes
- * Windows to report that the file cannot be found. */
- while (unlikely(path[path_nchars - 1] == L'\\' &&
- path[path_nchars - 2] != L':'))
- path[--path_nchars] = L'\0';
+ params->capture_root_nchars = ntpath.Length / sizeof(wchar_t);
+ wmemcpy(path, ntpath.Buffer, params->capture_root_nchars);
+ path[params->capture_root_nchars] = L'\0';