aboutsummaryrefslogtreecommitdiff
path: root/src/ca/XmlFile.cpp
diff options
context:
space:
mode:
authorBob Arnson <bob@joyofsetup.com>2020-03-05 19:48:12 -0500
committerBob Arnson <bob@firegiant.com>2020-03-09 12:16:09 -0400
commite9d10933bedb8215ec50ca85db272d6647426b31 (patch)
tree262cbaf190de5d5461941c79923bef8cf4cf7ad1 /src/ca/XmlFile.cpp
parent7533ca33de2b8125e9f9ecb3b28a247acca85f83 (diff)
downloadwix-e9d10933bedb8215ec50ca85db272d6647426b31.tar.gz
wix-e9d10933bedb8215ec50ca85db272d6647426b31.tar.bz2
wix-e9d10933bedb8215ec50ca85db272d6647426b31.zip
Version extension ids.
Partial fix for wixtoolset/issues#5933.
Diffstat (limited to 'src/ca/XmlFile.cpp')
-rw-r--r--src/ca/XmlFile.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/ca/XmlFile.cpp b/src/ca/XmlFile.cpp
index fc6f519b..95449126 100644
--- a/src/ca/XmlFile.cpp
+++ b/src/ca/XmlFile.cpp
@@ -36,9 +36,9 @@ enum eXmlSelectionLanguage
36}; 36};
37 37
38LPCWSTR vcsXmlFileQuery = 38LPCWSTR vcsXmlFileQuery =
39 L"SELECT `XmlFile`.`XmlFile`, `XmlFile`.`File`, `XmlFile`.`ElementPath`, `XmlFile`.`Name`, `XmlFile`.`Value`, " 39 L"SELECT `Wix4XmlFile`.`Wix4XmlFile`, `Wix4XmlFile`.`File`, `Wix4XmlFile`.`ElementPath`, `Wix4XmlFile`.`Name`, `Wix4XmlFile`.`Value`, "
40 L"`XmlFile`.`Flags`, `XmlFile`.`Component_`, `Component`.`Attributes` " 40 L"`Wix4XmlFile`.`Flags`, `Wix4XmlFile`.`Component_`, `Component`.`Attributes` "
41 L"FROM `XmlFile`,`Component` WHERE `XmlFile`.`Component_`=`Component`.`Component` ORDER BY `File`, `Sequence`"; 41 L"FROM `Wix4XmlFile`,`Component` WHERE `Wix4XmlFile`.`Component_`=`Component`.`Component` ORDER BY `File`, `Sequence`";
42enum eXmlFileQuery { xfqXmlFile = 1, xfqFile, xfqXPath, xfqName, xfqValue, xfqXmlFlags, xfqComponent, xfqCompAttributes }; 42enum eXmlFileQuery { xfqXmlFile = 1, xfqFile, xfqXPath, xfqName, xfqValue, xfqXmlFlags, xfqComponent, xfqCompAttributes };
43 43
44struct XML_FILE_CHANGE 44struct XML_FILE_CHANGE
@@ -130,12 +130,14 @@ static HRESULT ReadXmlFileTable(
130 LPWSTR pwzData = NULL; 130 LPWSTR pwzData = NULL;
131 131
132 // check to see if necessary tables are specified 132 // check to see if necessary tables are specified
133 if (S_FALSE == WcaTableExists(L"XmlFile")) 133 if (S_FALSE == WcaTableExists(L"Wix4XmlFile"))
134 {
134 ExitFunction1(hr = S_FALSE); 135 ExitFunction1(hr = S_FALSE);
136 }
135 137
136 // loop through all the xml configurations 138 // loop through all the xml configurations
137 hr = WcaOpenExecuteView(vcsXmlFileQuery, &hView); 139 hr = WcaOpenExecuteView(vcsXmlFileQuery, &hView);
138 ExitOnFailure(hr, "failed to open view on XmlFile table"); 140 ExitOnFailure(hr, "failed to open view on Wix4XmlFile table");
139 141
140 while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) 142 while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
141 { 143 {
@@ -144,13 +146,13 @@ static HRESULT ReadXmlFileTable(
144 146
145 // Get record Id 147 // Get record Id
146 hr = WcaGetRecordString(hRec, xfqXmlFile, &pwzData); 148 hr = WcaGetRecordString(hRec, xfqXmlFile, &pwzData);
147 ExitOnFailure(hr, "failed to get XmlFile record Id"); 149 ExitOnFailure(hr, "failed to get Wix4XmlFile record Id");
148 hr = StringCchCopyW((*ppxfcTail)->wzId, countof((*ppxfcTail)->wzId), pwzData); 150 hr = StringCchCopyW((*ppxfcTail)->wzId, countof((*ppxfcTail)->wzId), pwzData);
149 ExitOnFailure(hr, "failed to copy XmlFile record Id"); 151 ExitOnFailure(hr, "failed to copy Wix4XmlFile record Id");
150 152
151 // Get component name 153 // Get component name
152 hr = WcaGetRecordString(hRec, xfqComponent, &pwzData); 154 hr = WcaGetRecordString(hRec, xfqComponent, &pwzData);
153 ExitOnFailure(hr, "failed to get component name for XmlFile: %ls", (*ppxfcTail)->wzId); 155 ExitOnFailure(hr, "failed to get component name for Wix4XmlFile: %ls", (*ppxfcTail)->wzId);
154 156
155 // Get the component's state 157 // Get the component's state
156 er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &(*ppxfcTail)->isInstalled, &(*ppxfcTail)->isAction); 158 er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &(*ppxfcTail)->isInstalled, &(*ppxfcTail)->isAction);
@@ -158,33 +160,33 @@ static HRESULT ReadXmlFileTable(
158 160
159 // Get the xml file 161 // Get the xml file
160 hr = WcaGetRecordFormattedString(hRec, xfqFile, &pwzData); 162 hr = WcaGetRecordFormattedString(hRec, xfqFile, &pwzData);
161 ExitOnFailure(hr, "failed to get xml file for XmlFile: %ls", (*ppxfcTail)->wzId); 163 ExitOnFailure(hr, "failed to get xml file for Wix4XmlFile: %ls", (*ppxfcTail)->wzId);
162 hr = StringCchCopyW((*ppxfcTail)->wzFile, countof((*ppxfcTail)->wzFile), pwzData); 164 hr = StringCchCopyW((*ppxfcTail)->wzFile, countof((*ppxfcTail)->wzFile), pwzData);
163 ExitOnFailure(hr, "failed to copy xml file path"); 165 ExitOnFailure(hr, "failed to copy xml file path");
164 166
165 // Get the XmlFile table flags 167 // Get the Wix4XmlFile table flags
166 hr = WcaGetRecordInteger(hRec, xfqXmlFlags, &(*ppxfcTail)->iXmlFlags); 168 hr = WcaGetRecordInteger(hRec, xfqXmlFlags, &(*ppxfcTail)->iXmlFlags);
167 ExitOnFailure(hr, "failed to get XmlFile flags for XmlFile: %ls", (*ppxfcTail)->wzId); 169 ExitOnFailure(hr, "failed to get Wix4XmlFile flags for Wix4XmlFile: %ls", (*ppxfcTail)->wzId);
168 170
169 // Get the XPath 171 // Get the XPath
170 hr = WcaGetRecordFormattedString(hRec, xfqXPath, &(*ppxfcTail)->pwzElementPath); 172 hr = WcaGetRecordFormattedString(hRec, xfqXPath, &(*ppxfcTail)->pwzElementPath);
171 ExitOnFailure(hr, "failed to get XPath for XmlFile: %ls", (*ppxfcTail)->wzId); 173 ExitOnFailure(hr, "failed to get XPath for Wix4XmlFile: %ls", (*ppxfcTail)->wzId);
172 174
173 // Get the name 175 // Get the name
174 hr = WcaGetRecordFormattedString(hRec, xfqName, &pwzData); 176 hr = WcaGetRecordFormattedString(hRec, xfqName, &pwzData);
175 ExitOnFailure(hr, "failed to get Name for XmlFile: %ls", (*ppxfcTail)->wzId); 177 ExitOnFailure(hr, "failed to get Name for Wix4XmlFile: %ls", (*ppxfcTail)->wzId);
176 hr = StringCchCopyW((*ppxfcTail)->wzName, countof((*ppxfcTail)->wzName), pwzData); 178 hr = StringCchCopyW((*ppxfcTail)->wzName, countof((*ppxfcTail)->wzName), pwzData);
177 ExitOnFailure(hr, "failed to copy name of element"); 179 ExitOnFailure(hr, "failed to copy name of element");
178 180
179 // Get the value 181 // Get the value
180 hr = WcaGetRecordFormattedString(hRec, xfqValue, &pwzData); 182 hr = WcaGetRecordFormattedString(hRec, xfqValue, &pwzData);
181 ExitOnFailure(hr, "failed to get Value for XmlFile: %ls", (*ppxfcTail)->wzId); 183 ExitOnFailure(hr, "failed to get Value for Wix4XmlFile: %ls", (*ppxfcTail)->wzId);
182 hr = StrAllocString(&(*ppxfcTail)->pwzValue, pwzData, 0); 184 hr = StrAllocString(&(*ppxfcTail)->pwzValue, pwzData, 0);
183 ExitOnFailure(hr, "failed to allocate buffer for value"); 185 ExitOnFailure(hr, "failed to allocate buffer for value");
184 186
185 // Get the component attributes 187 // Get the component attributes
186 hr = WcaGetRecordInteger(hRec, xfqCompAttributes, &(*ppxfcTail)->iCompAttributes); 188 hr = WcaGetRecordInteger(hRec, xfqCompAttributes, &(*ppxfcTail)->iCompAttributes);
187 ExitOnFailure(hr, "failed to get component attributes for XmlFile: %ls", (*ppxfcTail)->wzId); 189 ExitOnFailure(hr, "failed to get component attributes for Wix4XmlFile: %ls", (*ppxfcTail)->wzId);
188 } 190 }
189 191
190 // if we looped through all records all is well 192 // if we looped through all records all is well
@@ -254,7 +256,7 @@ static HRESULT BeginChangeFile(
254 hr = WcaWriteStreamToCaData(pbData, cbData, &pwzRollbackCustomActionData); 256 hr = WcaWriteStreamToCaData(pbData, cbData, &pwzRollbackCustomActionData);
255 ExitOnFailure(hr, "failed to write file contents to rollback custom action data."); 257 ExitOnFailure(hr, "failed to write file contents to rollback custom action data.");
256 258
257 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"ExecXmlFileRollback"), pwzRollbackCustomActionData, COST_XMLFILE); 259 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"ExecXmlFileRollback"), pwzRollbackCustomActionData, COST_XMLFILE);
258 ExitOnFailure(hr, "failed to schedule ExecXmlFileRollback for file: %ls", pwzFile); 260 ExitOnFailure(hr, "failed to schedule ExecXmlFileRollback for file: %ls", pwzFile);
259 261
260 ReleaseStr(pwzRollbackCustomActionData); 262 ReleaseStr(pwzRollbackCustomActionData);
@@ -325,11 +327,11 @@ extern "C" UINT __stdcall SchedXmlFile(
325 hr = ReadXmlFileTable(&pxfcHead, &pxfcTail); 327 hr = ReadXmlFileTable(&pxfcHead, &pxfcTail);
326 if (S_FALSE == hr) 328 if (S_FALSE == hr)
327 { 329 {
328 WcaLog(LOGMSG_VERBOSE, "Skipping SchedXmlFile because XmlFile table not present"); 330 WcaLog(LOGMSG_VERBOSE, "Skipping SchedXmlFile because Wix4XmlFile table not present");
329 ExitFunction1(hr = S_OK); 331 ExitFunction1(hr = S_OK);
330 } 332 }
331 333
332 MessageExitOnFailure(hr, msierrXmlFileFailedRead, "failed to read XmlFile table"); 334 MessageExitOnFailure(hr, msierrXmlFileFailedRead, "failed to read Wix4XmlFile table");
333 335
334 // loop through all the xml configurations 336 // loop through all the xml configurations
335 for (pxfc = pxfcHead; pxfc; pxfc = pxfc->pxfcNext) 337 for (pxfc = pxfcHead; pxfc; pxfc = pxfc->pxfcNext)
@@ -454,7 +456,7 @@ extern "C" UINT __stdcall SchedXmlFile(
454 { 456 {
455 Assert(0 < cFiles); 457 Assert(0 < cFiles);
456 458
457 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"ExecXmlFile"), pwzCustomActionData, cFiles * COST_XMLFILE); 459 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"ExecXmlFile"), pwzCustomActionData, cFiles * COST_XMLFILE);
458 ExitOnFailure(hr, "failed to schedule ExecXmlFile action"); 460 ExitOnFailure(hr, "failed to schedule ExecXmlFile action");
459 } 461 }
460 462