This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new fdfd5b33ae Cleanup
     new 78946137fd Merge branch 'trunk' of 
https://gitbox.apache.org/repos/asf/openoffice into trunk
fdfd5b33ae is described below

commit fdfd5b33ae5ed870678ef4a71a1a636776633a9e
Author: mseidel <[email protected]>
AuthorDate: Fri Feb 6 22:43:05 2026 +0100

    Cleanup
---
 .../checkrunningofficelanguagepack.cxx             |   4 +-
 .../languagepacks/lngpckinsthelper.cxx             | 230 ++++++++--------
 .../customactions/languagepacks/respintest.cxx     | 306 ++++++++++-----------
 3 files changed, 270 insertions(+), 270 deletions(-)

diff --git 
a/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
 
b/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
index d5c594e509..1f689c9ec4 100644
--- 
a/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
+++ 
b/main/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 #define _WIN32_WINDOWS 0x0410
 
 #ifdef _MSC_VER
@@ -210,3 +208,5 @@ extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle 
)
 
        return ERROR_SUCCESS;
 }
+
+/* vim: set noet sw=4 ts=4: */
diff --git 
a/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
 
b/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
index be27ef2e70..869043fb3c 100644
--- 
a/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
+++ 
b/main/setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 #ifdef _MSC_VER
 #pragma warning(push, 1) /* disable warnings within system headers */
 #endif
@@ -40,22 +38,22 @@
 class RegistryKeyGuard
 {
 public:
-    RegistryKeyGuard(HKEY hkey = 0) :
-        hkey_(hkey)
-    {
-    }
-
-    ~RegistryKeyGuard()
-    {
-        if (hkey_)
-            RegCloseKey(hkey_);
-    }
+       RegistryKeyGuard(HKEY hkey = 0) :
+               hkey_(hkey)
+       {
+       }
+
+       ~RegistryKeyGuard()
+       {
+               if (hkey_)
+                       RegCloseKey(hkey_);
+       }
 private:
-    HKEY hkey_;
+       HKEY hkey_;
 
 private:
-    RegistryKeyGuard(const RegistryKeyGuard&);
-    RegistryKeyGuard& operator=(const RegistryKeyGuard&);
+       RegistryKeyGuard(const RegistryKeyGuard&);
+       RegistryKeyGuard& operator=(const RegistryKeyGuard&);
 };
 
 typedef std::vector<TCHAR> CharacterBuffer_t;
@@ -66,134 +64,136 @@ typedef std::vector<TCHAR> CharacterBuffer_t;
    properly installed product. */
 std::string FindProductInstallationPath(HKEY hkey)
 {
-    DWORD nSubKeys;
-    DWORD lLongestSubKey;
+       DWORD nSubKeys;
+       DWORD lLongestSubKey;
 
-    if (RegQueryInfoKey(hkey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey, 
NULL, NULL, NULL, NULL, NULL, NULL) !=
-        ERROR_SUCCESS)
-        throw std::runtime_error("Cannot query info for registery key");
+       if (RegQueryInfoKey(hkey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey, 
NULL, NULL, NULL, NULL, NULL, NULL) !=
+               ERROR_SUCCESS)
+               throw std::runtime_error("Cannot query info for registry key");
 
-    CharacterBuffer_t buff(lLongestSubKey + 1);
+       CharacterBuffer_t buff(lLongestSubKey + 1);
 
-    for (DWORD i = 0; i < nSubKeys; i++)
-    {
-        buff[0] = 0;
-        LONG ret = RegEnumKey(hkey, i, &buff[0], buff.size());
+       for (DWORD i = 0; i < nSubKeys; i++)
+       {
+               buff[0] = 0;
+               LONG ret = RegEnumKey(hkey, i, &buff[0], buff.size());
 
-        if ((ret != ERROR_SUCCESS) && (ret != ERROR_MORE_DATA))
-            throw std::runtime_error("Error enumerating registry key");
+               if ((ret != ERROR_SUCCESS) && (ret != ERROR_MORE_DATA))
+                       throw std::runtime_error("Error enumerating registry 
key");
 
-        HKEY hSubKey;
-        if (RegOpenKey(hkey, &buff[0], &hSubKey) != ERROR_SUCCESS)
-            continue;
+               HKEY hSubKey;
+               if (RegOpenKey(hkey, &buff[0], &hSubKey) != ERROR_SUCCESS)
+                       continue;
 
-        RegistryKeyGuard guard(hSubKey);
+               RegistryKeyGuard guard(hSubKey);
 
-        DWORD type;
-        TCHAR pbuff[MAX_PATH];
-        DWORD size = sizeof(pbuff);
-        if ((RegQueryValueEx(
-                hSubKey, TEXT("Path"), NULL, &type, 
reinterpret_cast<LPBYTE>(pbuff), &size) != ERROR_SUCCESS) ||
-                (type != REG_SZ))
-            continue;
+               DWORD type;
+               TCHAR pbuff[MAX_PATH];
+               DWORD size = sizeof(pbuff);
+               if ((RegQueryValueEx(
+                               hSubKey, TEXT("Path"), NULL, &type, 
reinterpret_cast<LPBYTE>(pbuff), &size) != ERROR_SUCCESS) ||
+                               (type != REG_SZ))
+                       continue;
 
-        std::string path(pbuff);
-        std::string::size_type idx = path.rfind("program\\soffice.exe");
-        if (idx != std::string::npos)
-            return path.substr(0, idx);
-    } // for
+               std::string path(pbuff);
+               std::string::size_type idx = path.rfind("program\\soffice.exe");
+               if (idx != std::string::npos)
+                       return path.substr(0, idx);
+       } // for
 
-    throw std::runtime_error("No valid product path found");
+       throw std::runtime_error("No valid product path found");
 }
 
 UINT GetInstallProperty(MSIHANDLE handle, LPCTSTR name, CharacterBuffer_t* 
buffer)
 {
-    DWORD size = buffer->size();
-    UINT ret = MsiGetProperty(handle, name, &(*buffer)[0], &size);
-
-    if (ret == ERROR_MORE_DATA)
-    {
-        buffer->resize(size + 1);
-        size = buffer->size();
-        ret = MsiGetProperty(handle, name, &(*buffer)[0], &size);
-    }
-    return ret;
+       DWORD size = buffer->size();
+       UINT ret = MsiGetProperty(handle, name, &(*buffer)[0], &size);
+
+       if (ret == ERROR_MORE_DATA)
+       {
+               buffer->resize(size + 1);
+               size = buffer->size();
+               ret = MsiGetProperty(handle, name, &(*buffer)[0], &size);
+       }
+       return ret;
 }
 
 /*
-    Try to find the installation path to an already installed product.
-    The installation path will be written in the Windows registry
-    during the installation. There may exist different products in
-    parallel e.g. StarOffice, StarSuite, OpenOffice.org, Apache OpenOffice.
-    It will be searched in this order for an installed product. If a product
-    will be found the path to the product will be set in the property
-    "INSTALLLOCATION" else nothing will be done.
+       Try to find the installation path to an already installed product.
+       The installation path will be written in the Windows registry
+       during the installation. There may exist different products in
+       parallel e.g. StarOffice, StarSuite, OpenOffice.org, Apache OpenOffice.
+       It will be searched in this order for an installed product. If a product
+       will be found the path to the product will be set in the property
+       "INSTALLLOCATION" else nothing will be done.
 */
 extern "C" UINT __stdcall SetProductInstallationPath(MSIHANDLE handle)
 {
-    //MessageBox(NULL, TEXT("SetProductInstallationPath"), TEXT("Language Pack 
Installation Helper"), MB_OK | MB_ICONINFORMATION);
-
-    try
-    {
-        CharacterBuffer_t regKeyProdPath(MAX_PATH);
-
-        GetInstallProperty(handle, TEXT("REGKEYPRODPATH"), &regKeyProdPath);
-
-        HKEY hKey;
-        if ((RegOpenKey(HKEY_CURRENT_USER, &regKeyProdPath[0], &hKey) == 
ERROR_SUCCESS) ||
-            (RegOpenKey(HKEY_LOCAL_MACHINE, &regKeyProdPath[0], &hKey) == 
ERROR_SUCCESS))
-        {
-            RegistryKeyGuard guard(hKey);
-            std::string path = FindProductInstallationPath(hKey);
-            MsiSetProperty(handle, TEXT("INSTALLLOCATION"), path.c_str());
-        }
-    }
-    catch(std::runtime_error& ex)
-    {
-        ex = ex; // no warnings
-    }
-    return ERROR_SUCCESS;
+       //MessageBox(NULL, TEXT("SetProductInstallationPath"), TEXT("Language 
Pack Installation Helper"), MB_OK | MB_ICONINFORMATION);
+
+       try
+       {
+               CharacterBuffer_t regKeyProdPath(MAX_PATH);
+
+               GetInstallProperty(handle, TEXT("REGKEYPRODPATH"), 
&regKeyProdPath);
+
+               HKEY hKey;
+               if ((RegOpenKey(HKEY_CURRENT_USER, &regKeyProdPath[0], &hKey) 
== ERROR_SUCCESS) ||
+                       (RegOpenKey(HKEY_LOCAL_MACHINE, &regKeyProdPath[0], 
&hKey) == ERROR_SUCCESS))
+               {
+                       RegistryKeyGuard guard(hKey);
+                       std::string path = FindProductInstallationPath(hKey);
+                       MsiSetProperty(handle, TEXT("INSTALLLOCATION"), 
path.c_str());
+               }
+       }
+       catch(std::runtime_error& ex)
+       {
+               ex = ex; // no warnings
+       }
+       return ERROR_SUCCESS;
 }
 
 void MakeCfgimportCommandLine(CharacterBuffer_t* productPath)
 {
-    char* p = &(*productPath)[0] + lstrlen(&(*productPath)[0]) - 1;
+       char* p = &(*productPath)[0] + lstrlen(&(*productPath)[0]) - 1;
 
-    if (*p != '\\')
-        lstrcat(&(*productPath)[0], "\\program\\configimport.exe --spool");
-    else
-        lstrcat(&(*productPath)[0], "program\\configimport.exe --spool");
+       if (*p != '\\')
+               lstrcat(&(*productPath)[0], "\\program\\configimport.exe 
--spool");
+       else
+               lstrcat(&(*productPath)[0], "program\\configimport.exe 
--spool");
 }
 
 /*
-    Calls configimport.exe --spool
+       Calls configimport.exe --spool
 */
 extern "C" UINT __stdcall RegisterLanguagePack(MSIHANDLE handle)
 {
-    //MessageBox(NULL, TEXT("RegisterLanguagePack"), TEXT("Language Pack 
Installation Helper"), MB_OK | MB_ICONINFORMATION);
-
-    CharacterBuffer_t productPath(MAX_PATH);
-    GetInstallProperty(handle, TEXT("INSTALLLOCATION"), &productPath);
-    MakeCfgimportCommandLine(&productPath);
-
-    STARTUPINFO si;
-    ZeroMemory(&si, sizeof(si));
-    si.cb = sizeof(si);
-
-    PROCESS_INFORMATION pi;
-    ZeroMemory(&pi, sizeof(pi));
-
-    if (CreateProcess(
-            NULL, &productPath[0], NULL, NULL,
-            FALSE, CREATE_NO_WINDOW | NORMAL_PRIORITY_CLASS, NULL,
-            NULL, &si, &pi))
-    {
-        // Wait until child process exits.
-        WaitForSingleObject(pi.hProcess, INFINITE);
-
-        // Close process and thread handles.
-        CloseHandle(pi.hProcess);
-        CloseHandle(pi.hThread);
-    }
-    return ERROR_SUCCESS;
+       //MessageBox(NULL, TEXT("RegisterLanguagePack"), TEXT("Language Pack 
Installation Helper"), MB_OK | MB_ICONINFORMATION);
+
+       CharacterBuffer_t productPath(MAX_PATH);
+       GetInstallProperty(handle, TEXT("INSTALLLOCATION"), &productPath);
+       MakeCfgimportCommandLine(&productPath);
+
+       STARTUPINFO si;
+       ZeroMemory(&si, sizeof(si));
+       si.cb = sizeof(si);
+
+       PROCESS_INFORMATION pi;
+       ZeroMemory(&pi, sizeof(pi));
+
+       if (CreateProcess(
+                       NULL, &productPath[0], NULL, NULL,
+                       FALSE, CREATE_NO_WINDOW | NORMAL_PRIORITY_CLASS, NULL,
+                       NULL, &si, &pi))
+       {
+               // Wait until child process exits.
+               WaitForSingleObject(pi.hProcess, INFINITE);
+
+               // Close process and thread handles.
+               CloseHandle(pi.hProcess);
+               CloseHandle(pi.hThread);
+       }
+       return ERROR_SUCCESS;
 }
+
+/* vim: set noet sw=4 ts=4: */
diff --git 
a/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx 
b/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx
index eea8714da3..3a72370876 100644
--- a/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx
+++ b/main/setup_native/source/win32/customactions/languagepacks/respintest.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 #undef UNICODE
 #undef _UNICODE
 
@@ -49,159 +47,161 @@ using namespace std;
 
 namespace
 {
-    string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
-    {
-        string  result;
-        TCHAR   szDummy[1] = TEXT("");
-        DWORD   nChars = 0;
-
-        if (MsiGetProperty(handle, sProperty.c_str(), szDummy, &nChars) == 
ERROR_MORE_DATA)
-        {
-            DWORD nBytes = ++nChars * sizeof(TCHAR);
-            LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(nBytes));
-            ZeroMemory( buffer, nBytes );
-            MsiGetProperty(handle, sProperty.c_str(), buffer, &nChars);
-            result = buffer;
-        }
-        return result;
-    }
-
-    inline bool IsSetMsiProperty(MSIHANDLE handle, const string& sProperty)
-    {
-        return (GetMsiProperty(handle, sProperty).length() > 0);
-    }
-
-    inline void UnsetMsiProperty(MSIHANDLE handle, const string& sProperty)
-    {
-        MsiSetProperty(handle, sProperty.c_str(), NULL);
-    }
-
-    inline void SetMsiProperty(MSIHANDLE handle, const string& sProperty, 
const string&)
-    {
-        MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
-    }
+       string GetMsiProperty(MSIHANDLE handle, const string& sProperty)
+       {
+               string  result;
+               TCHAR   szDummy[1] = TEXT("");
+               DWORD   nChars = 0;
+
+               if (MsiGetProperty(handle, sProperty.c_str(), szDummy, &nChars) 
== ERROR_MORE_DATA)
+               {
+                       DWORD nBytes = ++nChars * sizeof(TCHAR);
+                       LPTSTR buffer = 
reinterpret_cast<LPTSTR>(_alloca(nBytes));
+                       ZeroMemory( buffer, nBytes );
+                       MsiGetProperty(handle, sProperty.c_str(), buffer, 
&nChars);
+                       result = buffer;
+               }
+               return result;
+       }
+
+       inline bool IsSetMsiProperty(MSIHANDLE handle, const string& sProperty)
+       {
+               return (GetMsiProperty(handle, sProperty).length() > 0);
+       }
+
+       inline void UnsetMsiProperty(MSIHANDLE handle, const string& sProperty)
+       {
+               MsiSetProperty(handle, sProperty.c_str(), NULL);
+       }
+
+       inline void SetMsiProperty(MSIHANDLE handle, const string& sProperty, 
const string&)
+       {
+               MsiSetProperty(handle, sProperty.c_str(), TEXT("1"));
+       }
 } // namespace
 
 extern "C" UINT __stdcall GetUserInstallMode(MSIHANDLE handle)
 {
-    string sOfficeInstallPath = GetMsiProperty(handle, 
TEXT("INSTALLLOCATION"));
-
-    // MessageBox(NULL, sOfficeInstallPath.c_str(), "DEBUG", MB_OK);
-
-    // unsetting all properties
-
-    UnsetMsiProperty( handle, TEXT("INVALIDDIRECTORY") );
-    UnsetMsiProperty( handle, TEXT("ISWRONGPRODUCT") );
-    UnsetMsiProperty( handle, TEXT("PATCHISOLDER") );
-    UnsetMsiProperty( handle, TEXT("ALLUSERS") );
-
-    // 1. Searching for "ProductCode" in setup.ini
-
-    string sSetupiniPath = sOfficeInstallPath + TEXT("program\\setup.ini");
-
-    TCHAR szValue[32767];
-
-    GetPrivateProfileString(
-        TEXT("Bootstrap"),
-        TEXT("ProductCode"),
-        TEXT("INVALIDDIRECTORY"),
-        szValue,
-        elementsof(szValue),
-        sSetupiniPath.c_str()
-        );
-
-    if ( !_tcsicmp( szValue, TEXT("INVALIDDIRECTORY") ) )
-    {
-       // No setup.ini or no "ProductCode" in setup.ini. This is an invalid 
directory.
-        SetMsiProperty( handle, TEXT("INVALIDDIRECTORY"), TEXT("YES") );
-        // MessageBox(NULL, "INVALIDDIRECTORY set, no setup.ini or ProductCode 
in setup.ini.", "DEBUG", MB_OK);
-        SetMsiErrorCode( MSI_ERROR_INVALIDDIRECTORY );
-        return ERROR_SUCCESS;
-    }
-
-    // 2. Comparing first three characters of "PRODUCTMAJOR" from property 
table and "buildid" from InfoFile
-
-    szValue[0] = '\0';
-
-    GetPrivateProfileString(
-        TEXT("Bootstrap"),
-        TEXT("buildid"),
-        TEXT("ISWRONGPRODUCT"),
-        szValue,
-        elementsof(szValue),
-        sSetupiniPath.c_str()
-        );
-
-    if ( !_tcsicmp( szValue, TEXT("ISWRONGPRODUCT") ) )
-    {
-        SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
-        // MessageBox(NULL, "ISWRONGPRODUCT 1 set after searching buildid", 
"DEBUG", MB_OK);
-        SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
-        return ERROR_SUCCESS;
-    }
-
-    string ProductMajor = GetMsiProperty(handle, TEXT("PRODUCTMAJOR"));
-
-    // Comparing the first three characters, for example "680"
-    // If not equal, this version is not suited for patch or language pack
-
-    if (_tcsnicmp(ProductMajor.c_str(), szValue, 3))
-    {
-        SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
-        // MessageBox(NULL, "ISWRONGPRODUCT 2 set after searching 
PRODUCTMAJOR", "DEBUG", MB_OK);
-        SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
-        return ERROR_SUCCESS;
-    }
-
-    // 3. Only for patch: Comparing "PRODUCTMINOR from property table and 
"ProductMinor" from InfoFile
-
-    string isPatch = GetMsiProperty(handle, TEXT("ISPATCH"));
-
-    if (isPatch=="1")
-    {
-        string ProductMinor = GetMsiProperty(handle, TEXT("PRODUCTBUILDID"));
-        int PatchProductMinor = atoi(ProductMinor.c_str());
-
-        szValue[0] = '\0';
-
-        GetPrivateProfileString(
-            TEXT("Bootstrap"),
-            TEXT("ProductBuildid"),
-            TEXT("8918"),
-            szValue,
-            elementsof(szValue),
-            sSetupiniPath.c_str()
-            );
-
-        int InstalledProductMinor = atoi(szValue);
-
-        if ( InstalledProductMinor >= PatchProductMinor )
-        {
-            SetMsiProperty( handle, TEXT("PATCHISOLDER"), TEXT("YES") );
-            // MessageBox(NULL, "PATCHISOLDER set", "DEBUG", MB_OK);
-            SetMsiErrorCode( MSI_ERROR_PATCHISOLDER );
-            return ERROR_SUCCESS;
-        }
-    }
-
-    // 4. Setting property ALLUSERS with value from "setup.ini"
-
-    szValue[0] = '\0';
-
-    GetPrivateProfileString(
-        TEXT("Bootstrap"),
-        TEXT("ALLUSERS"),
-        TEXT(""),
-        szValue,
-        elementsof(szValue),
-        sSetupiniPath.c_str()
-        );
-
-    if ( szValue[0] )
-    {
-        SetMsiProperty( handle, TEXT("ALLUSERS"), szValue );
-        // MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK);
-    }
-
-    return ERROR_SUCCESS;
+       string sOfficeInstallPath = GetMsiProperty(handle, 
TEXT("INSTALLLOCATION"));
+
+       // MessageBox(NULL, sOfficeInstallPath.c_str(), "DEBUG", MB_OK);
+
+       // unsetting all properties
+
+       UnsetMsiProperty( handle, TEXT("INVALIDDIRECTORY") );
+       UnsetMsiProperty( handle, TEXT("ISWRONGPRODUCT") );
+       UnsetMsiProperty( handle, TEXT("PATCHISOLDER") );
+       UnsetMsiProperty( handle, TEXT("ALLUSERS") );
+
+       // 1. Searching for "ProductCode" in setup.ini
+
+       string sSetupiniPath = sOfficeInstallPath + TEXT("program\\setup.ini");
+
+       TCHAR szValue[32767];
+
+       GetPrivateProfileString(
+               TEXT("Bootstrap"),
+               TEXT("ProductCode"),
+               TEXT("INVALIDDIRECTORY"),
+               szValue,
+               elementsof(szValue),
+               sSetupiniPath.c_str()
+               );
+
+       if ( !_tcsicmp( szValue, TEXT("INVALIDDIRECTORY") ) )
+       {
+               // No setup.ini or no "ProductCode" in setup.ini. This is an 
invalid directory.
+               SetMsiProperty( handle, TEXT("INVALIDDIRECTORY"), TEXT("YES") );
+               // MessageBox(NULL, "INVALIDDIRECTORY set, no setup.ini or 
ProductCode in setup.ini.", "DEBUG", MB_OK);
+               SetMsiErrorCode( MSI_ERROR_INVALIDDIRECTORY );
+               return ERROR_SUCCESS;
+       }
+
+       // 2. Comparing first three characters of "PRODUCTMAJOR" from property 
table and "buildid" from InfoFile
+
+       szValue[0] = '\0';
+
+       GetPrivateProfileString(
+               TEXT("Bootstrap"),
+               TEXT("buildid"),
+               TEXT("ISWRONGPRODUCT"),
+               szValue,
+               elementsof(szValue),
+               sSetupiniPath.c_str()
+               );
+
+       if ( !_tcsicmp( szValue, TEXT("ISWRONGPRODUCT") ) )
+       {
+               SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
+               // MessageBox(NULL, "ISWRONGPRODUCT 1 set after searching 
buildid", "DEBUG", MB_OK);
+               SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
+               return ERROR_SUCCESS;
+       }
+
+       string ProductMajor = GetMsiProperty(handle, TEXT("PRODUCTMAJOR"));
+
+       // Comparing the first three characters, for example "680"
+       // If not equal, this version is not suited for patch or language pack
+
+       if (_tcsnicmp(ProductMajor.c_str(), szValue, 3))
+       {
+               SetMsiProperty( handle, TEXT("ISWRONGPRODUCT"), TEXT("YES") );
+               // MessageBox(NULL, "ISWRONGPRODUCT 2 set after searching 
PRODUCTMAJOR", "DEBUG", MB_OK);
+               SetMsiErrorCode( MSI_ERROR_ISWRONGPRODUCT );
+               return ERROR_SUCCESS;
+       }
+
+       // 3. Only for patch: Comparing "PRODUCTMINOR from property table and 
"ProductMinor" from InfoFile
+
+       string isPatch = GetMsiProperty(handle, TEXT("ISPATCH"));
+
+       if (isPatch=="1")
+       {
+               string ProductMinor = GetMsiProperty(handle, 
TEXT("PRODUCTBUILDID"));
+               int PatchProductMinor = atoi(ProductMinor.c_str());
+
+               szValue[0] = '\0';
+
+               GetPrivateProfileString(
+                       TEXT("Bootstrap"),
+                       TEXT("ProductBuildid"),
+                       TEXT("8918"),
+                       szValue,
+                       elementsof(szValue),
+                       sSetupiniPath.c_str()
+                       );
+
+               int InstalledProductMinor = atoi(szValue);
+
+               if ( InstalledProductMinor >= PatchProductMinor )
+               {
+                       SetMsiProperty( handle, TEXT("PATCHISOLDER"), 
TEXT("YES") );
+                       // MessageBox(NULL, "PATCHISOLDER set", "DEBUG", MB_OK);
+                       SetMsiErrorCode( MSI_ERROR_PATCHISOLDER );
+                       return ERROR_SUCCESS;
+               }
+       }
+
+       // 4. Setting property ALLUSERS with value from "setup.ini"
+
+       szValue[0] = '\0';
+
+       GetPrivateProfileString(
+               TEXT("Bootstrap"),
+               TEXT("ALLUSERS"),
+               TEXT(""),
+               szValue,
+               elementsof(szValue),
+               sSetupiniPath.c_str()
+               );
+
+       if ( szValue[0] )
+       {
+               SetMsiProperty( handle, TEXT("ALLUSERS"), szValue );
+               // MessageBox(NULL, "ALLUSERS set", "DEBUG", MB_OK);
+       }
+
+       return ERROR_SUCCESS;
 }
+
+/* vim: set noet sw=4 ts=4: */

Reply via email to