From 2b399ada16ea7969cb981653b98717ae5a77c8f5 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 5 Jan 2007 08:49:02 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11773 --- checkin_notes | 24 ++ .../Windows/src/boinccas/CAMigrateCPDNBBC.cpp | 49 ++-- .../src/boinccas/CARestoreSetupState.cpp | 110 +++++++++ ...reNeedsUpgrade.h => CARestoreSetupState.h} | 17 +- .../Windows/src/boinccas/CASaveSetupState.cpp | 110 +++++++++ .../Windows/src/boinccas/CASaveSetupState.h | 37 +++ .../src/boinccas/CASoftwareNeedsUpgrade.cpp | 231 ------------------ .../src/boinccas/CAVerifyServicePassword.cpp | 6 +- .../redist/Windows/src/boinccas/boinccas.cpp | 150 ++++++++++++ .../redist/Windows/src/boinccas/boinccas.h | 17 +- .../redist/Windows/src/boinccas/boinccas.rc | 8 +- .../Windows/src/boinccas/boinccas95.def | 2 + .../Windows/src/boinccas/boinccas95.vcproj | 12 + .../redist/Windows/x86/boinccas.dll | Bin 81920 -> 81920 bytes .../redist/Windows/x86/boinccas95.dll | Bin 69632 -> 73728 bytes 15 files changed, 506 insertions(+), 267 deletions(-) create mode 100644 win_build/installerv2/redist/Windows/src/boinccas/CARestoreSetupState.cpp rename win_build/installerv2/redist/Windows/src/boinccas/{CASoftwareNeedsUpgrade.h => CARestoreSetupState.h} (72%) create mode 100644 win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.cpp create mode 100644 win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.h delete mode 100644 win_build/installerv2/redist/Windows/src/boinccas/CASoftwareNeedsUpgrade.cpp diff --git a/checkin_notes b/checkin_notes index 27cca45201..8bbf15a6f5 100755 --- a/checkin_notes +++ b/checkin_notes @@ -106,3 +106,27 @@ David 4 Jan 2007 app_start.C clientgui/ WelcomePage.cpp + +Rom 5 Jan 2007 + - Win SETUP: Add custom actions for saving and restoring user preferences + to the registry + - Win SETUP: MoveFileEx isn't spported on the Win9x platform, so dynamically + load and execute it on Windows 2000 or better. + - Win SETUP: Remove some dead code from the custom action list. + - Win SETUP: On Windows XP systems or better, we no longer require the + service account to have a password, Microsoft has taken care of the + problem by not allowing incomming network connections for accounts with + no passwords. + + win_build/installerv2/redist/Windows/src/boinccas/ + CAMigrateCPDNBBC.cpp + CARestoreSetupState.cpp, .h + CASaveSetupState.cpp, .h + CASoftwareNeedsUpgrade.cpp, .h (Removed) + CAVerifyServicePassword.cpp + boinccas.cpp, .h + boinccas.rc + boinccas95.def + win_build/installerv2/redist/Windows/x86/ + boinccas.dll + boinccas95.dll diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateCPDNBBC.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateCPDNBBC.cpp index e76ecdf94b..cca851fe2b 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateCPDNBBC.cpp +++ b/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateCPDNBBC.cpp @@ -58,32 +58,45 @@ CAMigrateCPDNBBC::~CAMigrateCPDNBBC() // Description: // ///////////////////////////////////////////////////////////////////// - - UINT CAMigrateCPDNBBC::OnExecution() { + typedef BOOL (WINAPI *tMFE)( LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, DWORD dwFlags ); + tstring strInstallDirectory; UINT uiReturnValue = -1; BOOL bReturnValue = FALSE; + HMODULE hKernel32Lib = NULL; + tMFE pMFE = NULL; - uiReturnValue = GetProperty( _T("INSTALLDIR"), strInstallDirectory ); - if ( uiReturnValue ) return uiReturnValue; - bReturnValue = MoveFileEx( - _T("C:\\Program Files\\Climate Change Experiment"), - strInstallDirectory.c_str(), - MOVEFILE_COPY_ALLOWED|MOVEFILE_WRITE_THROUGH - ); - if ( bReturnValue ) - { - LogMessage( - INSTALLMESSAGE_INFO, - NULL, - NULL, - NULL, - NULL, - _T("Climate Change Experiment files have been migrated to the installation directory.") + // Dynamically link to the proper function pointers. + hKernel32Lib = GetModuleHandle("kernel32.dll"); +#ifdef _UNICODE + pMFE = (tMFE) GetProcAddress( hKernel32Lib, "MoveFileExW" ); +#else + pMFE = (tMFE) GetProcAddress( hKernel32Lib, "MoveFileExA" ); +#endif + + if (pMFE) { + uiReturnValue = GetProperty( _T("INSTALLDIR"), strInstallDirectory ); + if ( uiReturnValue ) return uiReturnValue; + + bReturnValue = pMFE( + _T("C:\\Program Files\\Climate Change Experiment"), + strInstallDirectory.c_str(), + MOVEFILE_COPY_ALLOWED|MOVEFILE_WRITE_THROUGH ); + if ( bReturnValue ) + { + LogMessage( + INSTALLMESSAGE_INFO, + NULL, + NULL, + NULL, + NULL, + _T("Climate Change Experiment files have been migrated to the installation directory.") + ); + } } return ERROR_SUCCESS; } diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CARestoreSetupState.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CARestoreSetupState.cpp new file mode 100644 index 0000000000..20600c2c69 --- /dev/null +++ b/win_build/installerv2/redist/Windows/src/boinccas/CARestoreSetupState.cpp @@ -0,0 +1,110 @@ +// 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., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#include "stdafx.h" +#include "boinccas.h" +#include "CARestoreSetupState.h" + +#define CUSTOMACTION_NAME _T("CARestoreSetupState") +#define CUSTOMACTION_PROGRESSTITLE _T("Restore the previous setups saved parameters.") + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +CARestoreSetupState::CARestoreSetupState(MSIHANDLE hMSIHandle) : + BOINCCABase(hMSIHandle, CUSTOMACTION_NAME, CUSTOMACTION_PROGRESSTITLE) +{} + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +CARestoreSetupState::~CARestoreSetupState() +{ + BOINCCABase::~BOINCCABase(); +} + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +UINT CARestoreSetupState::OnExecution() +{ + tstring strInstallDirectory; + tstring strSetupType; + tstring strLaunchProgram; + tstring strEnableLaunchAtLogon; + tstring strEnableScreensaver; + tstring strServiceDomain; + tstring strServiceUsername; + + GetRegistryValue( _T("INSTALLDIR"), strInstallDirectory ); + GetRegistryValue( _T("SETUPTYPE"), strSetupType ); + GetRegistryValue( _T("LAUNCHPROGRAM"), strLaunchProgram ); + GetRegistryValue( _T("ENABLELAUNCHATLOGON"), strEnableLaunchAtLogon ); + GetRegistryValue( _T("ENABLESCREENSAVER"), strEnableScreensaver ); + GetRegistryValue( _T("SERVICE_DOMAIN"), strServiceDomain ); + GetRegistryValue( _T("SERVICE_USERNAME"), strServiceUsername ); + + SetProperty( _T("INSTALLDIR"), strInstallDirectory ); + SetProperty( _T("SETUPTYPE"), strSetupType ); + SetProperty( _T("LAUNCHPROGRAM"), strLaunchProgram ); + SetProperty( _T("ENABLELAUNCHATLOGON"), strEnableLaunchAtLogon ); + SetProperty( _T("ENABLESCREENSAVER"), strEnableScreensaver ); + SetProperty( _T("SERVICE_DOMAIN"), strServiceDomain ); + SetProperty( _T("SERVICE_USERNAME"), strServiceUsername ); + + return ERROR_SUCCESS; +} + + +///////////////////////////////////////////////////////////////////// +// +// Function: RestoreSetupState +// +// Description: +// +///////////////////////////////////////////////////////////////////// +UINT __stdcall RestoreSetupState(MSIHANDLE hInstall) +{ + UINT uiReturnValue = 0; + + CARestoreSetupState* pCA = new CARestoreSetupState(hInstall); + uiReturnValue = pCA->Execute(); + delete pCA; + + return uiReturnValue; +} + + +const char *BOINC_RCSID_7bca879adb="$Id$"; diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CASoftwareNeedsUpgrade.h b/win_build/installerv2/redist/Windows/src/boinccas/CARestoreSetupState.h similarity index 72% rename from win_build/installerv2/redist/Windows/src/boinccas/CASoftwareNeedsUpgrade.h rename to win_build/installerv2/redist/Windows/src/boinccas/CARestoreSetupState.h index a19f56f7e6..dbcd1bf468 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/CASoftwareNeedsUpgrade.h +++ b/win_build/installerv2/redist/Windows/src/boinccas/CARestoreSetupState.h @@ -18,24 +18,19 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -#ifndef _CASOFTWARENEEDSUPGRADE_H_ -#define _CASOFTWARENEEDSUPGRADE_H_ +#ifndef _CARESTORESETUPSTATE_H_ +#define _CARESTORESETUPSTATE_H_ -class CASoftwareNeedsUpgrade : public BOINCCABase +class CARestoreSetupState : public BOINCCABase { public: - CASoftwareNeedsUpgrade(MSIHANDLE hMSIHandle); - ~CASoftwareNeedsUpgrade(); + CARestoreSetupState(MSIHANDLE hMSIHandle); + ~CARestoreSetupState(); virtual UINT OnExecution(); - void VersionCheck( - const tstring strPackage, - const tstring strPackageLocation, - const tstring strPackageProperty - ); -} +}; #endif diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.cpp new file mode 100644 index 0000000000..bb85d9291e --- /dev/null +++ b/win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.cpp @@ -0,0 +1,110 @@ +// 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., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#include "stdafx.h" +#include "boinccas.h" +#include "CASaveSetupState.h" + +#define CUSTOMACTION_NAME _T("CASaveSetupState") +#define CUSTOMACTION_PROGRESSTITLE _T("Attempt to rename CPDNBBC installation directory to the default BOINC directory.") + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +CASaveSetupState::CASaveSetupState(MSIHANDLE hMSIHandle) : + BOINCCABase(hMSIHandle, CUSTOMACTION_NAME, CUSTOMACTION_PROGRESSTITLE) +{} + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +CASaveSetupState::~CASaveSetupState() +{ + BOINCCABase::~BOINCCABase(); +} + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +UINT CASaveSetupState::OnExecution() +{ + tstring strInstallDirectory; + tstring strSetupType; + tstring strLaunchProgram; + tstring strEnableLaunchAtLogon; + tstring strEnableScreensaver; + tstring strServiceDomain; + tstring strServiceUsername; + + GetProperty( _T("INSTALLDIR"), strInstallDirectory ); + GetProperty( _T("SETUPTYPE"), strSetupType ); + GetProperty( _T("LAUNCHPROGRAM"), strLaunchProgram ); + GetProperty( _T("ENABLELAUNCHATLOGON"), strEnableLaunchAtLogon ); + GetProperty( _T("ENABLESCREENSAVER"), strEnableScreensaver ); + GetProperty( _T("SERVICE_DOMAIN"), strServiceDomain ); + GetProperty( _T("SERVICE_USERNAME"), strServiceUsername ); + + SetRegistryValue( _T("INSTALLDIR"), strInstallDirectory ); + SetRegistryValue( _T("SETUPTYPE"), strSetupType ); + SetRegistryValue( _T("LAUNCHPROGRAM"), strLaunchProgram ); + SetRegistryValue( _T("ENABLELAUNCHATLOGON"), strEnableLaunchAtLogon ); + SetRegistryValue( _T("ENABLESCREENSAVER"), strEnableScreensaver ); + SetRegistryValue( _T("SERVICE_DOMAIN"), strServiceDomain ); + SetRegistryValue( _T("SERVICE_USERNAME"), strServiceUsername ); + + return ERROR_SUCCESS; +} + + +///////////////////////////////////////////////////////////////////// +// +// Function: SaveSetupState +// +// Description: +// +///////////////////////////////////////////////////////////////////// +UINT __stdcall SaveSetupState(MSIHANDLE hInstall) +{ + UINT uiReturnValue = 0; + + CASaveSetupState* pCA = new CASaveSetupState(hInstall); + uiReturnValue = pCA->Execute(); + delete pCA; + + return uiReturnValue; +} + + +const char *BOINC_RCSID_7bca879adc="$Id$"; diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.h b/win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.h new file mode 100644 index 0000000000..aed7cf841a --- /dev/null +++ b/win_build/installerv2/redist/Windows/src/boinccas/CASaveSetupState.h @@ -0,0 +1,37 @@ +// 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., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#ifndef _CASAVESETUPSTATE_H_ +#define _CASAVESETUPSTATE_H_ + + +class CASaveSetupState : public BOINCCABase +{ +public: + + CASaveSetupState(MSIHANDLE hMSIHandle); + ~CASaveSetupState(); + virtual UINT OnExecution(); + +}; + + +#endif + diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CASoftwareNeedsUpgrade.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CASoftwareNeedsUpgrade.cpp deleted file mode 100644 index 9edac98f32..0000000000 --- a/win_build/installerv2/redist/Windows/src/boinccas/CASoftwareNeedsUpgrade.cpp +++ /dev/null @@ -1,231 +0,0 @@ -// 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., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "stdafx.h" -#include "boinccas.h" -#include "CASoftwareNeedsUpgrade.h" - -#define CUSTOMACTION_NAME _T("CASoftwareNeedsUpgrade") -#define CUSTOMACTION_PROGRESSTITLE _T("Verifying software compatibility levels") - - -///////////////////////////////////////////////////////////////////// -// -// Function: -// -// Description: -// -///////////////////////////////////////////////////////////////////// -CASoftwareNeedsUpgrade::CASoftwareNeedsUpgrade(MSIHANDLE hMSIHandle) : - BOINCCABase(hMSIHandle, CUSTOMACTION_NAME, CUSTOMACTION_PROGRESSTITLE) -{} - - -///////////////////////////////////////////////////////////////////// -// -// Function: -// -// Description: -// -///////////////////////////////////////////////////////////////////// -CASoftwareNeedsUpgrade::~CASoftwareNeedsUpgrade() -{ - BOINCCABase::~BOINCCABase(); -} - - -///////////////////////////////////////////////////////////////////// -// -// Function: -// -// Description: -// -///////////////////////////////////////////////////////////////////// -UINT CASoftwareNeedsUpgrade::OnExecution() -{ - UINT uiReturnValue = 0; - HKEY hKey; - TCHAR szVersion[128]; - DWORD dwBufLen = (sizeof(szVersion)/sizeof(TCHAR)); - LONG lRet; - - lRet = RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - _T("SOFTWARE\\Microsoft\\IntelliPoint"), - 0, - KEY_QUERY_VALUE, - &hKey - ); - if ( lRet != ERROR_SUCCESS ) - { - LogMessage( - INSTALLMESSAGE_INFO, - NULL, - NULL, - NULL, - NULL, - _T("Microsoft IntelliPoint NOT Detected.") - ); - } - else - { - LogMessage( - INSTALLMESSAGE_INFO, - NULL, - NULL, - NULL, - NULL, - _T("Microsoft IntelliPoint Detected.") - ); - - lRet = RegQueryValueEx( - hKey, - "Version", - NULL, - NULL, - (LPBYTE) szVersion, - &dwBufLen - ); - - if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) - return FALSE; - } - - - - - - if ( lRet == ERROR_SUCCESS ) - { - DisplayMessage( - MB_OK, - MB_ICONERROR, - _T("Setup has detected an older version of BOINC which must be uninstalled before this version of BOINC can be installed.") - ); - - LogMessage( - INSTALLMESSAGE_INFO, - NULL, - NULL, - NULL, - NULL, - _T("Setup has detected an older version of BOINC which must be uninstalled before this version of BOINC can be installed.") - ); - - uiReturnValue = ERROR_INSTALL_FAILURE; - } - else - { - LogMessage( - INSTALLMESSAGE_INFO, - NULL, - NULL, - NULL, - NULL, - _T("Setup did NOT detect a previous version of the BOINC installer on the system.") - ); - uiReturnValue = ERROR_SUCCESS; - } - - RegCloseKey( hKey ); - - return uiReturnValue; -} - - -///////////////////////////////////////////////////////////////////// -// -// Function: -// -// Description: -// -///////////////////////////////////////////////////////////////////// -void VersionCheck(const tstring strPackage, const tstring strPackageLocation, const tstring strPackageProperty) -{ - HKEY hKey; - TCHAR szVersion[128]; - DWORD dwBufLen = (sizeof(szVersion)/sizeof(TCHAR)); - LONG lRet; - - lRet = RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - _T("SOFTWARE\\Microsoft\\IntelliPoint"), - 0, - KEY_QUERY_VALUE, - &hKey - ); - if ( lRet != ERROR_SUCCESS ) - { - LogMessage( - INSTALLMESSAGE_INFO, - NULL, - NULL, - NULL, - NULL, - _T("Microsoft IntelliPoint NOT Detected.") - ); - } - else - { - LogMessage( - INSTALLMESSAGE_INFO, - NULL, - NULL, - NULL, - NULL, - _T("Microsoft IntelliPoint Detected.") - ); - - lRet = RegQueryValueEx( - hKey, - "Version", - NULL, - NULL, - (LPBYTE) szVersion, - &dwBufLen - ); - - if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) - return FALSE; - } -} - - -///////////////////////////////////////////////////////////////////// -// -// Function: ValidateSetupType -// -// Description: -// -///////////////////////////////////////////////////////////////////// -UINT __stdcall SoftwareNeedsUpgrade(MSIHANDLE hInstall) -{ - UINT uiReturnValue = 0; - - CASoftwareNeedsUpgrade* pCA = new CASoftwareNeedsUpgrade(hInstall); - uiReturnValue = pCA->Execute(); - delete pCA; - - return uiReturnValue; -} - - - -const char *BOINC_RCSID_d533f80c52="$Id$"; diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CAVerifyServicePassword.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CAVerifyServicePassword.cpp index d6fe70acdf..31f64e69db 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/CAVerifyServicePassword.cpp +++ b/win_build/installerv2/redist/Windows/src/boinccas/CAVerifyServicePassword.cpp @@ -62,6 +62,7 @@ UINT CAVerifyServicePassword::OnExecution() { tstring strServicePassword; tstring strServicePasswordConfirmation; + tstring strWindowsVersion; UINT uiReturnValue = 0; @@ -71,6 +72,9 @@ UINT CAVerifyServicePassword::OnExecution() uiReturnValue = GetProperty( _T("SERVICE_CONFIRMPASSWORD"), strServicePasswordConfirmation, false ); if ( uiReturnValue ) return uiReturnValue; + uiReturnValue = GetProperty( _T("VersionNT"), strWindowsVersion, false ); + if ( uiReturnValue ) return uiReturnValue; + if ( strServicePassword != strServicePasswordConfirmation ) { @@ -84,7 +88,7 @@ UINT CAVerifyServicePassword::OnExecution() } else { - if ( strServicePassword.empty() ) + if ( strServicePassword.empty() && ( strWindowsVersion.empty() || (strWindowsVersion < _T("501")) )) { DisplayMessage( MB_OK, diff --git a/win_build/installerv2/redist/Windows/src/boinccas/boinccas.cpp b/win_build/installerv2/redist/Windows/src/boinccas/boinccas.cpp index 7b4ccd2ed5..39514026da 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/boinccas.cpp +++ b/win_build/installerv2/redist/Windows/src/boinccas/boinccas.cpp @@ -477,6 +477,156 @@ UINT BOINCCABase::SetProperty( } +///////////////////////////////////////////////////////////////////// +// +// Function: GetRegistryValue +// +// Description: +// +///////////////////////////////////////////////////////////////////// +UINT BOINCCABase::GetRegistryValue( + const tstring strName, + tstring& strValue, + bool bDisplayValue + ) +{ + LONG lReturnValue; + HKEY hkSetupHive; + DWORD dwType = REG_SZ; + DWORD dwSize = 0; + LPTSTR lpszRegistryValue = NULL; + tstring strMessage; + + lReturnValue = RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Space Sciences Laboratory, U.C. Berkeley\\BOINC Setup"), + 0, + KEY_READ, + &hkSetupHive + ); + if (lReturnValue != ERROR_SUCCESS) return ERROR_INSTALL_FAILURE; + + // How large does our buffer need to be? + RegQueryValueEx( + hkSetupHive, + strName.c_str(), + NULL, + NULL, + NULL, + &dwSize + ); + + // Allocate the buffer space. + lpszRegistryValue = (LPTSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize); + if ( NULL == lpszRegistryValue ) { + RegCloseKey(hkSetupHive); + return ERROR_INSTALL_FAILURE; + } + + // Now get the data + lReturnValue = RegQueryValueEx( + hkSetupHive, + strName.c_str(), + NULL, + &dwType, + (LPBYTE)lpszRegistryValue, + &dwSize + ); + + // Cleanup + RegCloseKey(hkSetupHive); + HeapFree(GetProcessHeap(), NULL, lpszRegistryValue); + + // One last check to make sure everything is on the up and up. + if (lReturnValue != ERROR_SUCCESS) return ERROR_INSTALL_FAILURE; + + // Send up the returned value. + strValue = lpszRegistryValue; + + strMessage = _T("Successfully retrieved registry value '") + strName; + strMessage += _T("' with a value of '"); + if (bDisplayValue) + strMessage += strValue; + else + strMessage += _T("