summaryrefslogtreecommitdiff
path: root/desktop/win32/source/officeloader/officeloader.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-09-01 23:12:05 +0200
committerMichael Stahl <mstahl@redhat.com>2017-09-01 23:55:11 +0200
commit9990e98d67bf14003cde8f0138d2dcfa804406ac (patch)
tree92268a9302f5b3d16c2e1d23ac7f6d06251c0f68 /desktop/win32/source/officeloader/officeloader.cxx
parent5ec9882e650c7c3bb39e8cc90341a844bbd18772 (diff)
tdf#109241 desktop: Win32: prepend "program" dir to $PATH
The problem is that python modules (*.pyd) find DLLs in the wrong places. This is because sal_detail_initialize() calls SetDllDirectoryW(""), which removes (sometimes?) the "current directory" from the DLL search order, which is deliberately initialized to the "program" dir by CreateProcess() calls in officewrapper.cxx. Loading DLLs still works for LO's own DLLs since they are all in the "program" directory, which is the same directory where all the executables are, so it is searched first. But CPython loads its modules with LOAD_WITH_ALTERED_SEARCH_PATH, which doesn't search the directory of the executable but the directory of the immediately loaded DLL i.e. the *.pyd file instead, i.e. python-core-X.Y.Z/lib. It would be possible to call SetDllDirectory(".../program") instead but probably that would require patching python since it needs to be done in the real exectuable, not in the wrapper executable. So overwrite the $PATH again (like was done in the days of the office of the holy trinity) in the officewrapper.cxx and genericloader.cxx to prepend "program" and get priority over the rest of $PATH. This still doesn't protect against C:/Windows/System32/LIBEAY32.DLL since that has higher priority than $PATH but hopefully nobody is *that* stupid. This patch fixes soffice.exe, swriter.exe etc., and unopkg.exe. The python.exe wrapper already prepends "program" to $PATH. Change-Id: If03f07eba9a2c7fc6cf44f82f639b5d0b4c62e20
Diffstat (limited to 'desktop/win32/source/officeloader/officeloader.cxx')
-rw-r--r--desktop/win32/source/officeloader/officeloader.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx
index 935cc7e42bb8..78c4bc1bfcec 100644
--- a/desktop/win32/source/officeloader/officeloader.cxx
+++ b/desktop/win32/source/officeloader/officeloader.cxx
@@ -62,7 +62,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
TCHAR szIniDirectory[MAX_PATH];
STARTUPINFO aStartupInfo;
- desktop_win32::getPaths(szTargetFileName, szIniDirectory);
+ desktop_win32::extendLoaderEnvironment(szTargetFileName, szIniDirectory);
ZeroMemory( &aStartupInfo, sizeof(aStartupInfo) );
aStartupInfo.cb = sizeof(aStartupInfo);