/*
* Copyright (C) 2013, 2014 Eric Biggers
*
- * This file is part of wimlib, a library for working with WIM files.
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option) any
+ * later version.
*
- * wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 3 of the License, or (at your option)
- * any later version.
- *
- * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
- * You should have received a copy of the GNU General Public License
- * along with wimlib; if not, see http://www.gnu.org/licenses/.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this file; if not, see http://www.gnu.org/licenses/.
*/
#ifdef __WIN32__
#include <errno.h>
#include "wimlib/win32_common.h"
+
#include "wimlib/error.h"
#include "wimlib/util.h"
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;
acquired_privileges = true;
}
- /* Get Windows version information. */
- GetVersionEx(&windows_version_info);
-
ret = init_dll(&ntdll_spec);
if (ret)
goto out_drop_privs;
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__ */