Skip to content

Commit d20becc

Browse files
committed
Group creation and update PR nits and feedback fixes
1 parent f10f119 commit d20becc

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

src/ext/Util/ca/scaexec.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,7 @@ static HRESULT RemoveGroupInternal(
720720

721721
NET_API_STATUS er = ::NetLocalGroupDel(pwzServerName, wzName);
722722
hr = HRESULT_FROM_WIN32(er);
723-
if (HRESULT_FROM_WIN32(ERROR_NO_SUCH_ALIAS) == hr
724-
|| HRESULT_FROM_WIN32(NERR_GroupNotFound) == hr) // we wanted to delete it.. and the group doesn't exist.. solved.
723+
if (HRESULT_FROM_WIN32(ERROR_NO_SUCH_ALIAS) == hr || HRESULT_FROM_WIN32(NERR_GroupNotFound) == hr) // we wanted to delete it.. and the group doesn't exist.. solved.
725724
{
726725
hr = S_OK;
727726
}
@@ -1303,16 +1302,16 @@ extern "C" UINT __stdcall CreateGroup(
13031302
er = ::NetLocalGroupAdd(pwzServerName, 1, reinterpret_cast<LPBYTE>(&groupInfo1), &dw);
13041303
hr = HRESULT_FROM_WIN32(er);
13051304

1306-
if (HRESULT_FROM_WIN32(ERROR_ALIAS_EXISTS) == hr
1307-
|| HRESULT_FROM_WIN32(NERR_GroupExists) == hr)
1305+
if (HRESULT_FROM_WIN32(ERROR_ALIAS_EXISTS) == hr || HRESULT_FROM_WIN32(NERR_GroupExists) == hr)
13081306
{
13091307
if (SCAG_FAIL_IF_EXISTS & iAttributes)
13101308
{
13111309
MessageExitOnFailure(hr, msierrGRPFailedGroupCreateExists, "Group (%ls\\%ls) was not supposed to exist, but does", pwzDomain, pwzName);
13121310
}
13131311

1314-
hr = S_OK; // Make sure that we don't report this situation as an error
1312+
// Make sure that we don't report this situation as an error
13151313
// if we fall through the tests that follow.
1314+
hr = S_OK;
13161315

13171316
if (SCAG_UPDATE_IF_EXISTS & iAttributes)
13181317
{
@@ -1505,6 +1504,7 @@ extern "C" UINT __stdcall CreateGroupRollback(
15051504
{
15061505
pwzComment = pwzOriginalComment;
15071506
}
1507+
15081508
hr = WcaReadIntegerFromCaData(&pwz, &iOriginalAttributes);
15091509
if (FAILED(hr))
15101510
{
@@ -1618,7 +1618,7 @@ extern "C" UINT __stdcall RemoveGroup(
16181618
return WcaFinalize(er);
16191619
}
16201620

1621-
HRESULT AlterGroupMembership(bool remove, bool isRollback)
1621+
HRESULT AlterGroupMembership(BOOL fRemove, BOOL fIsRollback)
16221622
{
16231623
HRESULT hr = S_OK;
16241624
NET_API_STATUS er = ERROR_SUCCESS;
@@ -1663,7 +1663,7 @@ HRESULT AlterGroupMembership(bool remove, bool isRollback)
16631663
hr = WcaReadStringFromCaData(&pwz, &pwzScriptKey);
16641664
ExitOnFailure(hr, "failed to read scriptkey from custom action data");
16651665

1666-
if (isRollback)
1666+
if (fIsRollback)
16671667
{
16681668
// if the script file doesn't exist, then we'll abandon this rollback
16691669
hr = WcaCaScriptOpen(WCA_ACTION_INSTALL, WCA_CASCRIPT_ROLLBACK, FALSE, pwzScriptKey, &hRollbackScript);
@@ -1693,7 +1693,7 @@ HRESULT AlterGroupMembership(bool remove, bool isRollback)
16931693
}
16941694
memberInfo3.lgrmi3_domainandname = pwzChildFullName;
16951695

1696-
if (remove)
1696+
if (fRemove)
16971697
{
16981698
er = ::NetLocalGroupDelMembers(pwzServerName, pwzParentName, 3, (LPBYTE)&memberInfo3, 1);
16991699
}
@@ -1705,18 +1705,16 @@ HRESULT AlterGroupMembership(bool remove, bool isRollback)
17051705

17061706
// if there was no error, the action succeeded, and we should flag that it's something which might need
17071707
// to be rolled back
1708-
if (S_OK == hr && !isRollback)
1708+
if (S_OK == hr && !fIsRollback)
17091709
{
17101710
// we create a script file, the rollback matching this scriptkey will occur if the file exists
17111711
hr = WcaCaScriptCreate(WCA_ACTION_INSTALL, WCA_CASCRIPT_ROLLBACK, FALSE, pwzScriptKey, FALSE, &hRollbackScript);
17121712
WcaCaScriptClose(hRollbackScript, WCA_CASCRIPT_CLOSE_PRESERVE);
17131713
}
17141714

1715-
if (remove)
1715+
if (fRemove)
17161716
{
1717-
if (HRESULT_FROM_WIN32(NERR_GroupNotFound) == hr
1718-
|| HRESULT_FROM_WIN32(ERROR_NO_SUCH_MEMBER) == hr
1719-
|| HRESULT_FROM_WIN32(ERROR_MEMBER_NOT_IN_ALIAS) == hr)
1717+
if (HRESULT_FROM_WIN32(NERR_GroupNotFound) == hr || HRESULT_FROM_WIN32(ERROR_NO_SUCH_MEMBER) == hr || HRESULT_FROM_WIN32(ERROR_MEMBER_NOT_IN_ALIAS) == hr)
17201718
{
17211719
hr = S_OK;
17221720
}
@@ -1771,7 +1769,7 @@ extern "C" UINT __stdcall AddGroupMembership(
17711769
ExitOnFailure(hr, "failed to initialize COM");
17721770
fInitializedCom = TRUE;
17731771

1774-
hr = AlterGroupMembership(false, false);
1772+
hr = AlterGroupMembership(FALSE, FALSE);
17751773

17761774
LExit:
17771775
if (fInitializedCom)
@@ -1807,7 +1805,7 @@ extern "C" UINT __stdcall AddGroupMembershipRollback(
18071805
ExitOnFailure(hr, "failed to initialize COM");
18081806
fInitializedCom = TRUE;
18091807

1810-
hr = AlterGroupMembership(true, true);
1808+
hr = AlterGroupMembership(TRUE, TRUE);
18111809

18121810
LExit:
18131811
if (fInitializedCom)
@@ -1842,13 +1840,14 @@ extern "C" UINT __stdcall RemoveGroupMembership(
18421840
ExitOnFailure(hr, "failed to initialize COM");
18431841
fInitializedCom = TRUE;
18441842

1845-
hr = AlterGroupMembership(true, false);
1843+
hr = AlterGroupMembership(TRUE, FALSE);
18461844

18471845
LExit:
18481846
if (fInitializedCom)
18491847
{
18501848
::CoUninitialize();
18511849
}
1850+
18521851
return WcaFinalize(FAILED(hr) ? ERROR_INSTALL_FAILED : ERROR_SUCCESS);
18531852
}
18541853

@@ -1878,7 +1877,7 @@ extern "C" UINT __stdcall RemoveGroupMembershipRollback(
18781877
ExitOnFailure(hr, "failed to initialize COM");
18791878
fInitializedCom = TRUE;
18801879

1881-
hr = AlterGroupMembership(false, true);
1880+
hr = AlterGroupMembership(FALSE, TRUE);
18821881

18831882
LExit:
18841883
if (fInitializedCom)

src/ext/Util/ca/scasched.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ extern "C" UINT __stdcall ConfigureGroups(
134134
__in MSIHANDLE hInstall
135135
)
136136
{
137-
AssertSz(0, "Debug ConfigureGroups");
137+
//AssertSz(0, "Debug ConfigureGroups");
138138

139139
HRESULT hr = S_OK;
140140
UINT er = ERROR_SUCCESS;

src/ext/Util/wixext/UtilCompiler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ private void ParseGroupElement(Intermediate intermediate, IntermediateSection se
14851485
switch (child.Name.LocalName)
14861486
{
14871487
case "GroupRef":
1488-
this.ParseGroupRefElement(intermediate, section, child, id.Id, groupType:true);
1488+
this.ParseGroupRefElement(intermediate, section, child, id.Id, groupType: true);
14891489
break;
14901490
default:
14911491
this.ParseHelper.UnexpectedElement(element, child);
@@ -1521,7 +1521,7 @@ private void ParseGroupElement(Intermediate intermediate, IntermediateSection se
15211521
/// <param name="element">Element to parse.</param>
15221522
/// <param name="childId">Required child id to be joined to the group.</param>
15231523
/// <param name="groupType">whether the child is a group (true) or a user (false)</param>
1524-
private void ParseGroupRefElement(Intermediate intermediate, IntermediateSection section, XElement element, string childId, bool groupType=false)
1524+
private void ParseGroupRefElement(Intermediate intermediate, IntermediateSection section, XElement element, string childId, bool groupType)
15251525
{
15261526
var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
15271527
string groupId = null;
@@ -3588,7 +3588,7 @@ private void ParseUserElement(Intermediate intermediate, IntermediateSection sec
35883588
this.Messaging.Write(UtilErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
35893589
}
35903590

3591-
this.ParseGroupRefElement(intermediate, section, child, id.Id, groupType:false);
3591+
this.ParseGroupRefElement(intermediate, section, child, id.Id, groupType: false);
35923592
break;
35933593
default:
35943594
this.ParseHelper.UnexpectedElement(element, child);

src/test/burn/WixTestTools/RuntimeFactAttribute.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ namespace WixTestTools
99

1010
public class RuntimeFactAttribute : SkippableFactAttribute
1111
{
12+
private bool domainRequired;
13+
1214
const string RequiredEnvironmentVariableName = "RuntimeTestsEnabled";
1315
const string RequiredDomainEnvironmentVariableName = "RuntimeDomainTestsEnabled";
1416

@@ -38,17 +40,16 @@ static RuntimeFactAttribute()
3840
RuntimeDomainTestsEnabled = Boolean.TryParse(domainTestsEnabledString, out var domainTestsEnabled) && domainTestsEnabled;
3941
}
4042

41-
private bool _domainRequired;
4243
public bool DomainRequired
4344
{
4445
get
4546
{
46-
return _domainRequired;
47+
return this.domainRequired;
4748
}
4849
set
4950
{
50-
_domainRequired = value;
51-
if (_domainRequired && String.IsNullOrEmpty(this.Skip) && (!RunningInDomain || !RuntimeDomainTestsEnabled))
51+
this.domainRequired = value;
52+
if (this.domainRequired && String.IsNullOrEmpty(this.Skip) && (!RunningInDomain || !RuntimeDomainTestsEnabled))
5253
{
5354
this.Skip = $"These tests require the test host to be running as a domain member ({(RunningInDomain ? "passed" : "failed")}). These tests affect both MACHINE AND DOMAIN state. To accept the consequences, set the {RequiredDomainEnvironmentVariableName} environment variable to true ({(RuntimeDomainTestsEnabled ? "passed" : "failed")}).";
5455
}

src/test/burn/WixTestTools/UserGroupVerifier.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void CreateLocalGroup(string groupName)
2929
}
3030

3131
/// <summary>
32-
/// Deletes a local gorup from the machine
32+
/// Deletes a local group from the machine
3333
/// </summary>
3434
/// <param name="groupName">group name to delete</param>
3535
/// <remarks>Has to be run as an Admin</remarks>

0 commit comments

Comments
 (0)