diff options
author | Andras Timar <atimar@suse.com> | 2012-06-12 22:04:04 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-06-12 22:07:05 +0200 |
commit | 1505ba77d8051dbcf1ff681c55031ea2f6a1b83b (patch) | |
tree | 39027572379ea1845a74643819fed74b265a1bad /setup_native | |
parent | -Werror,-Wunused-function (diff) | |
download | core-1505ba77d8051dbcf1ff681c55031ea2f6a1b83b.tar.gz core-1505ba77d8051dbcf1ff681c55031ea2f6a1b83b.zip |
delete problematic IsOfficeRunning custom action
Change-Id: Id68521b92f572366a68f35c09387a7ed45a835ff
Diffstat (limited to 'setup_native')
8 files changed, 1 insertions, 331 deletions
diff --git a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx b/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx deleted file mode 100644 index ff1efc050293..000000000000 --- a/setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define _WIN32_WINDOWS 0x0410 - -#ifdef _MSC_VER -#pragma warning(push, 1) /* disable warnings within system headers */ -#endif -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <msiquery.h> -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#include <malloc.h> -#include <assert.h> - -#ifdef UNICODE -#define _UNICODE -#define _tstring wstring -#else -#define _tstring string -#endif -#include <tchar.h> -#include <string> -#include <queue> -#include <stdio.h> -#include <sal/macros.h> - -#include <systools/win32/uwinapi.h> -#include <../tools/seterror.hxx> - -#ifdef DEBUG -inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) -{ - _TCHAR buffer[1024]; - va_list args; - - va_start( args, pFormat ); - _vsntprintf( buffer, SAL_N_ELEMENTS(buffer), pFormat, args ); - OutputDebugString( buffer ); -} -#else -static inline void OutputDebugStringFormat( LPCTSTR, ... ) -{ -} -#endif - -static std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sProperty ) -{ - std::_tstring 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; -} - -static inline bool IsSetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) -{ - std::_tstring value = GetMsiProperty(handle, sProperty); - return (value.length() > 0); -} - -static inline void UnsetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) -{ - MsiSetProperty(handle, sProperty.c_str(), NULL); -} - -static inline void SetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty) -{ - MsiSetProperty(handle, sProperty.c_str(), TEXT("1")); -} - -extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) -{ - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); - std::_tstring sResourceDir = sInstDir + TEXT("Basis\\program\\resource\\"); - std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); - - WIN32_FIND_DATA aFindFileData; - HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData ); - - if ( IsValidHandle(hFind) ) - { - BOOL fSuccess = false; - bool fRenameSucceeded; - - do - { - std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName; - std::_tstring sIntermediate = sResourceFile + TEXT(".tmp"); - - fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING ); - if ( fRenameSucceeded ) - { - MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 ); - fSuccess = FindNextFile( hFind, &aFindFileData ); - } - } while ( fSuccess && fRenameSucceeded ); - - if ( !fRenameSucceeded ) - { - MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1")); - SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING ); - } - - FindClose( hFind ); - } - - return ERROR_SUCCESS; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/setup_native/source/win32/customactions/languagepacks/exports.dxp b/setup_native/source/win32/customactions/languagepacks/exports.dxp index c098a38d547f..eb3e3c34829a 100644 --- a/setup_native/source/win32/customactions/languagepacks/exports.dxp +++ b/setup_native/source/win32/customactions/languagepacks/exports.dxp @@ -1,6 +1,5 @@ SetProductInstallationPath RegisterLanguagePack GetUserInstallMode -IsOfficeRunning RegisterExtensions diff --git a/setup_native/source/win32/customactions/languagepacks/makefile.mk b/setup_native/source/win32/customactions/languagepacks/makefile.mk index 94eab3a0109c..f30ec08c0f6b 100644 --- a/setup_native/source/win32/customactions/languagepacks/makefile.mk +++ b/setup_native/source/win32/customactions/languagepacks/makefile.mk @@ -49,8 +49,7 @@ CDEFS+=-Dnot_used_define_to_disable_pch UWINAPILIB= SLOFILES = $(SLO)$/lngpckinsthelper.obj \ - $(SLO)$/respintest.obj \ - $(SLO)$/checkrunningofficelanguagepack.obj + $(SLO)$/respintest.obj STDSHL+= \ $(ADVAPI32LIB) \ diff --git a/setup_native/source/win32/customactions/patch/exports.dxp b/setup_native/source/win32/customactions/patch/exports.dxp index dd5eb4dcf7c8..360156e6c25b 100755 --- a/setup_native/source/win32/customactions/patch/exports.dxp +++ b/setup_native/source/win32/customactions/patch/exports.dxp @@ -3,7 +3,6 @@ UninstallPatchedFiles GetUserInstallMode SetProductInstallMode ShutDownQuickstarter -IsOfficeRunning SetFeatureState SetNewFeatureState ShowOnlineUpdateDialog diff --git a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx index c0c6fd278efa..7f83ca57b29f 100644 --- a/setup_native/source/win32/customactions/patch/swappatchfiles.cxx +++ b/setup_native/source/win32/customactions/patch/swappatchfiles.cxx @@ -576,46 +576,6 @@ extern "C" UINT __stdcall UninstallPatchedFiles( MSIHANDLE handle ) return ERROR_SUCCESS; } -extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) -{ - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); - std::_tstring sResourceDir = sInstDir + TEXT("program\\resource\\"); - std::_tstring sPattern = sResourceDir + TEXT("vcl*.res"); - - WIN32_FIND_DATA aFindFileData; - HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData ); - - if ( IsValidHandle(hFind) ) - { - BOOL fSuccess = false; - bool fRenameSucceeded; - - do - { - std::_tstring sResourceFile = sResourceDir + aFindFileData.cFileName; - std::_tstring sIntermediate = sResourceFile + TEXT(".tmp"); - - fRenameSucceeded = MoveFileExA( sResourceFile.c_str(), sIntermediate.c_str(), MOVEFILE_REPLACE_EXISTING ); - if ( fRenameSucceeded ) - { - MoveFileExA( sIntermediate.c_str(), sResourceFile.c_str(), 0 ); - fSuccess = FindNextFile( hFind, &aFindFileData ); - } - } while ( fSuccess && fRenameSucceeded ); - - if ( !fRenameSucceeded ) - { - MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1")); - SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING ); - } - - FindClose( hFind ); - } - - - return ERROR_SUCCESS; -} - extern "C" UINT __stdcall SetFeatureState( MSIHANDLE handle ) { diff --git a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx b/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx deleted file mode 100644 index c1319e25e98c..000000000000 --- a/setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define _WIN32_WINDOWS 0x0410 - -#ifdef _MSC_VER -#pragma warning(push, 1) /* disable warnings within system headers */ -#endif -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <msiquery.h> -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#include <malloc.h> -#include <assert.h> - -#ifdef UNICODE -#define _UNICODE -#define _tstring wstring -#else -#define _tstring string -#endif -#include <tchar.h> -#include <string> -#include <queue> -#include <stdio.h> -#include <sal/macros.h> - -// works with Windows XP as well as with Windows 7 -#define PSAPI_VERSION 1 -#include <psapi.h> - -#include <systools/win32/uwinapi.h> -#include <../tools/seterror.hxx> - -#ifdef DEBUG -inline void OutputDebugStringFormat( LPCTSTR pFormat, ... ) -{ - _TCHAR buffer[1024]; - va_list args; - - va_start( args, pFormat ); - _vsntprintf( buffer, SAL_N_ELEMENTS(buffer), pFormat, args ); - OutputDebugString( buffer ); -} -#else -static inline void OutputDebugStringFormat( LPCTSTR, ... ) -{ -} -#endif - -static std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sProperty ) -{ - std::_tstring 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; -} - -extern "C" UINT __stdcall IsOfficeRunning( MSIHANDLE handle ) -{ - std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION")); - // Property empty -> no office installed - if ( sOfficeInstallPath.length() == 0 ) - return ERROR_SUCCESS; - - DWORD aProcesses[1024], cbNeeded, cProcesses; /* 1024 processes ought to be enough for anybody */ - - if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) ) - return ERROR_INSTALL_FAILURE; - - cProcesses = cbNeeded / sizeof(DWORD); - - // Check if there is "soffice.bin" among the processes - for ( unsigned int i = 0; i < cProcesses; i++ ) - { - if( aProcesses[i] != 0 ) - { - TCHAR szProcessName[MAX_PATH] = TEXT("<unknown>"); - HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i] ); - if (NULL != hProcess ) - { - HMODULE hMod; - if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) ) - GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName)/sizeof(TCHAR) ); - } - CloseHandle( hProcess ); - if ( _tcscmp( szProcessName, TEXT("soffice.bin") ) == 0 ) - { - MsiSetProperty( handle, TEXT("OFFICERUNS"), TEXT("1") ); - SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING ); - } - } - } - return ERROR_SUCCESS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/setup_native/source/win32/customactions/shellextensions/exports.dxp b/setup_native/source/win32/customactions/shellextensions/exports.dxp index 4e2611946586..474df7651882 100644 --- a/setup_native/source/win32/customactions/shellextensions/exports.dxp +++ b/setup_native/source/win32/customactions/shellextensions/exports.dxp @@ -16,6 +16,5 @@ ShowProperties copyEditionData RenamePrgFolder RemovePrgFolder -IsOfficeRunning CheckPatchList copyExtensionData diff --git a/setup_native/source/win32/customactions/shellextensions/makefile.mk b/setup_native/source/win32/customactions/shellextensions/makefile.mk index 3a15e3510cbe..fbebd6e1bb87 100644 --- a/setup_native/source/win32/customactions/shellextensions/makefile.mk +++ b/setup_native/source/win32/customactions/shellextensions/makefile.mk @@ -61,7 +61,6 @@ SLOFILES = \ $(SLO)$/registerextensions.obj \ $(SLO)$/copyeditiondata.obj \ $(SLO)$/vistaspecial.obj \ - $(SLO)$/checkrunningoffice.obj \ $(SLO)$/checkpatches.obj \ $(SLO)$/copyextensiondata.obj |