Skip to content

Commit e15564a

Browse files
committed
Add test_boinccas_CASetPermissionBOINCData
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
1 parent ca73ae2 commit e15564a

10 files changed

Lines changed: 1815 additions & 373 deletions

clientsetup/win/CARestorePermissionBOINCData.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ class CARestorePermissionBOINCData : public BOINCCABase
7777
ea[1].Trustee.ptstrName = reinterpret_cast<LPTSTR>(&bufferAdmin);
7878

7979
PACL pACL = nullptr;
80-
wil::unique_any<PACL, decltype(&::LocalFree), ::LocalFree> pACLGuard;
8180
auto dwRes = SetEntriesInAcl(ulEntries, ea.data(), nullptr, &pACL);
81+
wil::unique_any<PACL, decltype(&::LocalFree), ::LocalFree>
82+
pACLGuard(pACL);
8283
if (dwRes != ERROR_SUCCESS) {
8384
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, GetLastError(),
8485
_T("SetEntriesInAcl Error"));

clientsetup/win/CASetPermissionBOINC.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class CASetPermissionBOINC : public BOINCCABase {
2929

3030
UINT OnExecution() override final {
3131
tstring strEnableProtectedApplicationExecution;
32-
auto uiReturnValue = GetProperty(_T("ENABLEPROTECTEDAPPLICATIONEXECUTION3"),
32+
auto uiReturnValue =
33+
GetProperty(_T("ENABLEPROTECTEDAPPLICATIONEXECUTION3"),
3334
strEnableProtectedApplicationExecution);
3435
if (uiReturnValue != ERROR_SUCCESS) {
3536
return uiReturnValue;
@@ -46,7 +47,7 @@ class CASetPermissionBOINC : public BOINCCABase {
4647
}
4748
if (!std::filesystem::exists(strBOINCInstallDirectory)) {
4849
LogMessage(INSTALLMESSAGE_ERROR, 0, 0, 0, 0,
49-
_T("The data directory doesn't exist."));
50+
_T("The install directory doesn't exist."));
5051
return ERROR_INSTALL_FAILURE;
5152
}
5253

@@ -133,15 +134,16 @@ class CASetPermissionBOINC : public BOINCCABase {
133134

134135

135136
PACL pOldACL = nullptr;
136-
wil::unique_any<PACL, decltype(&::LocalFree),
137-
::LocalFree> pOldACLGuard;
138137
PSECURITY_DESCRIPTOR pSD = nullptr;
139-
wil::unique_any<PSECURITY_DESCRIPTOR, decltype(&::LocalFree),
140-
::LocalFree> pSDGuard;
138+
141139
auto dwRes = GetNamedSecurityInfo(
142140
reinterpret_cast<LPWSTR>(strBOINCInstallDirectory.data()),
143141
SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, nullptr, nullptr,
144142
&pOldACL, nullptr, &pSD);
143+
wil::unique_any<PACL, decltype(&::LocalFree),
144+
::LocalFree> pOldACLGuard(pOldACL);
145+
wil::unique_any<PSECURITY_DESCRIPTOR, decltype(&::LocalFree),
146+
::LocalFree> pSDGuard(pSD);
145147
if (dwRes != ERROR_SUCCESS) {
146148
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, GetLastError(),
147149
_T("GetNamedSecurityInfo Error"));
@@ -151,8 +153,9 @@ class CASetPermissionBOINC : public BOINCCABase {
151153
}
152154

153155
PACL pACL = nullptr;
154-
wil::unique_any<PACL, decltype(&::LocalFree), ::LocalFree> pACLGuard;
155-
dwRes = SetEntriesInAcl(ulEntries, &ea[0], pOldACL, &pACL);
156+
dwRes = SetEntriesInAcl(ulEntries, ea.data(), pOldACL, &pACL);
157+
wil::unique_any<PACL, decltype(&::LocalFree), ::LocalFree>
158+
pACLGuard(pACL);
156159
if (dwRes != ERROR_SUCCESS) {
157160
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, GetLastError(),
158161
_T("SetEntriesInAcl Error"));
@@ -162,8 +165,8 @@ class CASetPermissionBOINC : public BOINCCABase {
162165
}
163166

164167
dwRes = SetNamedSecurityInfo(
165-
reinterpret_cast<LPWSTR>(strBOINCInstallDirectory.data()),
166-
SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, nullptr, nullptr, pACL,
168+
strBOINCInstallDirectory.data(), SE_FILE_OBJECT,
169+
DACL_SECURITY_INFORMATION, nullptr, nullptr, pACL,
167170
nullptr);
168171
if (dwRes != ERROR_SUCCESS) {
169172
LogMessage(INSTALLMESSAGE_INFO, 0, 0, 0, GetLastError(),

0 commit comments

Comments
 (0)