[Libreoffice-commits] core.git: instsetoo_native/inc_openoffice scp2/source setup_native/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 24 08:25:33 UTC 2018


 instsetoo_native/inc_openoffice/windows/msi_languages/Error.ulf |    2 
 scp2/source/ooo/ucrt.scp                                        |   12 +-
 setup_native/source/win32/customactions/inst_msu/inst_msu.cxx   |   48 ++++++----
 3 files changed, 40 insertions(+), 22 deletions(-)

New commits:
commit 20241d32bfee4a3675066da21a0e04591200cf92
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Dec 24 10:21:32 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Dec 24 09:25:12 2018 +0100

    tdf#122302: Set status message when installing KB2999226
    
    Change-Id: I414959f0f278792c5cac0c58746faa6b7773e494
    Reviewed-on: https://gerrit.libreoffice.org/65593
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/instsetoo_native/inc_openoffice/windows/msi_languages/Error.ulf b/instsetoo_native/inc_openoffice/windows/msi_languages/Error.ulf
index 315e35fe0b33..598cc7c0193e 100644
--- a/instsetoo_native/inc_openoffice/windows/msi_languages/Error.ulf
+++ b/instsetoo_native/inc_openoffice/windows/msi_languages/Error.ulf
@@ -407,6 +407,6 @@ en-US = "This setup requires Internet Information Server 4.0 or higher for confi
 en-US = "This setup requires Administrator privileges for configuring IIS Virtual Roots."
 
 [OOO_ERROR_131]
-en-US = "Installing a pre-requisite KB2999226 failed. You might need to manually install it from Microsoft site to be able to run the product. [2]"
+en-US = "Installing a pre-requisite [2] failed. You might need to manually install it from Microsoft site to be able to run the product.[3]"
 
 
diff --git a/scp2/source/ooo/ucrt.scp b/scp2/source/ooo/ucrt.scp
index 6df1d111f6fa..b945523fe961 100644
--- a/scp2/source/ooo/ucrt.scp
+++ b/scp2/source/ooo/ucrt.scp
@@ -92,7 +92,7 @@ WindowsCustomAction gid_Customaction_check_win7x64_ucrt
 	Name = "check_win7x64_ucrt";
 	Typ = "51";
 	Source = "InstMSUBinary";
-	Target = "25000|Windows61-KB2999226-x64msu";
+	Target = "KB2999226|Windows61-KB2999226-x64msu";
 	Inbinarytable = 0;
 	Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 601 And VersionNT64", "FileCost");
 	Styles = "NO_FILE";
@@ -102,7 +102,7 @@ WindowsCustomAction gid_Customaction_check_win8x64_ucrt
 	Name = "check_win8x64_ucrt";
 	Typ = "51";
 	Source = "InstMSUBinary";
-	Target = "25000|Windows8-RT-KB2999226-x64msu";
+	Target = "KB2999226|Windows8-RT-KB2999226-x64msu";
 	Inbinarytable = 0;
 	Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 602 And VersionNT64", "check_win7x64_ucrt");
 	Styles = "NO_FILE";
@@ -112,7 +112,7 @@ WindowsCustomAction gid_Customaction_check_win81x64_ucrt
 	Name = "check_win81x64_ucrt";
 	Typ = "51";
 	Source = "InstMSUBinary";
-	Target = "25000|Windows81-KB2999226-x64msu";
+	Target = "KB2999226|Windows81-KB2999226-x64msu";
 	Inbinarytable = 0;
 	Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 603 And (Not WINMAJORVER Or WINMAJORVER = \"#6\") And VersionNT64", "check_win8x64_ucrt");
 	Styles = "NO_FILE";
@@ -128,7 +128,7 @@ WindowsCustomAction gid_Customaction_check_win7x32_ucrt
 	Name = "check_win7x32_ucrt";
 	Typ = "51";
 	Source = "InstMSUBinary";
-	Target = "25000|Windows61-KB2999226-x86msu";
+	Target = "KB2999226|Windows61-KB2999226-x86msu";
 	Inbinarytable = 0;
 	Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 601 And Not VersionNT64", "check_win81x64_ucrt");
 	Styles = "NO_FILE";
@@ -138,7 +138,7 @@ WindowsCustomAction gid_Customaction_check_win8x32_ucrt
 	Name = "check_win8x32_ucrt";
 	Typ = "51";
 	Source = "InstMSUBinary";
-	Target = "25000|Windows8-RT-KB2999226-x86msu";
+	Target = "KB2999226|Windows8-RT-KB2999226-x86msu";
 	Inbinarytable = 0;
 	Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 602 And Not VersionNT64", "check_win7x32_ucrt");
 	Styles = "NO_FILE";
@@ -148,7 +148,7 @@ WindowsCustomAction gid_Customaction_check_win81x32_ucrt
 	Name = "check_win81x32_ucrt";
 	Typ = "51";
 	Source = "InstMSUBinary";
-	Target = "25000|Windows81-KB2999226-x86msu";
+	Target = "KB2999226|Windows81-KB2999226-x86msu";
 	Inbinarytable = 0;
 	Assignment1 = ("InstallExecuteSequence", "Not Installed And VersionNT = 603 And (Not WINMAJORVER Or WINMAJORVER = \"#6\") And Not VersionNT64", "check_win8x32_ucrt");
 	Styles = "NO_FILE";
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 5df2b26431d7..97394e76f3ce 100644
--- a/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
+++ b/setup_native/source/win32/customactions/inst_msu/inst_msu.cxx
@@ -120,17 +120,34 @@ template <class... StrType> void WriteLog(MSIHANDLE hInst, const StrType&... ele
     WriteLogElem(hInst, hRec, sTemplate, 1, elements...);
 }
 
-void ShowWarning(MSIHANDLE hInst, const std::wstring& sErrNo, const char* sMessage)
+// Show a warning message box. This will be automatically suppressed in unattended installation.
+void ShowWarning(MSIHANDLE hInst, const std::wstring& sKBNo, const char* sMessage)
 {
-    PMSIHANDLE hRec = MsiCreateRecord(2);
+    // Error table's message #25000: "Installing a pre-requisite [2] failed.
+    // You might need to manually install it from Microsoft site to be able to run the product.[3]"
+    PMSIHANDLE hRec = MsiCreateRecord(3);
     // To show a message from Error table, record's Field 0 must be null
-    MsiRecordSetStringW(hRec, 1, sErrNo.c_str());
+    MsiRecordSetInteger(hRec, 1, 25000);
+    MsiRecordSetStringW(hRec, 2, sKBNo.c_str());
     std::string s("\n");
     s += sMessage;
-    MsiRecordSetStringA(hRec, 2, s.c_str());
+    MsiRecordSetStringA(hRec, 3, s.c_str());
     MsiProcessMessage(hInst, INSTALLMESSAGE_WARNING, hRec);
 }
 
+// Set custom action description visible in progress dialog
+void SetStatusText(MSIHANDLE hInst, const std::wstring& sKBNo)
+{
+    PMSIHANDLE hRec = MsiCreateRecord(3);
+    // For INSTALLMESSAGE_ACTIONSTART, record's Field 0 must be null
+    std::wstring s(sKBNo + L" installation");
+    MsiRecordSetStringW(hRec, 1, s.c_str()); // Field 1: Action name - must be non-null
+    s = L"Installing " + sKBNo;
+    MsiRecordSetStringW(hRec, 2, s.c_str()); // Field 2: Action description - displayed in dialog
+    // Let Field 3 stay null - no action template
+    MsiProcessMessage(hInst, INSTALLMESSAGE_ACTIONSTART, hRec);
+}
+
 typedef std::unique_ptr<void, decltype(&CloseHandle)> CloseHandleGuard;
 CloseHandleGuard Guard(HANDLE h) { return CloseHandleGuard(h, CloseHandle); }
 
@@ -349,13 +366,13 @@ extern "C" __declspec(dllexport) UINT __stdcall UnpackMSUForInstall(MSIHANDLE hI
         DWORD nCCh = sizeof(sInstMSUBinary) / sizeof(*sInstMSUBinary);
         CheckWin32Error("MsiGetPropertyW",
                         MsiGetPropertyW(hInstall, L"InstMSUBinary", sInstMSUBinary, &nCCh));
-        WriteLog(hInstall,
-                 "Got InstMSUBinary value:", sInstMSUBinary); // 123|Windows61-KB2999226-x64msu
+        WriteLog(hInstall, "Got InstMSUBinary value:",
+                 sInstMSUBinary); // KB2999226|Windows61-KB2999226-x64msu
         const wchar_t* sBinaryName = wcschr(sInstMSUBinary, L'|');
         if (!sBinaryName)
-            throw std::exception("No error code in InstMSUBinary!");
-        // "123" - # of the message in Error table to be shown on failure
-        const std::wstring sErrNo(sInstMSUBinary, sBinaryName - sInstMSUBinary);
+            throw std::exception("No KB number in InstMSUBinary!");
+        // "KB2999226"
+        const std::wstring sKBNo(sInstMSUBinary, sBinaryName - sInstMSUBinary);
         ++sBinaryName;
 
         PMSIHANDLE hDatabase = MsiGetActiveDatabase(hInstall);
@@ -413,7 +430,7 @@ extern "C" __declspec(dllexport) UINT __stdcall UnpackMSUForInstall(MSIHANDLE hI
 
             WriteLog(hInstall, "Successfully wrote", Num2Dec(nTotal), "bytes");
         }
-        const std::wstring s_inst_msu = sErrNo + L"|" + sBinary;
+        const std::wstring s_inst_msu = sKBNo + L"|" + sBinary;
         CheckWin32Error("MsiSetPropertyW",
                         MsiSetPropertyW(hInstall, L"inst_msu", s_inst_msu.c_str()));
 
@@ -432,24 +449,25 @@ extern "C" __declspec(dllexport) UINT __stdcall UnpackMSUForInstall(MSIHANDLE hI
 // "CustomActionData" property, and runs wusa.exe to install it. Waits for it and checks exit code.
 extern "C" __declspec(dllexport) UINT __stdcall InstallMSU(MSIHANDLE hInstall)
 {
-    std::wstring sErrNo; // "123" - # of the message in Error table to be shown on failure
+    std::wstring sKBNo; // "KB2999226"
     try
     {
         sLogPrefix = "InstallMSU:";
         WriteLog(hInstall, "started");
 
         WriteLog(hInstall, "Checking value of CustomActionData");
-        wchar_t sCustomActionData[MAX_PATH + 10]; // "123|C:\Temp\binary.tmp"
+        wchar_t sCustomActionData[MAX_PATH + 10]; // "KB2999226|C:\Temp\binary.tmp"
         DWORD nCCh = sizeof(sCustomActionData) / sizeof(*sCustomActionData);
         CheckWin32Error("MsiGetPropertyW",
                         MsiGetPropertyW(hInstall, L"CustomActionData", sCustomActionData, &nCCh));
         WriteLog(hInstall, "Got CustomActionData value:", sCustomActionData);
         const wchar_t* sBinaryName = wcschr(sCustomActionData, L'|');
         if (!sBinaryName)
-            throw std::exception("No error code in CustomActionData!");
-        sErrNo = std::wstring(sCustomActionData, sBinaryName - sCustomActionData);
+            throw std::exception("No KB number in CustomActionData!");
+        sKBNo = std::wstring(sCustomActionData, sBinaryName - sCustomActionData);
         ++sBinaryName;
         auto aDeleteFileGuard(Guard(sBinaryName));
+        SetStatusText(hInstall, sKBNo);
 
         // In case the Windows Update service is disabled, we temporarily enable it here
         WUServiceEnabler aWUServiceEnabler(hInstall);
@@ -504,7 +522,7 @@ extern "C" __declspec(dllexport) UINT __stdcall InstallMSU(MSIHANDLE hInstall)
     catch (std::exception& e)
     {
         WriteLog(hInstall, e.what());
-        ShowWarning(hInstall, sErrNo, e.what());
+        ShowWarning(hInstall, sKBNo, e.what());
     }
     return ERROR_SUCCESS; // Do not break on MSU installation errors
 }


More information about the Libreoffice-commits mailing list