scp2/source/ooo/windowscustomaction_ooo.scp                              |   
18 -
 setup_native/Library_shlxtmsi.mk                                         |    
1 
 setup_native/source/win32/customactions/shellextensions/shlxtmsi.def     |    
2 
 setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx |  
140 ----------
 solenv/clang-format/excludelist                                          |    
1 
 5 files changed, 162 deletions(-)

New commits:
commit 955fd1c534c061b3b6992dfe034b62b46ee2e844
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Wed May 18 10:28:01 2022 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Wed May 18 22:50:53 2022 +0200

    tdf#149106 Remove RenamePrgFolder and RemovePrgFolder custom msi actions
    
    This duplicates MSI functionality - if a folder cannot be written,
    MSI should request a reboot automatically.
    
    See https://bugs.documentfoundation.org/show_bug.cgi?id=149106#c17 for 
details.
    
    Change-Id: I65f295ff6e3bb22afc616feb2ba529413f3e24c0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134513
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
    Tested-by: Jenkins

diff --git a/scp2/source/ooo/windowscustomaction_ooo.scp 
b/scp2/source/ooo/windowscustomaction_ooo.scp
index 116b437b1ed3..41b78daad13b 100644
--- a/scp2/source/ooo/windowscustomaction_ooo.scp
+++ b/scp2/source/ooo/windowscustomaction_ooo.scp
@@ -18,24 +18,6 @@
 
 #include "macros.inc"
 
-WindowsCustomAction gid_Customaction_RenamePrgFolder
-       Name = "RenamePrgFolder";
-       Typ = "1";
-       Source = "shlxtmsi.dll";
-       Target = "RenamePrgFolder";
-       Inbinarytable = 1;
-       Assignment1 = ("InstallExecuteSequence", "OLDPRODUCTS And Not 
REMOVE=\"ALL\" And Not PATCH", "ValidateProductID");
-End
-
-WindowsCustomAction gid_Customaction_RemovePrgFolder
-       Name = "RemovePrgFolder";
-       Typ = "1";
-       Source = "shlxtmsi.dll";
-       Target = "RemovePrgFolder";
-       Inbinarytable = 1;
-       Assignment1 = ("InstallExecuteSequence", "OLDPRODUCTS And Not 
REMOVE=\"ALL\" And Not PATCH", "end");
-End
-
 WindowsCustomAction gid_Customaction_Regallmsdocdll
        Name = "Regallmsdocdll";
        Typ = "65";
diff --git a/setup_native/Library_shlxtmsi.mk b/setup_native/Library_shlxtmsi.mk
index a4c2fccd2575..bea522c62a3a 100644
--- a/setup_native/Library_shlxtmsi.mk
+++ b/setup_native/Library_shlxtmsi.mk
@@ -30,7 +30,6 @@ $(eval $(call gb_Library_add_exception_objects,shlxtmsi,\
     setup_native/source/win32/customactions/shellextensions/migrateinstallpath 
\
     
setup_native/source/win32/customactions/shellextensions/completeinstallpath \
     setup_native/source/win32/customactions/shellextensions/checkdirectory \
-    setup_native/source/win32/customactions/shellextensions/vistaspecial \
     setup_native/source/win32/customactions/shellextensions/checkpatches \
 ))
 
diff --git 
a/setup_native/source/win32/customactions/shellextensions/shlxtmsi.def 
b/setup_native/source/win32/customactions/shellextensions/shlxtmsi.def
index e0e667953d4f..57b6aa154f4d 100644
--- a/setup_native/source/win32/customactions/shellextensions/shlxtmsi.def
+++ b/setup_native/source/win32/customactions/shellextensions/shlxtmsi.def
@@ -7,5 +7,3 @@ EXPORTS
                        InstallStartmenuFolderIcon
                        DeinstallStartmenuFolderIcon
                        SetProductInstallMode
-                       RenamePrgFolder
-                       RemovePrgFolder
diff --git 
a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx 
b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
deleted file mode 100644
index 4009d7887ab1..000000000000
--- a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "shlxtmsi.hxx"
-
-#include <strsafe.h>
-
-#include <systools/win32/uwinapi.h>
-#include "../tools/seterror.hxx"
-
-static bool RemoveCompleteDirectoryW(const std::wstring& rPath)
-{
-    bool bDirectoryRemoved = true;
-
-    std::wstring sPattern = rPath + L"\\" + L"*.*";
-    WIN32_FIND_DATAW aFindData;
-
-    // Finding all content in rPath
-
-    HANDLE hFindContent = FindFirstFileW( sPattern.c_str(), &aFindData );
-
-    if ( hFindContent != INVALID_HANDLE_VALUE )
-    {
-        bool fNextFile = false;
-        std::wstring sCurrentDir = L".";
-        std::wstring sParentDir = L"..";
-
-        do
-        {
-            std::wstring sFileName = aFindData.cFileName;
-
-            if (( wcscmp(sFileName.c_str(),sCurrentDir.c_str()) != 0 ) &&
-                ( wcscmp(sFileName.c_str(),sParentDir.c_str()) != 0 ))
-            {
-                std::wstring sCompleteFileName = rPath + L"\\" + sFileName;
-
-                if ( aFindData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
-                {
-                    RemoveCompleteDirectoryW(sCompleteFileName);
-                }
-                else
-                {
-                    DeleteFileW( sCompleteFileName.c_str() );
-                }
-            }
-
-            fNextFile = FindNextFileW( hFindContent, &aFindData );
-
-        } while ( fNextFile );
-
-        FindClose( hFindContent );
-
-        // empty directory can be removed now
-        // RemoveDirectory is only successful, if the last handle to the 
directory is closed
-        // -> first removing content -> closing handle -> remove empty 
directory
-
-
-        if( !( RemoveDirectoryW(rPath.c_str()) ) )
-        {
-            bDirectoryRemoved = false;
-        }
-    }
-
-    return bDirectoryRemoved;
-}
-
-/** Move program folder to program_old. Tries 10 times (program_old1, 
program_old2, ...).
- *
- * @return
- *  ERROR_INSTALL_FAILURE when the folder cannot be moved.
- *  ERROR_SUCCESS otherwise.
- */
-extern "C" __declspec(dllexport) UINT __stdcall RenamePrgFolder( MSIHANDLE 
handle )
-{
-    std::wstring sOfficeInstallPath = GetMsiPropertyW(handle, 
L"INSTALLLOCATION");
-
-    std::wstring sRenameSrc = sOfficeInstallPath + L"program";
-    std::wstring sRenameDst = sOfficeInstallPath + L"program_old";
-
-    bool bSuccess = MoveFileW( sRenameSrc.c_str(), sRenameDst.c_str() );
-    if ( !bSuccess )
-    {
-        WCHAR sAppend[2] = L"0";
-        for ( int i = 0; i < 10; i++ )
-        {
-            sRenameDst = sOfficeInstallPath + L"program_old" + sAppend;
-            bSuccess = MoveFileW( sRenameSrc.c_str(), sRenameDst.c_str() );
-            if ( bSuccess )
-                break;
-            sAppend[0] += 1;
-        }
-    }
-
-    return bSuccess ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
-}
-
-
-/** Remove leftover program_old folder(s).
- *
- * @return
- *  ERROR_INSTALL_FAILURE when the folder cannot be removed.
- *  ERROR_SUCCESS otherwise.
- */
-extern "C" __declspec(dllexport) UINT __stdcall RemovePrgFolder( MSIHANDLE 
handle )
-{
-    std::wstring sOfficeInstallPath = GetMsiPropertyW(handle, 
L"INSTALLLOCATION");
-    std::wstring sRemoveDir = sOfficeInstallPath + L"program_old";
-
-    if (!RemoveCompleteDirectoryW(sRemoveDir))
-        return ERROR_INSTALL_FAILURE;
-
-    WCHAR sAppend[2] = L"0";
-    for ( int i = 0; i < 10; i++ )
-    {
-        sRemoveDir = sOfficeInstallPath + L"program_old" + sAppend;
-        if (!RemoveCompleteDirectoryW( sRemoveDir ))
-            return ERROR_INSTALL_FAILURE;
-        sAppend[0] += 1;
-    }
-
-    return ERROR_SUCCESS;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 14e57ef6f081..48e4c4855d01 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -10319,7 +10319,6 @@ 
setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx
 setup_native/source/win32/customactions/shellextensions/shlxtmsi.hxx
 setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx
 setup_native/source/win32/customactions/shellextensions/upgrade.cxx
-setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
 setup_native/source/win32/customactions/tools/checkversion.cxx
 setup_native/source/win32/customactions/tools/seterror.cxx
 setup_native/source/win32/customactions/tools/seterror.hxx

Reply via email to