Windows: Add folder to DLL search

This makes python look into the `bin` folder when searching for DLLs before
it trys C:\Windows or C:\Windows\system32 and potentially finds other versions of DLLs

Fixes #8968
This commit is contained in:
Philipp Hörist 2018-10-22 22:57:37 +02:00
parent 6b63d91fb6
commit 060332e319
1 changed files with 9 additions and 4 deletions

View File

@ -87,10 +87,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
Py_FrozenFlag = 1;
Py_Initialize();
PySys_SetArgvEx(__argc, szArglist, 0);
result = PyRun_SimpleString("import sys; import os;"
"sys.frozen=True;"
"from gajim import gajim;"
"gajim.main();");
result = PyRun_SimpleString(
"import sys; import os;"
"sys.frozen=True;"
"from pathlib import Path;"
"root_path = Path(sys.executable).parents[1];"
"from ctypes import windll;"
"windll.kernel32.SetDllDirectoryW(str(root_path / 'bin'));"
"from gajim import gajim;"
"gajim.main();");
Py_Finalize();
return result;
}