From ff295d10e659ff3dfc34133dff4788498e4559f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Kondratiuk?= Date: Thu, 8 Oct 2020 13:45:53 -0300 Subject: [PATCH] fix(windows): fix dependencies check on windows (#4076) --- browser_patches/winldd/BUILD_NUMBER | 2 +- browser_patches/winldd/PrintDeps.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/browser_patches/winldd/BUILD_NUMBER b/browser_patches/winldd/BUILD_NUMBER index dd11724042..7d802a3e71 100644 --- a/browser_patches/winldd/BUILD_NUMBER +++ b/browser_patches/winldd/BUILD_NUMBER @@ -1 +1 @@ -1001 +1002 diff --git a/browser_patches/winldd/PrintDeps.cpp b/browser_patches/winldd/PrintDeps.cpp index f7d68a08c6..e7e15e5ece 100644 --- a/browser_patches/winldd/PrintDeps.cpp +++ b/browser_patches/winldd/PrintDeps.cpp @@ -75,8 +75,8 @@ const DepsMap getDependencies(const HMODULE hMod) while (pImportDesc->Name) { LPCSTR dllName = (LPCSTR)((BYTE*)hMod + pImportDesc->Name); - std::string dllPath = "not found"; - HMODULE hModDep = LoadLibraryEx(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES); + std::string dllPath = "not found"; + HMODULE hModDep = LoadLibraryEx(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_LIBRARY_SEARCH_SYSTEM32); if (hModDep != NULL) { TCHAR pathBuffer[_MAX_PATH]; @@ -95,8 +95,9 @@ const DepsMap getDependencies(const HMODULE hMod) } int printDependencies(const char* library) -{ - HMODULE hMod = LoadLibraryEx(library, NULL, DONT_RESOLVE_DLL_REFERENCES); +{ + SetDllDirectoryA("."); + HMODULE hMod = LoadLibraryEx(library, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_LIBRARY_SEARCH_SYSTEM32); if (hMod == NULL) { std::cerr << "Failed to load " << library << " Error: " << getLastErrorString() << std::endl;