instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt |    2 
 scp2/source/ooo/ucrt.scp                                           |   12 -
 setup_native/source/win32/customactions/inst_msu/inst_msu.cxx      |   66 
+++++++---
 3 files changed, 54 insertions(+), 26 deletions(-)

New commits:
commit 62a46bf336b4cf95b164507ca92615eb8200b3ad
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Dec 8 23:35:37 2018 +0300
Commit:     Vasily Melenchuk <vasily.melenc...@cib.de>
CommitDate: Sat May 18 11:58:59 2019 +0300

    tdf#121987: Don't fail installation if failed to enable WU service
    
    Since commit 1882827320ed760de82211cf690b686f8d34ff74, an attempt to
    install UCRT will be performed regardless there is an evidence that it's
    present on the system, to workaround some cases where the existing UCRT
    is broken (tdf#115405, tdf#119910).
    
    But that made other errors to emerge: on systems where users disable WU
    service using some exotic ways, installer is unable to enable the
    service, and fails. [1][2] Examples of such hard-disables are using
    `sc delete` [3] and associating WU service with a guest account. Many
    such cases are reported for Windows 10, where installation of the UCRT
    is not required.
    
    So the solution (imperfect, but possibly the best possible here) is to
    allow installer to continue in case of failure enabling the service.
    This will automatically eliminate all problems related to Win10; and
    also for cases where users are advanced enough (the majority of such
    hard-disable cases should be those), it might be enough to add a
    relevant FAQ entry.
    
    [1] https://ask.libreoffice.org/en/question/172227/cannot-install-631/
    [2] 
https://ask.libreoffice.org/en/question/175571/installation-failed-unknown-error-win10x64/
    [3] 
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/sc-delete
    
    Change-Id: Ie85016eb6f0667f39412a3089fe1b1855cb1fc73
    Reviewed-on: https://gerrit.libreoffice.org/64825
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 53058090beede6a399e2f408f62c28a2921ff8ab)
    Reviewed-on: https://gerrit.libreoffice.org/64829
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx 
b/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
index b03d3cf3791c..fe948a97d595 100644
--- a/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
+++ b/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
@@ -166,6 +166,16 @@ bool IsWow64Process()
 #endif
 }
 
+// An exception class to differentiate a non-fatal exception
+class nonfatal_exception : public std::exception
+{
+public:
+    nonfatal_exception(const std::exception& e)
+        : std::exception(e)
+    {
+    }
+};
+
 // Checks if Windows Update service is disabled, and if it is, enables it 
temporarily.
 class WUServiceEnabler
 {
@@ -195,27 +205,37 @@ public:
 private:
     static CloseServiceHandleGuard EnableWUService(MSIHANDLE hInstall)
     {
-        auto hSCM = Guard(OpenSCManagerW(nullptr, nullptr, 
SC_MANAGER_ALL_ACCESS));
-        if (!hSCM)
-            ThrowLastError("OpenSCManagerW");
-        WriteLog(hInstall, "Opened service control manager");
-
-        auto hService = Guard(OpenServiceW(hSCM.get(), L"wuauserv",
-                                           SERVICE_QUERY_CONFIG | 
SERVICE_CHANGE_CONFIG
-                                               | SERVICE_QUERY_STATUS | 
SERVICE_STOP));
-        if (!hService)
-            ThrowLastError("OpenServiceW");
-        WriteLog(hInstall, "Obtained WU service handle");
-
-        if (ServiceStatus(hInstall, hService.get()) == SERVICE_RUNNING
-            || !EnsureServiceEnabled(hInstall, hService.get(), true))
+        try
         {
-            // No need to restore anything back, since we didn't change config
-            hService.reset();
-            WriteLog(hInstall, "Service configuration is unchanged");
-        }
+            auto hSCM = Guard(OpenSCManagerW(nullptr, nullptr, 
SC_MANAGER_ALL_ACCESS));
+            if (!hSCM)
+                ThrowLastError("OpenSCManagerW");
+            WriteLog(hInstall, "Opened service control manager");
+
+            auto hService = Guard(OpenServiceW(hSCM.get(), L"wuauserv",
+                                               SERVICE_QUERY_CONFIG | 
SERVICE_CHANGE_CONFIG
+                                                   | SERVICE_QUERY_STATUS | 
SERVICE_STOP));
+            if (!hService)
+                ThrowLastError("OpenServiceW");
+            WriteLog(hInstall, "Obtained WU service handle");
+
+            if (ServiceStatus(hInstall, hService.get()) == SERVICE_RUNNING
+                || !EnsureServiceEnabled(hInstall, hService.get(), true))
+            {
+                // No need to restore anything back, since we didn't change 
config
+                hService.reset();
+                WriteLog(hInstall, "Service configuration is unchanged");
+            }
 
-        return hService;
+            return hService;
+        }
+        catch (const std::exception& e)
+        {
+            // Allow errors opening service to be logged, but not interrupt 
installation.
+            // They are likely to happen in situations where people 
hard-disable WU service,
+            // and for these cases, let people deal with install logs instead 
of failing.
+            throw nonfatal_exception(e);
+        }
     }
 
     // Returns if the service configuration was actually changed
@@ -476,6 +496,14 @@ extern "C" UINT __stdcall InstallMSU(MSIHANDLE hInstall)
                 ThrowWin32Error("Execution of wusa.exe", nExitCode);
         }
     }
+    catch (nonfatal_exception& e)
+    {
+        // An error that should not interrupt installation
+        WriteLog(hInstall, e.what());
+        WriteLog(hInstall, "Installation of MSU package failed, but 
installation of product will "
+                           "continue. You may need to install the required 
update manually");
+        return ERROR_SUCCESS;
+    }
     catch (std::exception& e)
     {
         WriteLog(hInstall, e.what());
commit b5b569297172e8c67efbccf9c0a4b151d790c678
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Sep 20 08:05:41 2018 +0300
Commit:     Vasily Melenchuk <vasily.melenc...@cib.de>
CommitDate: Sat May 18 11:55:37 2019 +0300

    tdf#115405, tdf#119910: don't check if UCRT is already installed
    
    There appears to be common situation that a system has *some* UCRT libraries
    in System32, that were installed improperly (presumably by some applications
    using simple copy).In these cases, our installer would detect the presence 
of
    ucrtbase.dll, and not try to install UCRT on the system.
    
    Unfortunately, it seems that oftentimes such improper UCRT installations 
miss
    some parts of UCRT, which leads to LibreOffice failing to start with 
messages
    like "The program can't start because api-ms-win-crt-string-l1-1-0.dll is
    missing from your computer. Try reinstalling the program to fix this 
problem."
    (the missing component varies).
    
    This patch removes the check for UCRT presence. Installer will try to 
install
    UCRT on applicable systems unconditionally. Since the proper outcomes in 
case
    of already present UCRT are either WU_S_ALREADY_INSTALLED or 
WU_E_NOT_APPLICABLE
    and both are treated as success in inst_msu action (see InstallMSU in
    setup_native/source/win32/customactions/inst_msu/inst_msu.cxx), this should
    only make this part more robust, and not bring new problems (yes, I know 
that
    actually there will be new problems, as usual).
    
    Reviewed-on: https://gerrit.libreoffice.org/60789
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 1882827320ed760de82211cf690b686f8d34ff74)
    Reviewed-on: https://gerrit.libreoffice.org/61444
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    
    Change-Id: I22a3d357014d31a8e492ff8a15bcb477eeb79735

diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt 
b/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
index f51e12ed0d60..44fb9f500387 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
@@ -42,7 +42,7 @@ ProgressType3 installs
 Quickstarterlinkname   QUICKSTARTERLINKNAMETEMPLATE
 RebootYesNo    Yes
 ReinstallModeText      omus
-SecureCustomProperties NEWPRODUCTS;OLDPRODUCTS;WIN81S14;UCRT_DETECTED
+SecureCustomProperties NEWPRODUCTS;OLDPRODUCTS;WIN81S14
 SetupType      Typical
 SELECT_WORD    0
 SELECT_EXCEL   0
diff --git a/scp2/source/ooo/ucrt.scp b/scp2/source/ooo/ucrt.scp
index 4a13309f6364..ae2eb27a4dbe 100644
--- a/scp2/source/ooo/ucrt.scp
+++ b/scp2/source/ooo/ucrt.scp
@@ -91,7 +91,7 @@ WindowsCustomAction gid_Customaction_check_win7x64_ucrt
        Source = "InstMSUBinary";
        Target = "Windows61-KB2999226-x64msu";
        Inbinarytable = 0;
-       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
601 And VersionNT64 And Not UCRT_DETECTED", "FileCost");
+       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
601 And VersionNT64", "FileCost");
        Styles = "NO_FILE";
 End
 
@@ -101,7 +101,7 @@ WindowsCustomAction gid_Customaction_check_win8x64_ucrt
        Source = "InstMSUBinary";
        Target = "Windows8-RT-KB2999226-x64msu";
        Inbinarytable = 0;
-       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
602 And VersionNT64 And Not UCRT_DETECTED", "check_win7x64_ucrt");
+       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
602 And VersionNT64", "check_win7x64_ucrt");
        Styles = "NO_FILE";
 End
 
@@ -111,7 +111,7 @@ WindowsCustomAction gid_Customaction_check_win81x64_ucrt
        Source = "InstMSUBinary";
        Target = "Windows81-KB2999226-x64msu";
        Inbinarytable = 0;
-       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
603 And VersionNT64 And Not UCRT_DETECTED", "check_win8x64_ucrt");
+       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
603 And VersionNT64", "check_win8x64_ucrt");
        Styles = "NO_FILE";
 End
 
@@ -127,7 +127,7 @@ WindowsCustomAction gid_Customaction_check_win7x32_ucrt
        Source = "InstMSUBinary";
        Target = "Windows61-KB2999226-x86msu";
        Inbinarytable = 0;
-       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
601 And Not VersionNT64 And Not UCRT_DETECTED", "check_win81x64_ucrt");
+       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
601 And Not VersionNT64", "check_win81x64_ucrt");
        Styles = "NO_FILE";
 End
 
@@ -137,7 +137,7 @@ WindowsCustomAction gid_Customaction_check_win8x32_ucrt
        Source = "InstMSUBinary";
        Target = "Windows8-RT-KB2999226-x86msu";
        Inbinarytable = 0;
-       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
602 And Not VersionNT64 And Not UCRT_DETECTED", "check_win7x32_ucrt");
+       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
602 And Not VersionNT64", "check_win7x32_ucrt");
        Styles = "NO_FILE";
 End
 
@@ -147,7 +147,7 @@ WindowsCustomAction gid_Customaction_check_win81x32_ucrt
        Source = "InstMSUBinary";
        Target = "Windows81-KB2999226-x86msu";
        Inbinarytable = 0;
-       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
603 And Not VersionNT64 And Not UCRT_DETECTED", "check_win8x32_ucrt");
+       Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 
603 And Not VersionNT64", "check_win8x32_ucrt");
        Styles = "NO_FILE";
 End
 
commit 4660aadada20a5e8056ac1c8e50dbed5ef6289d1
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jul 30 14:46:41 2018 +0200
Commit:     Vasily Melenchuk <vasily.melenc...@cib.de>
CommitDate: Sat May 18 11:35:26 2019 +0300

    tdf#118869: mark some properties secure to pass them to elevated install
    
    See also 
http://helpnet.flexerasoftware.com/installshield19helplib/helplibrary/ISBP10.htm
    
    Change-Id: I217d68f98af8e56874af6c071bb7fa7354b3e4b4
    Reviewed-on: https://gerrit.libreoffice.org/58326
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit ec9b18b75c193c914691a29d3eb78bd81961fced)
    Reviewed-on: https://gerrit.libreoffice.org/58338
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt 
b/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
index b771f8bc706e..f51e12ed0d60 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
+++ b/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
@@ -42,7 +42,7 @@ ProgressType3 installs
 Quickstarterlinkname   QUICKSTARTERLINKNAMETEMPLATE
 RebootYesNo    Yes
 ReinstallModeText      omus
-SecureCustomProperties NEWPRODUCTS;OLDPRODUCTS
+SecureCustomProperties NEWPRODUCTS;OLDPRODUCTS;WIN81S14;UCRT_DETECTED
 SetupType      Typical
 SELECT_WORD    0
 SELECT_EXCEL   0
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to