summaryrefslogtreecommitdiff
path: root/src/ext/Util/ca/scauser.cpp
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-10-15 19:53:13 -0700
committerRob Mensching <rob@firegiant.com>2022-10-21 19:08:08 -0700
commit5589a8081bbeb2f449339be23684e583b6df1c81 (patch)
tree0cb1c9ace9137e3d81008ed92d9156fbfa47dae7 /src/ext/Util/ca/scauser.cpp
parent08cdc6aa2b9dd0e273a3c3a22893616d26342a0e (diff)
downloadwix-5589a8081bbeb2f449339be23684e583b6df1c81.tar.gz
wix-5589a8081bbeb2f449339be23684e583b6df1c81.tar.bz2
wix-5589a8081bbeb2f449339be23684e583b6df1c81.zip
Fix a couple minor bug in when adding/removing user comments
Plus some code clean up so error reporting is consistent.
Diffstat (limited to '')
-rw-r--r--src/ext/Util/ca/scauser.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ext/Util/ca/scauser.cpp b/src/ext/Util/ca/scauser.cpp
index dc5bebba..b643a842 100644
--- a/src/ext/Util/ca/scauser.cpp
+++ b/src/ext/Util/ca/scauser.cpp
@@ -533,13 +533,16 @@ HRESULT ScaUserExecute(
533 // MSDN says, if we get the above error code, try again with the "DS_FORCE_REDISCOVERY" flag 533 // MSDN says, if we get the above error code, try again with the "DS_FORCE_REDISCOVERY" flag
534 er = ::DsGetDcNameW(NULL, wzDomain, NULL, NULL, DS_FORCE_REDISCOVERY, &pDomainControllerInfo); 534 er = ::DsGetDcNameW(NULL, wzDomain, NULL, NULL, DS_FORCE_REDISCOVERY, &pDomainControllerInfo);
535 } 535 }
536 if (ERROR_SUCCESS == er) 536 if (ERROR_SUCCESS == er && pDomainControllerInfo->DomainControllerName)
537 { 537 {
538 if (2 <= wcslen(pDomainControllerInfo->DomainControllerName)) 538 // If the \\ prefix on the queried domain was present, skip it.
539 if ('\\' == *pDomainControllerInfo->DomainControllerName && '\\' == *pDomainControllerInfo->DomainControllerName + 1)
539 { 540 {
540 wzDomain = pDomainControllerInfo->DomainControllerName + 2; // Add 2 so that we don't get the \\ prefix. 541 wzDomain = pDomainControllerInfo->DomainControllerName + 2;
541 // Pass the entire string if it is too short 542 }
542 // to have a \\ prefix. 543 else
544 {
545 wzDomain = pDomainControllerInfo->DomainControllerName;
543 } 546 }
544 } 547 }
545 } 548 }
@@ -672,7 +675,7 @@ HRESULT ScaUserExecute(
672 // CustomAction. 675 // CustomAction.
673 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RemoveUser"), pwzActionData, COST_USER_DELETE); 676 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RemoveUser"), pwzActionData, COST_USER_DELETE);
674 ExitOnFailure(hr, "failed to schedule RemoveUser"); 677 ExitOnFailure(hr, "failed to schedule RemoveUser");
675 } 678 }
676 679
677 ReleaseNullStr(pwzScriptKey); 680 ReleaseNullStr(pwzScriptKey);
678 ReleaseNullStr(pwzActionData); 681 ReleaseNullStr(pwzActionData);