- 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

svn path=/trunk/boinc/; revision=14657
This commit is contained in:
Rom Walton 2008-01-31 20:33:03 +00:00
parent 0d79a286d3
commit 6d6c8cc890
14 changed files with 310 additions and 20 deletions

View File

@ -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

Binary file not shown.

View File

@ -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

View File

@ -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;
}

View File

@ -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("<client_authorization>\n")
_T(" <boinc_project>\n")
_T(" <username>%s</username>\n")
_T(" <password>%s</password>\n")
_T(" </boinc_project>\n")
_T("</client_authorization>\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 $";

View File

@ -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

View File

@ -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 =

View File

@ -8,6 +8,7 @@ EXPORTS
DllMain
CreateBOINCAccounts
CreateBOINCGroups
CreateClientAuthFile
GetAdministratorsGroupName
GetUsersGroupName
GrantBOINCMasterRights

View File

@ -65,7 +65,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="msi.lib libcmtd.lib libcpmtd.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
AdditionalDependencies="atls.lib msi.lib libcmtd.lib libcpmtd.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
OutputFile="$(OutDir)/boinccas.dll"
LinkIncremental="2"
IgnoreAllDefaultLibraries="true"
@ -151,7 +151,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="msi.lib libcmtd.lib libcpmtd.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
AdditionalDependencies="atls.lib msi.lib libcmtd.lib libcpmtd.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
OutputFile="$(OutDir)/boinccas.dll"
LinkIncremental="2"
IgnoreAllDefaultLibraries="true"
@ -238,7 +238,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="msi.lib libcmt.lib libcpmt.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
AdditionalDependencies="atls.lib msi.lib libcmt.lib libcpmt.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
OutputFile="$(OutDir)/boinccas.dll"
LinkIncremental="1"
IgnoreAllDefaultLibraries="true"
@ -326,7 +326,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="msi.lib libcmt.lib libcpmt.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
AdditionalDependencies="atls.lib msi.lib libcmt.lib libcpmt.lib delayimp.lib netapi32.lib advapi32.lib kernel32.lib user32.lib"
OutputFile="$(OutDir)/boinccas.dll"
LinkIncremental="1"
IgnoreAllDefaultLibraries="true"
@ -385,6 +385,10 @@
RelativePath=".\CACreateBOINCGroups.cpp"
>
</File>
<File
RelativePath=".\CACreateClientAuthFile.cpp"
>
</File>
<File
RelativePath=".\CAGetAdministratorsGroupName.cpp"
>
@ -490,6 +494,10 @@
RelativePath=".\CACreateBOINCGroups.h"
>
</File>
<File
RelativePath=".\CACreateClientAuthFile.h"
>
</File>
<File
RelativePath=".\CAGetAdministratorsGroupName.h"
>

View File

@ -73,7 +73,6 @@
#include <crtdbg.h>
#include <delayimp.h>
#include <msiquery.h>
#include <tchar.h>
#include <ntsecapi.h>
#include <lm.h>
#include <shlobj.h>
@ -95,6 +94,9 @@
#include <sstream>
#include <vector>
// Misc Includes
#include <tchar.h>
#ifdef _UNICODE
#define tstring std::wstring
#define tostringstream std::wostringstream