X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwin32_common.c;h=d380e8283f6c96ad68c9479375327baaa90d5db6;hp=48e2146855278122048f6e3be789a42240572d3c;hb=965c28d0cce2e43df3c38b47c78204b1c33c313d;hpb=969809ef646ec6ceb9730da2eb21884feaff994d diff --git a/src/win32_common.c b/src/win32_common.c index 48e21468..d380e828 100644 --- a/src/win32_common.c +++ b/src/win32_common.c @@ -645,4 +645,25 @@ win32_path_to_nt_path(const wchar_t *win32_path, UNICODE_STRING *nt_path) return WIMLIB_ERR_INVALID_PARAM; } +int +win32_get_drive_path(const wchar_t *file_path, wchar_t drive_path[7]) +{ + tchar *file_abspath; + + file_abspath = realpath(file_path, NULL); + if (!file_abspath) + return WIMLIB_ERR_NOMEM; + + if (file_abspath[0] == L'\0' || file_abspath[1] != L':') { + ERROR("\"%ls\": Path format not recognized", file_abspath); + FREE(file_abspath); + return WIMLIB_ERR_UNSUPPORTED; + } + + wsprintf(drive_path, L"\\\\.\\%lc:", file_abspath[0]); + FREE(file_abspath); + return 0; +} + + #endif /* __WIN32__ */