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

@ -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;