diff options
Diffstat (limited to 'setup_native/source/win32/customactions/quickstarter')
8 files changed, 0 insertions, 488 deletions
diff --git a/setup_native/source/win32/customactions/quickstarter/exports.dxp b/setup_native/source/win32/customactions/quickstarter/exports.dxp deleted file mode 100644 index c1343f8e7..000000000 --- a/setup_native/source/win32/customactions/quickstarter/exports.dxp +++ /dev/null @@ -1,3 +0,0 @@ -InstallExecSequenceEntry -DeinstallExecSequenceEntry -
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/quickstarter/makefile.mk b/setup_native/source/win32/customactions/quickstarter/makefile.mk deleted file mode 100644 index 57b53d262..000000000 --- a/setup_native/source/win32/customactions/quickstarter/makefile.mk +++ /dev/null @@ -1,93 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -PRJ=..$/..$/..$/.. -PRJNAME=setup_native -TARGET=quickstarter -TARGET1=sdqsmsi -TARGET2=qslnkmsi - -# --- Settings ----------------------------------------------------- - -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE -NO_DEFAULT_STL=TRUE -DYNAMIC_CRT= -USE_DEFFILE=TRUE - -.INCLUDE : settings.mk - -UWINAPILIB= - -# --- Files -------------------------------------------------------- - -.IF "$(GUI)"=="WNT" && "$(WINDOWS_SDK_HOME)"!="" - -STDSHL += \ - $(ADVAPI32LIB)\ - $(SHELL32LIB)\ - $(MSILIB) - -.IF "$(COM)"=="GCC" -STDSHL+= \ - $(KERNEL32LIB)\ - -lmsvcrt -.ENDIF - -SHL1OBJS = $(SLO)$/shutdown_quickstart.obj \ - $(SLO)$/quickstarter.obj - -SHL1TARGET = $(TARGET1) -SHL1IMPLIB = i$(TARGET1) - -SHL1DEF = $(MISC)$/$(SHL1TARGET).def -SHL1BASE = 0x1c000000 -DEF1NAME=$(SHL1TARGET) -SHL1DEPN=$(SHL1OBJS) -DEF1EXPORTFILE=$(TARGET1).dxp - -# --- Files -------------------------------------------------------- - -SHL2OBJS = $(SLO)$/remove_quickstart_link.obj \ - $(SLO)$/quickstarter.obj - -SHL2TARGET = $(TARGET2) -SHL2IMPLIB = i$(TARGET2) - -SHL2DEF = $(MISC)$/$(SHL2TARGET).def -SHL2BASE = 0x1c000000 -DEF2NAME=$(SHL2TARGET) -SHL2DEPN=$(SHL1OBJS) -DEF2EXPORTFILE=$(TARGET2).dxp - -.ENDIF - -# --- Targets -------------------------------------------------------------- - -.INCLUDE : target.mk - -# ------------------------------------------------------------------------- diff --git a/setup_native/source/win32/customactions/quickstarter/qslnkmsi.dxp b/setup_native/source/win32/customactions/quickstarter/qslnkmsi.dxp deleted file mode 100644 index 56f67cc93..000000000 --- a/setup_native/source/win32/customactions/quickstarter/qslnkmsi.dxp +++ /dev/null @@ -1,2 +0,0 @@ -RemoveQuickstarterLink -
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx deleted file mode 100644 index 396b293d9..000000000 --- a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx +++ /dev/null @@ -1,223 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#include "quickstarter.hxx" -#ifdef _MSC_VER -#pragma warning(push, 1) /* disable warnings within system headers */ -#endif -#include <psapi.h> -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#include <tlhelp32.h> -#include <malloc.h> - -std::string GetOfficeInstallationPath(MSIHANDLE handle) -{ - std::string progpath; - DWORD sz = 0; - LPTSTR dummy = TEXT(""); - - if (MsiGetProperty(handle, TEXT("INSTALLLOCATION"), dummy, &sz) == ERROR_MORE_DATA) - { - sz++; // space for the final '\0' - DWORD nbytes = sz * sizeof(TCHAR); - LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); - ZeroMemory(buff, nbytes); - MsiGetProperty(handle, TEXT("INSTALLLOCATION"), buff, &sz); - progpath = buff; - } - return progpath; -} - -std::string GetOfficeProductName(MSIHANDLE handle) -{ - std::string productname; - DWORD sz = 0; - LPTSTR dummy = TEXT(""); - - if (MsiGetProperty(handle, TEXT("ProductName"), dummy, &sz) == ERROR_MORE_DATA) - { - sz++; // space for the final '\0' - DWORD nbytes = sz * sizeof(TCHAR); - LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); - ZeroMemory(buff, nbytes); - MsiGetProperty(handle, TEXT("ProductName"), buff, &sz); - productname = buff; - } - return productname; -} - -std::string GetQuickstarterLinkName(MSIHANDLE handle) -{ - std::string quickstarterlinkname; - DWORD sz = 0; - LPTSTR dummy = TEXT(""); - - if (MsiGetProperty(handle, TEXT("Quickstarterlinkname"), dummy, &sz) == ERROR_MORE_DATA) - { - sz++; // space for the final '\0' - DWORD nbytes = sz * sizeof(TCHAR); - LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); - ZeroMemory(buff, nbytes); - MsiGetProperty(handle, TEXT("Quickstarterlinkname"), buff, &sz); - quickstarterlinkname = buff; - } - else if (MsiGetProperty(handle, TEXT("ProductName"), dummy, &sz) == ERROR_MORE_DATA) - { - sz++; // space for the final '\0' - DWORD nbytes = sz * sizeof(TCHAR); - LPTSTR buff = reinterpret_cast<LPTSTR>(_alloca(nbytes)); - ZeroMemory(buff, nbytes); - MsiGetProperty(handle, TEXT("ProductName"), buff, &sz); - quickstarterlinkname = buff; - } - return quickstarterlinkname; -} - -inline bool IsValidHandle( HANDLE handle ) -{ - return NULL != handle && INVALID_HANDLE_VALUE != handle; -} - - -static HANDLE WINAPI _CreateToolhelp32Snapshot( DWORD dwFlags, DWORD th32ProcessID ) -{ - typedef HANDLE (WINAPI *FN_PROC)( DWORD dwFlags, DWORD th32ProcessID ); - static FN_PROC lpProc = NULL; - - HANDLE hSnapshot = NULL; - - if ( !lpProc ) - { - HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); - - if ( hLibrary ) - lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "CreateToolhelp32Snapshot" )); - } - - if ( lpProc ) - hSnapshot = lpProc( dwFlags, th32ProcessID ); - - return hSnapshot; -} - -static BOOL WINAPI _Process32First( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ) -{ - typedef BOOL (WINAPI *FN_PROC)( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ); - static FN_PROC lpProc = NULL; - - BOOL fSuccess = FALSE; - - if ( !lpProc ) - { - HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); - - if ( hLibrary ) - lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "Process32First" )); - } - - if ( lpProc ) - fSuccess = lpProc( hSnapshot, lppe32 ); - - return fSuccess; -} - -static BOOL WINAPI _Process32Next( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ) -{ - typedef BOOL (WINAPI *FN_PROC)( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ); - static FN_PROC lpProc = NULL; - - BOOL fSuccess = FALSE; - - if ( !lpProc ) - { - HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); - - if ( hLibrary ) - lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "Process32Next" )); - } - - if ( lpProc ) - fSuccess = lpProc( hSnapshot, lppe32 ); - - return fSuccess; -} - -static std::string GetProcessImagePath_9x( DWORD dwProcessId ) -{ - std::string sImagePath; - - HANDLE hSnapshot = _CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); - - if ( IsValidHandle( hSnapshot ) ) - { - PROCESSENTRY32 pe32 = { 0 }; - - pe32.dwSize = sizeof(PROCESSENTRY32); - - BOOL fSuccess = _Process32First( hSnapshot, &pe32 ); - bool found = false; - - while ( !found && fSuccess ) - { - if ( pe32.th32ProcessID == dwProcessId ) - { - found = true; - sImagePath = pe32.szExeFile; - } - - if ( !found ) - fSuccess = _Process32Next( hSnapshot, &pe32 ); - } - - CloseHandle( hSnapshot ); - } - - return sImagePath; -} - -static DWORD WINAPI _GetModuleFileNameExA( HANDLE hProcess, HMODULE hModule, LPSTR lpFileName, DWORD nSize ) -{ - typedef DWORD (WINAPI *FN_PROC)( HANDLE hProcess, HMODULE hModule, LPSTR lpFileName, DWORD nSize ); - - static FN_PROC lpProc = NULL; - - if ( !lpProc ) - { - HMODULE hLibrary = LoadLibrary("PSAPI.DLL"); - - if ( hLibrary ) - lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "GetModuleFileNameExA" )); - } - - if ( lpProc ) - return lpProc( hProcess, hModule, lpFileName, nSize ); - - return 0; - -} - -static std::string GetProcessImagePath_NT( DWORD dwProcessId ) -{ - std::string sImagePath; - - HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId ); - - if ( IsValidHandle( hProcess ) ) - { - CHAR szPathBuffer[MAX_PATH] = ""; - - if ( _GetModuleFileNameExA( hProcess, NULL, szPathBuffer, sizeof(szPathBuffer) ) ) - sImagePath = szPathBuffer; - - CloseHandle( hProcess ); - } - - return sImagePath; -} - -std::string GetProcessImagePath( DWORD dwProcessId ) -{ - return (LONG)GetVersion() < 0 ? GetProcessImagePath_9x( dwProcessId ) : GetProcessImagePath_NT( dwProcessId ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.hxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.hxx deleted file mode 100644 index d02532e08..000000000 --- a/setup_native/source/win32/customactions/quickstarter/quickstarter.hxx +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#pragma once - -#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 <string> - -std::string GetOfficeInstallationPath(MSIHANDLE handle); -std::string GetOfficeProductName(MSIHANDLE handle); -std::string GetQuickstarterLinkName(MSIHANDLE handle); -std::string GetProcessImagePath( DWORD dwProcessId ); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx b/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx deleted file mode 100644 index d61309c98..000000000 --- a/setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx +++ /dev/null @@ -1,63 +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. - * - ************************************************************************/ - -#ifdef _MSC_VER -#pragma warning(push, 1) /* disable warnings within system headers */ -#pragma warning(disable: 4917) -#endif -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <shlobj.h> -#include <msiquery.h> -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#include <string> -#include "quickstarter.hxx" - - -extern "C" UINT __stdcall RemoveQuickstarterLink( MSIHANDLE hMSI ) -{ - CHAR szStartupPath[MAX_PATH]; - - if ( SHGetSpecialFolderPathA( NULL, szStartupPath, CSIDL_STARTUP, FALSE ) ) - { - std::string sQuickstartLinkPath = szStartupPath; - - sQuickstartLinkPath += "\\"; - sQuickstartLinkPath += GetQuickstarterLinkName( hMSI ); - sQuickstartLinkPath += ".lnk"; - - DeleteFileA( sQuickstartLinkPath.c_str() ); - } - - return ERROR_SUCCESS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/setup_native/source/win32/customactions/quickstarter/sdqsmsi.dxp b/setup_native/source/win32/customactions/quickstarter/sdqsmsi.dxp deleted file mode 100644 index 49ec00aff..000000000 --- a/setup_native/source/win32/customactions/quickstarter/sdqsmsi.dxp +++ /dev/null @@ -1,2 +0,0 @@ -ShutDownQuickstarter -
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx b/setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx deleted file mode 100644 index 96a30f7de..000000000 --- a/setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx +++ /dev/null @@ -1,81 +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. - * - ************************************************************************/ - -#include "quickstarter.hxx" -#include <sfx2/qswin32.h> - -static BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam ) -{ - MSIHANDLE hMSI = static_cast< MSIHANDLE >( lParam ); - CHAR szClassName[sizeof(QUICKSTART_CLASSNAMEA) + 1]; - - int nCharsCopied = GetClassName( hWnd, szClassName, sizeof( szClassName ) ); - - if ( nCharsCopied && !stricmp( QUICKSTART_CLASSNAMEA, szClassName ) ) - { - DWORD dwProcessId; - - if ( GetWindowThreadProcessId( hWnd, &dwProcessId ) ) - { - std::string sImagePath = GetProcessImagePath( dwProcessId ); - std::string sOfficeImageDir = GetOfficeInstallationPath( hMSI ) + "program\\"; - - if ( !strnicmp( sImagePath.c_str(), sOfficeImageDir.c_str(), sOfficeImageDir.length() ) ) - { - UINT uMsgShutdownQuickstart = RegisterWindowMessageA( SHUTDOWN_QUICKSTART_MESSAGEA ); - - if ( uMsgShutdownQuickstart ) - SendMessageA( hWnd, uMsgShutdownQuickstart, 0, 0 ); - - - HANDLE hProcess = OpenProcess( SYNCHRONIZE, FALSE, dwProcessId ); - - if ( hProcess ) - { - WaitForSingleObject( hProcess, 30000 ); // Wait at most 30 seconds for process to terminate - CloseHandle( hProcess ); - } - - return FALSE; - } - - } - } - - return TRUE; -} - - -extern "C" UINT __stdcall ShutDownQuickstarter( MSIHANDLE hMSI ) -{ - EnumWindows( EnumWindowsProc, hMSI ); - - return ERROR_SUCCESS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |