Skip to content

Commit ccb4a80

Browse files
committed
Refactoring
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
1 parent 7860cd3 commit ccb4a80

51 files changed

Lines changed: 986 additions & 1702 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

clientsetup/win/CAAnnounceUpgrade.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// You should have received a copy of the GNU Lesser General Public License
1616
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
1717

18-
#include "stdafx.h"
1918
#include "boinccas.h"
2019

2120
class CAAnnounceUpgrade : public BOINCCABase {
@@ -26,7 +25,7 @@ class CAAnnounceUpgrade : public BOINCCABase {
2625
BOINCCABase(hMSIHandle, _T("CAAnnounceUpgrade"),
2726
_T("Announce the new BOINC version to all components.")) {
2827
}
29-
28+
private:
3029
UINT OnExecution() override final {
3130
tstring strCurrentProductVersion;
3231

clientsetup/win/CACleanupOldBinaries.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// You should have received a copy of the GNU Lesser General Public License
1616
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
1717

18-
#include "stdafx.h"
1918
#include "boinccas.h"
2019

2120
class CACleanupOldBinaries : public BOINCCABase {
@@ -27,7 +26,7 @@ class CACleanupOldBinaries : public BOINCCABase {
2726
_T("Cleanup any old binaries that were left lying around from "
2827
"some other install.")) {
2928
}
30-
29+
private:
3130
UINT OnExecution() override final {
3231
tstring strInstallDirectory;
3332

clientsetup/win/CACreateAcctMgrLoginFile.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// You should have received a copy of the GNU Lesser General Public License
1616
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
1717

18-
#include "stdafx.h"
1918
#include "boinccas.h"
2019

2120
class CACreateAcctMgrLoginFile : public BOINCCABase {
@@ -26,20 +25,20 @@ class CACreateAcctMgrLoginFile : public BOINCCABase {
2625
BOINCCABase(hMSIHandle, _T("CACreateAcctMgrLoginFile"),
2726
_T("Store account manager initialization data")) {
2827
}
29-
28+
private:
3029
UINT OnExecution() override final {
3130
tstring strDataDirectory;
3231
auto uiReturnValue = GetProperty(_T("DATADIR"), strDataDirectory);
3332
if (uiReturnValue != ERROR_SUCCESS) {
3433
return uiReturnValue;
3534
}
3635
if (strDataDirectory.empty()) {
37-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, 0,
36+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0,
3837
_T("The data directory is empty."));
3938
return ERROR_INSTALL_FAILURE;
4039
}
4140
if (!std::filesystem::exists(strDataDirectory)) {
42-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, 0,
41+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0,
4342
_T("The data directory doesn't exist."));
4443
return ERROR_INSTALL_FAILURE;
4544
}

clientsetup/win/CACreateBOINCAccounts.cpp

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// You should have received a copy of the GNU Lesser General Public License
1616
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
1717

18-
#include "stdafx.h"
1918
#include "boinccas.h"
2019
#include "win_util.h"
2120

@@ -28,7 +27,7 @@ class CACreateBOINCAccounts : public BOINCCABase {
2827
_T("Validating user accounts used by BOINC "
2928
"for secure sandboxes")) {
3029
}
31-
30+
private:
3231
UINT CACreateBOINCAccounts::OnExecution() override final {
3332
tstring strBOINCMasterAccountUsername;
3433
auto uiReturnValue =
@@ -93,14 +92,14 @@ class CACreateBOINCAccounts : public BOINCCABase {
9392
auto bBOINCMasterAccountCreated = false;
9493
auto bBOINCMasterAccountModified = false;
9594
if (bCreateBOINCMasterAccount) {
96-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
95+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
9796
_T("Using automatic account creation and management of "
9897
"'boinc_master' account"));
9998

10099
// Determine what the real values of the usernames should be
101100
// based off of the inputs
102101
if (strBOINCMasterAccountUsername.empty()) {
103-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
102+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
104103
_T("Generating 'boinc_master' account name"));
105104
strBOINCMasterAccountUsername = _T("boinc_master");
106105
// Domain Controller
@@ -112,13 +111,13 @@ class CACreateBOINCAccounts : public BOINCCABase {
112111
// Generate random passwords if needed
113112
//
114113
if (strBOINCMasterAccountPassword.empty()) {
115-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
114+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
116115
_T("Generating 'boinc_master' password"));
117116
auto errorcode = 0;
118117
std::tie(errorcode, strBOINCMasterAccountPassword)
119118
= GenerateRandomPassword(32);
120119
if (strBOINCMasterAccountPassword.empty()) {
121-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, errorcode,
120+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, errorcode,
122121
_T("Failed to generate 'boinc_master' password"));
123122
return ERROR_INSTALL_FAILURE;
124123
}
@@ -138,7 +137,7 @@ class CACreateBOINCAccounts : public BOINCCABase {
138137
NetApiBufferFree(pBuf);
139138
}
140139
if (result == NERR_Success) {
141-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
140+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
142141
_T("Resetting 'boinc_master' password"));
143142

144143
// Account already exists, just change the password
@@ -152,14 +151,14 @@ class CACreateBOINCAccounts : public BOINCCABase {
152151
reinterpret_cast<LPBYTE>(&ui), &dwParameterError);
153152

154153
if (nasReturnValue != NERR_Success) {
155-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0,
154+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0,
156155
nasReturnValue, _T("Failed to reset password on the "
157156
"'boinc_master' account."));
158157
return ERROR_INSTALL_FAILURE;
159158
}
160159
}
161160
else {
162-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
161+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
163162
_T("Creating 'boinc_master' account"));
164163

165164
// Account does not exist, create it
@@ -181,12 +180,12 @@ class CACreateBOINCAccounts : public BOINCCABase {
181180
reinterpret_cast<LPBYTE>(&ui), &dwParameterError);
182181

183182
if (nasReturnValue != NERR_Success) {
184-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, nasReturnValue,
183+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, nasReturnValue,
185184
_T("NetUserAdd retval"));
186-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, dwParameterError,
185+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, dwParameterError,
187186
_T("NetUserAdd dwParameterError")
188187
);
189-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, nasReturnValue,
188+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, nasReturnValue,
190189
_T("Failed to create the 'boinc_master' account.")
191190
);
192191
return ERROR_INSTALL_FAILURE;
@@ -215,14 +214,14 @@ class CACreateBOINCAccounts : public BOINCCABase {
215214
auto bBOINCProjectAccountCreated = false;
216215
auto bBOINCProjectAccountModified = false;
217216
if (bCreateBOINCProjectAccount) {
218-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
217+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
219218
_T("Using automatic account creation and management of "
220219
"'boinc_project' account"));
221220

222221
// Determine what the real values of the usernames should be based
223222
// off of the inputs
224223
if (strBOINCProjectAccountUsername.empty()) {
225-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
224+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
226225
_T("Generating 'boinc_project' account name"));
227226
strBOINCProjectAccountUsername = _T("boinc_project");
228227
// Domain Controller
@@ -235,13 +234,13 @@ class CACreateBOINCAccounts : public BOINCCABase {
235234
// Generate random passwords if needed
236235
//
237236
if (strBOINCProjectAccountPassword.empty()) {
238-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
237+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
239238
_T("Generating 'boinc_project' password"));
240239
auto errorcode = 0;
241240
std::tie(errorcode, strBOINCProjectAccountPassword) =
242241
GenerateRandomPassword(32);
243242
if (strBOINCProjectAccountPassword.empty()) {
244-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, errorcode,
243+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, errorcode,
245244
_T("Failed to generate 'boinc_project' password"));
246245
return ERROR_INSTALL_FAILURE;
247246
}
@@ -261,7 +260,7 @@ class CACreateBOINCAccounts : public BOINCCABase {
261260
}
262261
// Check if user exists
263262
if (result == NERR_Success) {
264-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
263+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
265264
_T("Resetting 'boinc_project' password"));
266265

267266
// Account already exists, just change the password
@@ -275,14 +274,14 @@ class CACreateBOINCAccounts : public BOINCCABase {
275274
reinterpret_cast<LPBYTE>(&ui), &dwParameterError);
276275

277276
if (nasReturnValue != NERR_Success) {
278-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, nasReturnValue,
277+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, nasReturnValue,
279278
_T("Failed to reset password on the "
280279
"'boinc_project' account."));
281280
return ERROR_INSTALL_FAILURE;
282281
}
283282
}
284283
else {
285-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, 0,
284+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0,
286285
_T("Creating 'boinc_project' account"));
287286

288287
// Account does not exist, create it
@@ -304,11 +303,11 @@ class CACreateBOINCAccounts : public BOINCCABase {
304303
reinterpret_cast<LPBYTE>(&ui), &dwParameterError);
305304

306305
if (nasReturnValue != NERR_Success) {
307-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, nasReturnValue,
306+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, nasReturnValue,
308307
_T("NetUserAdd retval"));
309-
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, dwParameterError,
308+
LogMessage(INSTALLMESSAGE_INFO, 0, 0, dwParameterError,
310309
_T("NetUserAdd dwParameterError"));
311-
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, nasReturnValue,
310+
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, nasReturnValue,
312311
_T("Failed to create the 'boinc_project' account."));
313312
return ERROR_INSTALL_FAILURE;
314313
}
@@ -352,7 +351,6 @@ class CACreateBOINCAccounts : public BOINCCABase {
352351
return ERROR_SUCCESS;
353352
}
354353

355-
private:
356354
// Source Code Originally from:
357355
// http://support.microsoft.com/kb/814463
358356
std::pair<decltype(GetLastError()), tstring>

0 commit comments

Comments
 (0)