2006-04-26 21:43:56 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
|
|
|
//
|
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This software 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 for more details.
|
|
|
|
//
|
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
2007-10-09 11:35:47 +00:00
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2006-04-26 21:43:56 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "boinccas.h"
|
2007-02-12 21:41:48 +00:00
|
|
|
#include "terminate.h"
|
2006-04-26 21:43:56 +00:00
|
|
|
#include "CAShutdownBOINC.h"
|
|
|
|
|
|
|
|
#define CUSTOMACTION_NAME _T("CAShutdownBOINC")
|
|
|
|
#define CUSTOMACTION_PROGRESSTITLE _T("Shutting down running instances of BOINC")
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Function:
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
CAShutdownBOINC::CAShutdownBOINC(MSIHANDLE hMSIHandle) :
|
|
|
|
BOINCCABase(hMSIHandle, CUSTOMACTION_NAME, CUSTOMACTION_PROGRESSTITLE)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Function:
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
CAShutdownBOINC::~CAShutdownBOINC()
|
|
|
|
{
|
|
|
|
BOINCCABase::~BOINCCABase();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Function:
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
2006-04-27 18:45:15 +00:00
|
|
|
|
|
|
|
// OpenSCManager()
|
|
|
|
typedef SC_HANDLE (WINAPI *tOSCM)(
|
2007-02-12 21:41:48 +00:00
|
|
|
LPCWSTR lpMachineName,
|
|
|
|
LPCWSTR lpDatabaseName,
|
|
|
|
DWORD dwDesiredAccess
|
2006-04-27 18:45:15 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// OpenService()
|
|
|
|
typedef SC_HANDLE (WINAPI *tOS)(
|
|
|
|
SC_HANDLE hSCManager,
|
2007-02-12 21:41:48 +00:00
|
|
|
LPCWSTR lpServiceName,
|
2006-04-27 18:45:15 +00:00
|
|
|
DWORD dwDesiredAccess
|
|
|
|
);
|
|
|
|
|
|
|
|
// ControlService()
|
|
|
|
typedef SC_HANDLE (WINAPI *tCS)(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
DWORD dwControl,
|
|
|
|
LPSERVICE_STATUS lpServiceStatus
|
|
|
|
);
|
|
|
|
|
2006-06-21 19:43:03 +00:00
|
|
|
// QueryServiceStatus()
|
|
|
|
typedef BOOL (WINAPI *tQSS)(
|
|
|
|
SC_HANDLE hService,
|
|
|
|
LPSERVICE_STATUS lpServiceStatus
|
|
|
|
);
|
|
|
|
|
2006-04-26 21:43:56 +00:00
|
|
|
UINT CAShutdownBOINC::OnExecution()
|
|
|
|
{
|
|
|
|
SC_HANDLE schSCManager = NULL;
|
|
|
|
SC_HANDLE schService = NULL;
|
|
|
|
SERVICE_STATUS ssStatus;
|
|
|
|
|
2007-11-30 16:31:30 +00:00
|
|
|
schSCManager = OpenSCManager(
|
|
|
|
NULL, // local machine
|
|
|
|
NULL, // ServicesActive database
|
|
|
|
GENERIC_READ); // full access rights
|
|
|
|
|
|
|
|
if (schSCManager)
|
|
|
|
{
|
|
|
|
schService = OpenService(
|
|
|
|
schSCManager, // SCM database
|
|
|
|
_T("BOINC"), // service name
|
|
|
|
GENERIC_READ | GENERIC_EXECUTE);
|
|
|
|
|
|
|
|
if (schService)
|
2006-04-26 21:43:56 +00:00
|
|
|
{
|
2007-11-30 16:31:30 +00:00
|
|
|
if (QueryServiceStatus(schService, &ssStatus))
|
2006-04-26 21:43:56 +00:00
|
|
|
{
|
2007-11-30 16:31:30 +00:00
|
|
|
if (!((SERVICE_STOPPED == ssStatus.dwCurrentState) &&
|
|
|
|
(SERVICE_STOP_PENDING == ssStatus.dwCurrentState)))
|
2006-04-27 18:45:15 +00:00
|
|
|
{
|
2008-02-01 22:08:48 +00:00
|
|
|
ControlService(schService, SERVICE_CONTROL_STOP, &ssStatus);
|
2006-04-27 18:45:15 +00:00
|
|
|
}
|
2006-04-26 21:43:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-27 18:45:15 +00:00
|
|
|
if (schSCManager)
|
|
|
|
CloseServiceHandle(schSCManager);
|
2006-04-26 21:43:56 +00:00
|
|
|
|
2006-04-27 18:45:15 +00:00
|
|
|
if (schService)
|
|
|
|
CloseServiceHandle(schService);
|
|
|
|
}
|
2006-04-26 21:43:56 +00:00
|
|
|
|
2007-02-14 22:42:58 +00:00
|
|
|
TerminateProcessEx( tstring(_T("boinc.exe")) );
|
- WINSETUP: Update CACreateBOINCUsers.
- WINSETUP: Create CACreateBOINCGroups.
- WINSETUP: Create CAGrantBOINCMasterRights.
- WINSETUP: Create CAGrantBOINCProjectRights.
- WINSETUP: Remove CACreateVBSShortcut.
- WINSETUP: Remove CAGrantServiceExecutionRight.
- WINSETUP: Remove CAMigrateCPDNBBC.
- WINSETUP: Remove CAPopulateServiceAccount.
- WINSETUP: Remove CAValidateServiceAccount.
- WINSETUP: Remove CAVerifyServiceExecutionRight.
- WINSETUP: Remove CAVerifyServicePassword.
- WINSETUP: Hookup new custom actions
NOTE: For some reason the advanced configuration screen
checkboxes are not working, so the CA's are setup to run
always to test them out.
win_build/installerv2/
BOINC.ism
win_build/installerv2/redist/Windows/src/boinccas/
CAGrantServiceExecutionRight.cpp, .h (removed)
CAMigrateCPDNBBC.cpp, .h (removed)
CAPopulateServiceAccount.cpp, .h (removed)
CAValidateServiceAccount.cpp, .h (removed)
CAVerifyServiceExecutionRight.cpp, .h (removed)
CAVerifyServicePassword.cpp, .h (removed)
CACreateBOINCUsers.cpp
CACreateBOINCGroups.cpp, .h (added)
CAGrantBOINCMasterRights.cpp, .h (added)
CAGrantBOINCProjectRights.cpp, .h (added)
svn path=/trunk/boinc/; revision=14313
2007-11-28 15:10:21 +00:00
|
|
|
TerminateProcessEx( tstring(_T("boinctray.exe")) );
|
2006-06-22 02:26:22 +00:00
|
|
|
return ERROR_SUCCESS;
|
2006-04-26 21:43:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Function: ShutdownBOINCManager
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
UINT __stdcall ShutdownBOINC(MSIHANDLE hInstall)
|
|
|
|
{
|
|
|
|
UINT uiReturnValue = 0;
|
|
|
|
|
|
|
|
CAShutdownBOINC* pCA = new CAShutdownBOINC(hInstall);
|
|
|
|
uiReturnValue = pCA->Execute();
|
|
|
|
delete pCA;
|
|
|
|
|
|
|
|
return uiReturnValue;
|
|
|
|
}
|