diff --git a/checkin_notes b/checkin_notes index f0fd1f09ab..bbc3815a71 100644 --- a/checkin_notes +++ b/checkin_notes @@ -994,5 +994,29 @@ Eric K Jan 31 2008 procinfo_win.C stackwalker_win.cpp +Rom Jan 31 2008 + - WINSETUP: Don't configure MSI so that it'll attempt to stop the + BOINC service, we already do it much earlier in the install + process + - WINSETUP: Fix two typos in the CACreateBOINCGroups custom + action. + - WINSETUP: Include CACreateClientAuthFile in the build now. + + win_build/installerv2/ + BOINC.ism + win_build/installerv2/redist/Windows/src/boinccas/ + boinccas.def + boinccas.vcproj + win_build/installerv2/redist/Windows/src/boinccas/ + CACreateBOINCAccounts.cpp + CACreateBOINCGroups.cpp + CACreateClientAuthFile.cpp, .h (Added) + CAMigrateBOINCData.cpp + stdafx.h + win_build/installerv2/redist/Windows/Win32/ + boinccas.dll + boinccas95.dll + win_build/installerv2/redist/Windows/x64/ + boinccas.dll + boinccas95.dll - diff --git a/win_build/installerv2/BOINC.ism b/win_build/installerv2/BOINC.ism index 835e7f6eaa..19154f1c76 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/Win32/boinccas.dll b/win_build/installerv2/redist/Windows/Win32/boinccas.dll index 07c0a95d30..c21abbcd6e 100644 Binary files a/win_build/installerv2/redist/Windows/Win32/boinccas.dll and b/win_build/installerv2/redist/Windows/Win32/boinccas.dll differ diff --git a/win_build/installerv2/redist/Windows/Win32/boinccas95.dll b/win_build/installerv2/redist/Windows/Win32/boinccas95.dll index af12667859..e2a3adce9b 100644 Binary files a/win_build/installerv2/redist/Windows/Win32/boinccas95.dll and b/win_build/installerv2/redist/Windows/Win32/boinccas95.dll differ diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCAccounts.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCAccounts.cpp index a70bc7d551..2684e5267b 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCAccounts.cpp +++ b/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCAccounts.cpp @@ -69,6 +69,8 @@ UINT CACreateBOINCAccounts::OnExecution() tstring strBOINCProjectAccountPassword; tstring strComputerName; tstring strProductType; + tstring strDataDirectory; + tstring strEnableProtectedApplicationExecution; PSID pSid; NET_API_STATUS nasReturnValue; BOOL bBOINCMasterAccountModified = FALSE; @@ -93,6 +95,9 @@ UINT CACreateBOINCAccounts::OnExecution() uiReturnValue = GetProperty( _T("MsiNTProductType"), strProductType ); if ( uiReturnValue ) return uiReturnValue; + uiReturnValue = GetProperty( _T("ENABLEPROTECTEDAPPLICATIONEXECUTION"), strEnableProtectedApplicationExecution ); + if ( uiReturnValue ) return uiReturnValue; + // Only create a new account or change the password on an existing account // if the user hasn't explicitly defined an account diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCGroups.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCGroups.cpp index 2348517b62..420d917ff2 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCGroups.cpp +++ b/win_build/installerv2/redist/Windows/src/boinccas/CACreateBOINCGroups.cpp @@ -81,7 +81,7 @@ UINT CACreateBOINCGroups::OnExecution() uiReturnValue = GetProperty( _T("BOINC_PROJECT_USERNAME"), strBOINCProjectAccountUsername ); if ( uiReturnValue ) return uiReturnValue; - uiReturnValue = GetProperty( _T("ENABLEPROTECTEDAPPLICATIONEXECUTION"), strEnableUseByAllUsers ); + uiReturnValue = GetProperty( _T("ENABLEPROTECTEDAPPLICATIONEXECUTION"), strEnableProtectedApplicationExecution ); if ( uiReturnValue ) return uiReturnValue; uiReturnValue = GetProperty( _T("ENABLEUSEBYALLUSERS"), strEnableUseByAllUsers ); @@ -404,7 +404,7 @@ UINT CACreateBOINCGroups::OnExecution() SetProperty( _T("BOINC_ADMINS_GROUPNAME"), _T("boinc_admins") ); SetProperty( _T("BOINC_USERS_GROUPNAME"), _T("boinc_users") ); - SetProperty( _T("BOINC_PROJECT_GROUPNAME"), _T("boinc_projects") ); + SetProperty( _T("BOINC_PROJECTS_GROUPNAME"), _T("boinc_projects") ); return ERROR_SUCCESS; } diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CACreateClientAuthFile.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CACreateClientAuthFile.cpp new file mode 100644 index 0000000000..de5058c9bc --- /dev/null +++ b/win_build/installerv2/redist/Windows/src/boinccas/CACreateClientAuthFile.cpp @@ -0,0 +1,213 @@ +// 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 "CACreateClientAuthFile.h" + + +#define CUSTOMACTION_NAME _T("CACreateClientAuthFile") +#define CUSTOMACTION_PROGRESSTITLE _T("Store client authorization data") + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +CACreateClientAuthFile::CACreateClientAuthFile(MSIHANDLE hMSIHandle) : + BOINCCABase(hMSIHandle, CUSTOMACTION_NAME, CUSTOMACTION_PROGRESSTITLE) +{} + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +CACreateClientAuthFile::~CACreateClientAuthFile() +{ + BOINCCABase::~BOINCCABase(); +} + + +///////////////////////////////////////////////////////////////////// +// +// Function: +// +// Description: +// +///////////////////////////////////////////////////////////////////// +UINT CACreateClientAuthFile::OnExecution() +{ + tstring strDataDirectory; + tstring strEnableProtectedApplicationExecution; + tstring strBOINCProjectAccountUsername; + tstring strBOINCProjectAccountPassword; + tstring strClientAuthFile; + struct _stat buf; + UINT uiReturnValue = -1; + + + uiReturnValue = GetProperty( _T("DATADIR"), strDataDirectory ); + if ( uiReturnValue ) return uiReturnValue; + + uiReturnValue = GetProperty( _T("ENABLEPROTECTEDAPPLICATIONEXECUTION"), strEnableProtectedApplicationExecution ); + if ( uiReturnValue ) return uiReturnValue; + + uiReturnValue = GetProperty( _T("BOINC_PROJECT_USERNAME"), strBOINCProjectAccountUsername ); + if ( uiReturnValue ) return uiReturnValue; + + uiReturnValue = GetProperty( _T("BOINC_PROJECT_PASSWORD"), strBOINCProjectAccountPassword ); + if ( uiReturnValue ) return uiReturnValue; + + + // The client_auth.xml file is stored in the data directory. + // + strClientAuthFile = strDataDirectory + _T("client_auth.xml"); + + // If we are not installing in protected mode, there may not + // be a valid 'boinc_project' account, so delete the + // client_auth.xml file if it exists. + // + if (_T("1") != strEnableProtectedApplicationExecution) + { + if (0 == _tstat(strClientAuthFile.c_str(), &buf)) + { + if (DeleteFile(strClientAuthFile.c_str())) + { + LogMessage( + INSTALLMESSAGE_INFO, + NULL, + NULL, + NULL, + NULL, + _T("The client_auth.xml file was successfully deleted.") + ); + } + else + { + LogMessage( + INSTALLMESSAGE_FATALEXIT, + NULL, + NULL, + NULL, + NULL, + _T("The client_auth.xml could not be deleted from the data direvtory. ") + _T("Please delete the file and rerun setup.") + ); + return ERROR_INSTALL_FAILURE; + } + } + } + else + { + // We are installing in protected mode, which means the 'boinc_project' + // account password has been changed, so we need to write out the new + // username and password to the client_auth.xml file. + FILE* fClientAuthFile = NULL; + DWORD dwSize = Base64EncodeGetRequiredLength((int)strBOINCProjectAccountPassword.length()); + LPSTR szBuffer = (LPSTR)malloc(dwSize*sizeof(TCHAR)); + if (!szBuffer) + { + LogMessage( + INSTALLMESSAGE_FATALEXIT, + NULL, + NULL, + NULL, + NULL, + _T("Not enough memory could be allocated to complete the requested action. ") + _T("Please shutdown any running applications or reboot the computer and rerun ") + _T("setup to complete installation.") + ); + return ERROR_INSTALL_FAILURE; + } + memset(szBuffer, '\0', (dwSize*sizeof(TCHAR))); + + // Base 64 encode the 'boinc_project' account password + // + CW2A pszASCIIDecodedPassword( strBOINCProjectAccountPassword.c_str() ); + if (!Base64Encode( + (const BYTE*)((LPSTR)pszASCIIDecodedPassword), + (int)strlen(pszASCIIDecodedPassword), + szBuffer, + (int*)&dwSize, + 0) + ) + { + LogMessage( + INSTALLMESSAGE_FATALEXIT, + NULL, + NULL, + NULL, + NULL, + _T("The 'boinc_project' account password failed to be encoded.") + ); + return ERROR_INSTALL_FAILURE; + } + CA2W pszUnicodeEncodedPassword( szBuffer ); + + + fClientAuthFile = _tfopen(strClientAuthFile.c_str(), _T("w")); + + _ftprintf( + fClientAuthFile, + _T("\n") + _T(" \n") + _T(" %s\n") + _T(" %s\n") + _T(" \n") + _T("\n"), + strBOINCProjectAccountUsername.c_str(), + pszUnicodeEncodedPassword + ); + + fclose(fClientAuthFile); + free(szBuffer); + } + + return ERROR_SUCCESS; +} + + +///////////////////////////////////////////////////////////////////// +// +// Function: CreateClientAuthFile +// +// Description: This custom action stores the 'boinc_project' account +// information in the client_auth.xml file. +// +///////////////////////////////////////////////////////////////////// +UINT __stdcall CreateClientAuthFile(MSIHANDLE hInstall) +{ + UINT uiReturnValue = 0; + + CACreateClientAuthFile* pCA = new CACreateClientAuthFile(hInstall); + uiReturnValue = pCA->Execute(); + delete pCA; + + return uiReturnValue; +} + +const char *BOINC_RCSID_01ed9786df="$Id: CACreateClientAuthFile.cpp 11804 2007-01-08 18:42:48Z rwalton $"; diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CACreateClientAuthFile.h b/win_build/installerv2/redist/Windows/src/boinccas/CACreateClientAuthFile.h new file mode 100644 index 0000000000..b8a1cb964f --- /dev/null +++ b/win_build/installerv2/redist/Windows/src/boinccas/CACreateClientAuthFile.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 _CACREATECLIENTAUTHFILE_H_ +#define _CACREATECLIENTAUTHFILE_H_ + + +class CACreateClientAuthFile : public BOINCCABase +{ +public: + + CACreateClientAuthFile(MSIHANDLE hMSIHandle); + ~CACreateClientAuthFile(); + virtual UINT OnExecution(); + +}; + + +#endif + diff --git a/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateBOINCData.cpp b/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateBOINCData.cpp index 2537fcb0cf..9e0d9f9a98 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateBOINCData.cpp +++ b/win_build/installerv2/redist/Windows/src/boinccas/CAMigrateBOINCData.cpp @@ -320,17 +320,17 @@ UINT CAMigrateBOINCData::OnRollback() ///////////////////////////////////////////////////////////////////// UINT CAMigrateBOINCData::OnExecution() { - tstring strCustomActionData; - tstring strInstallDirectory; - tstring strDataDirectory; - tstring strClientStateFile; - tstring strTemp; - struct stat buf; - BOOL bMigratingData = FALSE; - ULONGLONG ullFileSize = 0; - ULONGLONG ullDirectorySize = 0; - ULONGLONG ullFreeDiskSpace = 0; - UINT uiReturnValue = -1; + tstring strCustomActionData; + tstring strInstallDirectory; + tstring strDataDirectory; + tstring strClientStateFile; + tstring strTemp; + struct _stat buf; + BOOL bMigratingData = FALSE; + ULONGLONG ullFileSize = 0; + ULONGLONG ullDirectorySize = 0; + ULONGLONG ullFreeDiskSpace = 0; + UINT uiReturnValue = -1; LogMessage( INSTALLMESSAGE_INFO, @@ -352,7 +352,7 @@ UINT CAMigrateBOINCData::OnExecution() // Perform some basic sanity tests to see if we need to migrate // anything. BOOL bClientStateExists = - (BOOL)(0 == stat(strClientStateFile.c_str(), &buf)); + (BOOL)(0 == _stat(strClientStateFile.c_str(), &buf)); BOOL bInstallDataSameDirectory = (BOOL)(strInstallDirectory == strDataDirectory); BOOL bDataDirExistsWithinInstallDir = diff --git a/win_build/installerv2/redist/Windows/src/boinccas/boinccas.def b/win_build/installerv2/redist/Windows/src/boinccas/boinccas.def index 936d52d9f5..99609d7c95 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/boinccas.def +++ b/win_build/installerv2/redist/Windows/src/boinccas/boinccas.def @@ -8,6 +8,7 @@ EXPORTS DllMain CreateBOINCAccounts CreateBOINCGroups + CreateClientAuthFile GetAdministratorsGroupName GetUsersGroupName GrantBOINCMasterRights diff --git a/win_build/installerv2/redist/Windows/src/boinccas/boinccas.vcproj b/win_build/installerv2/redist/Windows/src/boinccas/boinccas.vcproj index 43c6ac41e1..d06055f2c1 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/boinccas.vcproj +++ b/win_build/installerv2/redist/Windows/src/boinccas/boinccas.vcproj @@ -65,7 +65,7 @@ /> + + @@ -490,6 +494,10 @@ RelativePath=".\CACreateBOINCGroups.h" > + + diff --git a/win_build/installerv2/redist/Windows/src/boinccas/stdafx.h b/win_build/installerv2/redist/Windows/src/boinccas/stdafx.h index ccd4c968e7..7bd3e89d73 100644 --- a/win_build/installerv2/redist/Windows/src/boinccas/stdafx.h +++ b/win_build/installerv2/redist/Windows/src/boinccas/stdafx.h @@ -73,7 +73,6 @@ #include #include #include -#include #include #include #include @@ -95,6 +94,9 @@ #include #include +// Misc Includes +#include + #ifdef _UNICODE #define tstring std::wstring #define tostringstream std::wostringstream diff --git a/win_build/installerv2/redist/Windows/x64/boinccas.dll b/win_build/installerv2/redist/Windows/x64/boinccas.dll index 6c3cb0e1ef..15f4d91e08 100644 Binary files a/win_build/installerv2/redist/Windows/x64/boinccas.dll and b/win_build/installerv2/redist/Windows/x64/boinccas.dll differ diff --git a/win_build/installerv2/redist/Windows/x64/boinccas95.dll b/win_build/installerv2/redist/Windows/x64/boinccas95.dll index aff55f99e1..4c44687314 100644 Binary files a/win_build/installerv2/redist/Windows/x64/boinccas95.dll and b/win_build/installerv2/redist/Windows/x64/boinccas95.dll differ