@@ -764,6 +764,7 @@ extern "C" UINT __stdcall CreateUser(
764764 WCA_CASCRIPT_HANDLE hRollbackScript = NULL ;
765765 int iOriginalAttributes = 0 ;
766766 int iRollbackAttributes = 0 ;
767+ LPCWSTR wzOriginalComment = NULL ;
767768
768769 USER_INFO_1 userInfo1;
769770 USER_INFO_1* pUserInfo1 = NULL ;
@@ -885,14 +886,16 @@ extern "C" UINT __stdcall CreateUser(
885886 }
886887 }
887888
888- hr = WcaCaScriptWriteString (hRollbackScript, pUserInfo1->usri1_comment );
889- ExitOnFailure (hr, " Failed to add rollback comment to rollback script." );
890-
891- if (!pUserInfo1->usri1_comment || !*pUserInfo1->usri1_comment )
889+ wzOriginalComment = pUserInfo1->usri1_comment ;
890+ if (!wzOriginalComment || !*wzOriginalComment)
892891 {
893892 iRollbackAttributes |= SCAU_REMOVE_COMMENT;
893+ wzOriginalComment = L" " ;
894894 }
895895
896+ hr = WcaCaScriptWriteString (hRollbackScript, wzOriginalComment);
897+ ExitOnFailure (hr, " Failed to add rollback comment to rollback script." );
898+
896899 hr = WcaCaScriptWriteNumber (hRollbackScript, iRollbackAttributes);
897900 ExitOnFailure (hr, " Failed to add rollback attributes to rollback script." );
898901
@@ -1247,6 +1250,7 @@ extern "C" UINT __stdcall CreateGroup(
12471250
12481251 WCA_CASCRIPT_HANDLE hRollbackScript = NULL ;
12491252 int iRollbackAttributes = 0 ;
1253+ LPCWSTR wzOriginalComment = NULL ;
12501254
12511255 DWORD dw;
12521256 LPWSTR pwzServerName = NULL ;
@@ -1338,14 +1342,16 @@ extern "C" UINT __stdcall CreateGroup(
13381342
13391343 iRollbackAttributes = 0 ;
13401344
1341- hr = WcaCaScriptWriteString (hRollbackScript, pGroupInfo1->lgrpi1_comment );
1342- ExitOnFailure (hr, " Failed to add rollback comment to rollback script." );
1343-
1344- if (!pGroupInfo1->lgrpi1_comment || !*pGroupInfo1->lgrpi1_comment )
1345+ wzOriginalComment = pGroupInfo1->lgrpi1_comment ;
1346+ if (!wzOriginalComment || !*wzOriginalComment)
13451347 {
13461348 iRollbackAttributes |= SCAG_REMOVE_COMMENT;
1349+ wzOriginalComment = L" " ;
13471350 }
13481351
1352+ hr = WcaCaScriptWriteString (hRollbackScript, wzOriginalComment);
1353+ ExitOnFailure (hr, " Failed to add rollback comment to rollback script." );
1354+
13491355 hr = WcaCaScriptWriteNumber (hRollbackScript, iRollbackAttributes);
13501356 ExitOnFailure (hr, " Failed to add rollback attributes to rollback script." );
13511357
0 commit comments