mirror of
https://gitee.com/openharmony/third_party_vulkan-loader
synced 2024-11-23 15:20:52 +00:00
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
This commit is contained in:
parent
4a07c6ea84
commit
fe80c2a1c1
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user