• Michael Stahl's avatar
    tdf#109241 desktop: Win32: prepend "program" dir to $PATH · 9990e98d
    Michael Stahl yazdı
    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
    9990e98d
Adı
Son kayıt (commit)
Son güncelleme
..
QuickStart Loading commit data...
applauncher Loading commit data...
guiloader Loading commit data...
guistdio Loading commit data...
officeloader Loading commit data...
loader.cxx Loading commit data...
loader.hxx Loading commit data...
unoinfo.cxx Loading commit data...