diff --git a/checkin_notes b/checkin_notes index 2e7662d33c..61e76503c4 100755 --- a/checkin_notes +++ b/checkin_notes @@ -4220,3 +4220,14 @@ Charlie 27 Apr 06 HowToBuildBOINC_XCode.rtf boinc.xcodeproj/ project.pbxproj + +Rom 27 Apr 2006 + - Bug Fix: Create a BOINC Service shutdown custom action for the installer + since the installer technology wants to wait until after it has found + out which files are in use to shutdown the service. + + win_build/installerv2/redist/Windows/src/boinccas/ + CAShutdownBOINC.cpp, .h (Added) + win_build/installerv2/redist/Windows/x86/ + boinccas95.dll + boinccas.dll diff --git a/win_build/installerv2/BOINC.ism b/win_build/installerv2/BOINC.ism index 94df506bc7..0fdaadede5 100644 Binary files a/win_build/installerv2/BOINC.ism and b/win_build/installerv2/BOINC.ism differ diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CAShutdownBOINC.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CAShutdownBOINC.cpp index 3dddb97127..a41f2dbe5a 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/CAShutdownBOINC.cpp +++ b/win_build/installerv2/redist/Windows/src/boinccas/CAShutdownBOINC.cpp @@ -58,39 +58,81 @@ CAShutdownBOINC::~CAShutdownBOINC() // Description: // ///////////////////////////////////////////////////////////////////// + +// OpenSCManager() +typedef SC_HANDLE (WINAPI *tOSCM)( + LPCSTR lpMachineName, + LPCSTR lpDatabaseName, + DWORD dwDesiredAccess +); + +// OpenService() +typedef SC_HANDLE (WINAPI *tOS)( + SC_HANDLE hSCManager, + LPCSTR lpServiceName, + DWORD dwDesiredAccess +); + +// ControlService() +typedef SC_HANDLE (WINAPI *tCS)( + SC_HANDLE hService, + DWORD dwControl, + LPSERVICE_STATUS lpServiceStatus +); + UINT CAShutdownBOINC::OnExecution() { SC_HANDLE schSCManager = NULL; SC_HANDLE schService = NULL; SERVICE_STATUS ssStatus; UINT uiReturn = ERROR_SUCCESS; + tOSCM pOSCM = NULL; + tOS pOS = NULL; + tCS pCS = NULL; - 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) - { - if (!ControlService(schService, SERVICE_CONTROL_STOP, &ssStatus)) - { - uiReturn = ERROR_INSTALL_FAILURE; - } + HMODULE hAdvapi32 = LoadLibrary(_T("advapi32.dll")); + if (hAdvapi32) { + pOSCM = (tOSCM)GetProcAddress(hAdvapi32, _T("OpenSCManagerA")); + pOS = (tOS)GetProcAddress(hAdvapi32, _T("OpenServiceA")); + pCS = (tCS)GetProcAddress(hAdvapi32, _T("ControlService")); + if (!pOSCM && !pOS && !pCS) { + FreeLibrary(hAdvapi32); + hAdvapi32 = NULL; + pOSCM = NULL; + pOS = NULL; + pCS = NULL; } } - if (schSCManager) - CloseServiceHandle(schSCManager); + if (pOSCM && pOS && pCS) { + schSCManager = pOSCM( + NULL, // local machine + NULL, // ServicesActive database + GENERIC_READ); // full access rights - if (schService) - CloseServiceHandle(schService); + if (schSCManager) + { + schService = pOS( + schSCManager, // SCM database + _T("BOINC"), // service name + GENERIC_READ | GENERIC_EXECUTE); + + if (schService) + { + if (!pCS(schService, SERVICE_CONTROL_STOP, &ssStatus)) + { + uiReturn = ERROR_INSTALL_FAILURE; + } + } + } + + if (schSCManager) + CloseServiceHandle(schSCManager); + + if (schService) + CloseServiceHandle(schService); + } return uiReturn; } diff --git a/win_build/installerv2/redist/Windows/x86/boinccas.dll b/win_build/installerv2/redist/Windows/x86/boinccas.dll index 48eafac29c..4aa5363e8f 100644 Binary files a/win_build/installerv2/redist/Windows/x86/boinccas.dll and b/win_build/installerv2/redist/Windows/x86/boinccas.dll differ diff --git a/win_build/installerv2/redist/Windows/x86/boinccas95.dll b/win_build/installerv2/redist/Windows/x86/boinccas95.dll index 0b10f52f31..da64f847d4 100644 Binary files a/win_build/installerv2/redist/Windows/x86/boinccas95.dll and b/win_build/installerv2/redist/Windows/x86/boinccas95.dll differ