fix(windows): fix dependencies check on windows (#4076)

This commit is contained in:
Darío Kondratiuk 2020-10-08 13:45:53 -03:00 committed by GitHub
parent 08024c82e8
commit ff295d10e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -1 +1 @@
1001 1002

View file

@ -76,7 +76,7 @@ const DepsMap getDependencies(const HMODULE hMod)
{ {
LPCSTR dllName = (LPCSTR)((BYTE*)hMod + pImportDesc->Name); LPCSTR dllName = (LPCSTR)((BYTE*)hMod + pImportDesc->Name);
std::string dllPath = "not found"; std::string dllPath = "not found";
HMODULE hModDep = LoadLibraryEx(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES); HMODULE hModDep = LoadLibraryEx(dllName, NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hModDep != NULL) if (hModDep != NULL)
{ {
TCHAR pathBuffer[_MAX_PATH]; TCHAR pathBuffer[_MAX_PATH];
@ -96,7 +96,8 @@ const DepsMap getDependencies(const HMODULE hMod)
int printDependencies(const char* library) 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) if (hMod == NULL)
{ {
std::cerr << "Failed to load " << library << " Error: " << getLastErrorString() << std::endl; std::cerr << "Failed to load " << library << " Error: " << getLastErrorString() << std::endl;