From 4d1154c806f46d44166278f52197e72df1ca3150 Mon Sep 17 00:00:00 2001 From: Mark Young Date: Tue, 16 May 2017 09:48:55 -0600 Subject: loader: Expand error message info Expand loader_platform_open_library_error on Windows to include the error message from GetLastError(); Also, modify the loading of the layer library to use the loader_platform_open_library_error message sincce we want to get as much error information in that as possible. And fix a typo in a comment. Change-Id: I1ef5ede8c6716c4624b31ddb3b32b83392920a6c --- loader/loader.c | 2 +- loader/vk_loader_platform.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/loader/loader.c b/loader/loader.c index 5b61f573..72c7df2b 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -3960,7 +3960,7 @@ struct loader_instance *loader_get_instance(const VkInstance instance) { static loader_platform_dl_handle loader_open_layer_lib(const struct loader_instance *inst, const char *chain_type, struct loader_layer_properties *prop) { if ((prop->lib_handle = loader_platform_open_library(prop->lib_name)) == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_open_layer_lib: Failed to open library %s", prop->lib_name); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, loader_platform_open_library_error(prop->lib_name)); } else { loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Loading layer library %s", prop->lib_name); } diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index 8b82fe80..40656534 100644 --- a/loader/vk_loader_platform.h +++ b/loader/vk_loader_platform.h @@ -246,14 +246,14 @@ static loader_platform_dl_handle loader_platform_open_library(const char *lib_pa // 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 that failed, then try loading it with broarder search folders. + // 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); } return lib_handle; } static char *loader_platform_open_library_error(const char *libPath) { static char errorMsg[164]; - (void)snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\"", libPath); + (void)snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\" with error %d", libPath, GetLastError()); return errorMsg; } static void loader_platform_close_library(loader_platform_dl_handle library) { FreeLibrary(library); } -- cgit v1.2.3