summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-26 13:45:01 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-26 13:52:33 +0100
commitfe459b9595c851d00a861d595c8dd50b35c90be3 (patch)
treef324c79d15cfc2ea4db1778394e02cf592ecd714 /vcl
parent6d553405101090ef7a7ff5270e5ef32aa41bd9b3 (diff)
Fall back to old bootstrap.ini [Win32] section, for backwards compatibility
Change-Id: I629b2a16bc889f16595cd1718d2ee4535f31aed7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162602 Tested-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/window/salframe.cxx39
1 files changed, 38 insertions, 1 deletions
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index ccc4ed70df75..ea55cae92a89 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -33,6 +33,12 @@
#include <comphelper/windowserrorstring.hxx>
+#include <fstream>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/ini_parser.hpp>
+#include <osl/file.hxx>
+#include <osl/process.h>
+
#include <rtl/bootstrap.hxx>
#include <rtl/string.h>
#include <rtl/ustring.h>
@@ -1940,7 +1946,38 @@ static bool EnableAttachThreadInputHack()
{
OUString s("$EnableAttachThreadInputHack");
rtl::Bootstrap::expandMacros(s);
- const bool bEnabled = s == "true";
+ bool bEnabled;
+ if (!s.isEmpty()) {
+ bEnabled = s == "true";
+ } else {
+ // For backwards compatibility, for now also try to read the value from a [Win32] section of
+ // bootstrap.ini if it is not set as a boostrap variable:
+ bEnabled = false;
+ OUString aBootstrapUri;
+ if (osl_getProcessWorkingDir(&aBootstrapUri.pData) == osl_Process_E_None) {
+ aBootstrapUri += "/bootstrap.ini";
+
+ OUString aSystemFileName;
+ if (osl::FileBase::getSystemPathFromFileURL(aBootstrapUri, aSystemFileName)
+ == osl::FileBase::E_None
+ && aSystemFileName.getLength() <= MAX_PATH)
+ {
+ // this uses the Boost ini parser, instead of tools::Config, as we already use it to
+ // read other values from bootstrap.ini in desktop/win32/source/loader.cxx, because
+ // that watchdog process can't access LO libs. This way the handling is consistent.
+ try
+ {
+ boost::property_tree::ptree pt;
+ std::ifstream aFile(o3tl::toW(aSystemFileName.getStr()));
+ boost::property_tree::ini_parser::read_ini(aFile, pt);
+ bEnabled = pt.get("Win32.EnableAttachThreadInputHack", false);
+ }
+ catch (...)
+ {
+ }
+ }
+ }
+ }
SAL_WARN_IF(bEnabled, "vcl", "AttachThreadInput hack is enabled. Watch out for deadlocks!");
return bEnabled;
}