@@ -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
17761774LExit:
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
18121810LExit:
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
18471845LExit:
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
18831882LExit:
18841883 if (fInitializedCom )
0 commit comments