aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Util/ca
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/Util/ca')
-rw-r--r--src/ext/Util/ca/scaexec.cpp22
-rw-r--r--src/ext/Util/ca/utilca.vcxproj2
2 files changed, 15 insertions, 9 deletions
diff --git a/src/ext/Util/ca/scaexec.cpp b/src/ext/Util/ca/scaexec.cpp
index ee3c164f..2baab86e 100644
--- a/src/ext/Util/ca/scaexec.cpp
+++ b/src/ext/Util/ca/scaexec.cpp
@@ -764,6 +764,7 @@ extern "C" UINT __stdcall CreateUser(
764 WCA_CASCRIPT_HANDLE hRollbackScript = NULL; 764 WCA_CASCRIPT_HANDLE hRollbackScript = NULL;
765 int iOriginalAttributes = 0; 765 int iOriginalAttributes = 0;
766 int iRollbackAttributes = 0; 766 int iRollbackAttributes = 0;
767 LPCWSTR wzOriginalComment = NULL;
767 768
768 USER_INFO_1 userInfo1; 769 USER_INFO_1 userInfo1;
769 USER_INFO_1* pUserInfo1 = NULL; 770 USER_INFO_1* pUserInfo1 = NULL;
@@ -885,14 +886,16 @@ extern "C" UINT __stdcall CreateUser(
885 } 886 }
886 } 887 }
887 888
888 hr = WcaCaScriptWriteString(hRollbackScript, pUserInfo1->usri1_comment); 889 wzOriginalComment = pUserInfo1->usri1_comment;
889 ExitOnFailure(hr, "Failed to add rollback comment to rollback script."); 890 if (!wzOriginalComment || !*wzOriginalComment)
890
891 if (!pUserInfo1->usri1_comment || !*pUserInfo1->usri1_comment)
892 { 891 {
893 iRollbackAttributes |= SCAU_REMOVE_COMMENT; 892 iRollbackAttributes |= SCAU_REMOVE_COMMENT;
893 wzOriginalComment = L"";
894 } 894 }
895 895
896 hr = WcaCaScriptWriteString(hRollbackScript, wzOriginalComment);
897 ExitOnFailure(hr, "Failed to add rollback comment to rollback script.");
898
896 hr = WcaCaScriptWriteNumber(hRollbackScript, iRollbackAttributes); 899 hr = WcaCaScriptWriteNumber(hRollbackScript, iRollbackAttributes);
897 ExitOnFailure(hr, "Failed to add rollback attributes to rollback script."); 900 ExitOnFailure(hr, "Failed to add rollback attributes to rollback script.");
898 901
@@ -1247,6 +1250,7 @@ extern "C" UINT __stdcall CreateGroup(
1247 1250
1248 WCA_CASCRIPT_HANDLE hRollbackScript = NULL; 1251 WCA_CASCRIPT_HANDLE hRollbackScript = NULL;
1249 int iRollbackAttributes = 0; 1252 int iRollbackAttributes = 0;
1253 LPCWSTR wzOriginalComment = NULL;
1250 1254
1251 DWORD dw; 1255 DWORD dw;
1252 LPWSTR pwzServerName = NULL; 1256 LPWSTR pwzServerName = NULL;
@@ -1338,14 +1342,16 @@ extern "C" UINT __stdcall CreateGroup(
1338 1342
1339 iRollbackAttributes = 0; 1343 iRollbackAttributes = 0;
1340 1344
1341 hr = WcaCaScriptWriteString(hRollbackScript, pGroupInfo1->lgrpi1_comment); 1345 wzOriginalComment = pGroupInfo1->lgrpi1_comment;
1342 ExitOnFailure(hr, "Failed to add rollback comment to rollback script."); 1346 if (!wzOriginalComment || !*wzOriginalComment)
1343
1344 if (!pGroupInfo1->lgrpi1_comment || !*pGroupInfo1->lgrpi1_comment)
1345 { 1347 {
1346 iRollbackAttributes |= SCAG_REMOVE_COMMENT; 1348 iRollbackAttributes |= SCAG_REMOVE_COMMENT;
1349 wzOriginalComment = L"";
1347 } 1350 }
1348 1351
1352 hr = WcaCaScriptWriteString(hRollbackScript, wzOriginalComment);
1353 ExitOnFailure(hr, "Failed to add rollback comment to rollback script.");
1354
1349 hr = WcaCaScriptWriteNumber(hRollbackScript, iRollbackAttributes); 1355 hr = WcaCaScriptWriteNumber(hRollbackScript, iRollbackAttributes);
1350 ExitOnFailure(hr, "Failed to add rollback attributes to rollback script."); 1356 ExitOnFailure(hr, "Failed to add rollback attributes to rollback script.");
1351 1357
diff --git a/src/ext/Util/ca/utilca.vcxproj b/src/ext/Util/ca/utilca.vcxproj
index 5dbe2792..e7cbc372 100644
--- a/src/ext/Util/ca/utilca.vcxproj
+++ b/src/ext/Util/ca/utilca.vcxproj
@@ -1,7 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> 2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3 3
4<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 4<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <ItemGroup Label="ProjectConfigurations"> 5 <ItemGroup Label="ProjectConfigurations">
6 <ProjectConfiguration Include="Debug|ARM64"> 6 <ProjectConfiguration Include="Debug|ARM64">
7 <Configuration>Debug</Configuration> 7 <Configuration>Debug</Configuration>