aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlawomir Cygan <slawomir.cygan@intel.com>2018-01-24 15:34:15 +0100
committerLenny Komow <lenny@lunarg.com>2018-02-12 13:23:57 -0700
commita20eae453a1eb8ac4364ea180b7c790f3eb3012f (patch)
treec49360a1084d909cd366d376c1c1b7c1bb5c34d8
parent424772b097dfbca44b20af92c77f6c0edfd37af4 (diff)
downloadusermoji-a20eae453a1eb8ac4364ea180b7c790f3eb3012f.tar.xz
loader: remove references to shlwapi.lib
This change improves loader compatibility with Universal Windows drivers[1]: shlwapi.lib is not a part of allowed APIs. It seems PathFileExists call was already redundant as ERROR_MOD_NOT_FOUND was already returned by the loader in cse of wrong dll path. PathIsRelative is replaced by equivalent check. [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/getting-started-with-universal-drivers Change-Id: I36854f38078670ac033e8bd415dbf368391e8448
-rw-r--r--loader/CMakeLists.txt3
-rw-r--r--loader/vk_loader_platform.h12
2 files changed, 11 insertions, 4 deletions
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
index 816e4114..6282bac6 100644
--- a/loader/CMakeLists.txt
+++ b/loader/CMakeLists.txt
@@ -180,10 +180,9 @@ if (WIN32)
# Suppress conflicting libs warning for debug builds.
set_target_properties(${API_LOWERCASE}-${MAJOR} PROPERTIES LINK_FLAGS_DEBUG /ignore:4098)
set_target_properties(VKstatic.${MAJOR} PROPERTIES OUTPUT_NAME VKstatic.${MAJOR})
- target_link_libraries(${API_LOWERCASE}-${MAJOR} shlwapi Cfgmgr32)
+ target_link_libraries(${API_LOWERCASE}-${MAJOR} Cfgmgr32)
add_dependencies(${API_LOWERCASE}-${MAJOR} generate_helper_files loader_gen_files loader_asm_gen_files)
- target_link_libraries(VKstatic.${MAJOR} shlwapi)
if (CMAKE_GENERATOR MATCHES "^Visual Studio.*")
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${API_LOWERCASE}-${MAJOR}.dll COPY_SRC_PATH)
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/../demos/$<CONFIGURATION>/ COPY_DST_PATH)
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index 40de844e..505cb1e2 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -222,7 +222,15 @@ static bool loader_platform_file_exists(const char *path) {
return true;
}
-static bool loader_platform_is_path_absolute(const char *path) { return !PathIsRelative(path); }
+static bool loader_platform_is_path_absolute(const char *path) {
+ if (!path || !*path) {
+ return false;
+ }
+ if (*path == DIRECTORY_SYMBOL || path[1] == ':') {
+ return true;
+ }
+ return false;
+}
// WIN32 runtime doesn't have dirname().
static inline char *loader_platform_dirname(char *path) {
@@ -273,7 +281,7 @@ typedef HMODULE loader_platform_dl_handle;
static loader_platform_dl_handle loader_platform_open_library(const char *lib_path) {
// Try loading the library the original way first.
loader_platform_dl_handle lib_handle = LoadLibrary(lib_path);
- if (lib_handle == NULL && GetLastError() == ERROR_MOD_NOT_FOUND && PathFileExists(lib_path)) {
+ if (lib_handle == NULL && GetLastError() == ERROR_MOD_NOT_FOUND) {
// If that failed, then try loading it with broader search folders.
lib_handle = LoadLibraryEx(lib_path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
}