browser(winldd): attempt to fix dependency loading on windows (#7790)

References #7560
This commit is contained in:
Andrey Lushnikov 2021-07-22 16:39:14 +03:00 committed by GitHub
parent ff8bd0fef2
commit c1d6c4b25e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -1 +1 @@
1004
1005

View file

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