X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwin32_common.c;h=d380e8283f6c96ad68c9479375327baaa90d5db6;hb=337c5372b2c013ddd73e93bc96feaf5dfe6266d9;hp=412421ea28ce1480cb56bcea651c2b6896e038e4;hpb=aae154ad67444bc760bedff60bc60fd5b91b8ede;p=wimlib diff --git a/src/win32_common.c b/src/win32_common.c index 412421ea..d380e828 100644 --- a/src/win32_common.c +++ b/src/win32_common.c @@ -484,20 +484,8 @@ NTSTATUS (WINAPI *func_RtlDosPathNameToNtPathName_U_WithStatus) NTSTATUS (WINAPI *func_RtlCreateSystemVolumeInformationFolder) (PCUNICODE_STRING VolumeRootPath); -static OSVERSIONINFO windows_version_info = { - .dwOSVersionInfoSize = sizeof(OSVERSIONINFO), -}; - static bool acquired_privileges = false; -bool -windows_version_is_at_least(unsigned major, unsigned minor) -{ - return windows_version_info.dwMajorVersion > major || - (windows_version_info.dwMajorVersion == major && - windows_version_info.dwMinorVersion >= minor); -} - struct dll_sym { void **func_ptr; const char *name; @@ -599,9 +587,6 @@ win32_global_init(int init_flags) acquired_privileges = true; } - /* Get Windows version information. */ - GetVersionEx(&windows_version_info); - ret = init_dll(&ntdll_spec); if (ret) goto out_drop_privs; @@ -660,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__ */