aboutsummaryrefslogtreecommitdiff
path: root/src/ca/scaperf.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/scaperf.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/scaperf.cpp')
-rw-r--r--src/ca/scaperf.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/ca/scaperf.cpp b/src/ca/scaperf.cpp
index 82f458af..fd301278 100644
--- a/src/ca/scaperf.cpp
+++ b/src/ca/scaperf.cpp
@@ -2,10 +2,10 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4 4
5LPCWSTR vcsPerfCounterDataQuery = L"SELECT `PerformanceCategory`, `Component_`, `Name`, `IniData`, `ConstantData` FROM `PerformanceCategory`"; 5LPCWSTR vcsPerfCounterDataQuery = L"SELECT `Wix4PerformanceCategory`, `Component_`, `Name`, `IniData`, `ConstantData` FROM `Wix4PerformanceCategory`";
6enum ePerfCounterDataQuery { pcdqId = 1, pcdqComponent, pcdqName, pcdqIniData, pcdqConstantData }; 6enum ePerfCounterDataQuery { pcdqId = 1, pcdqComponent, pcdqName, pcdqIniData, pcdqConstantData };
7 7
8LPCWSTR vcsPerfMonQuery = L"SELECT `Component_`, `File`, `Name` FROM `Perfmon`"; 8LPCWSTR vcsPerfMonQuery = L"SELECT `Component_`, `File`, `Name` FROM `Wix4Perfmon`";
9enum ePerfMonQuery { pmqComponent = 1, pmqFile, pmqName }; 9enum ePerfMonQuery { pmqComponent = 1, pmqFile, pmqName };
10 10
11 11
@@ -32,7 +32,7 @@ extern "C" UINT __stdcall InstallPerfCounterData(
32 ExitOnFailure(hr, "Failed to initialize InstallPerfCounterData."); 32 ExitOnFailure(hr, "Failed to initialize InstallPerfCounterData.");
33 33
34 hr = ProcessPerformanceCategory(hInstall, TRUE); 34 hr = ProcessPerformanceCategory(hInstall, TRUE);
35 MessageExitOnFailure(hr, msierrInstallPerfCounterData, "Failed to process PerformanceCategory table."); 35 MessageExitOnFailure(hr, msierrInstallPerfCounterData, "Failed to process Wix4PerformanceCategory table.");
36 36
37LExit: 37LExit:
38 er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; 38 er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
@@ -57,7 +57,7 @@ extern "C" UINT __stdcall UninstallPerfCounterData(
57 ExitOnFailure(hr, "Failed to initialize UninstallPerfCounterData."); 57 ExitOnFailure(hr, "Failed to initialize UninstallPerfCounterData.");
58 58
59 hr = ProcessPerformanceCategory(hInstall, FALSE); 59 hr = ProcessPerformanceCategory(hInstall, FALSE);
60 MessageExitOnFailure(hr, msierrUninstallPerfCounterData, "Failed to process PerformanceCategory table."); 60 MessageExitOnFailure(hr, msierrUninstallPerfCounterData, "Failed to process Wix4PerformanceCategory table.");
61 61
62LExit: 62LExit:
63 er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; 63 er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
@@ -85,9 +85,9 @@ extern "C" UINT __stdcall ConfigurePerfmonInstall(
85 ExitOnFailure(hr, "Failed to initialize"); 85 ExitOnFailure(hr, "Failed to initialize");
86 86
87 // check to see if necessary tables are specified 87 // check to see if necessary tables are specified
88 if (S_OK != WcaTableExists(L"Perfmon")) 88 if (S_OK != WcaTableExists(L"Wix4Perfmon"))
89 { 89 {
90 WcaLog(LOGMSG_VERBOSE, "Skipping RegisterPerfmon() because Perfmon table not present"); 90 WcaLog(LOGMSG_VERBOSE, "Skipping RegisterPerfmon() because Wix4Perfmon table not present");
91 ExitFunction1(hr = S_FALSE); 91 ExitFunction1(hr = S_FALSE);
92 } 92 }
93 93
@@ -113,9 +113,9 @@ extern "C" UINT __stdcall ConfigurePerfmonInstall(
113 ExitOnFailure(hr, "failed to get File for PerfMon"); 113 ExitOnFailure(hr, "failed to get File for PerfMon");
114 114
115 WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonInstall's CustomActionData: '%ls', '%ls'", pwzName, pwzFile); 115 WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonInstall's CustomActionData: '%ls', '%ls'", pwzName, pwzFile);
116 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RegisterPerfmon"), pwzFile, COST_PERFMON_REGISTER); 116 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RegisterPerfmon"), pwzFile, COST_PERFMON_REGISTER);
117 ExitOnFailure(hr, "failed to schedule RegisterPerfmon action"); 117 ExitOnFailure(hr, "failed to schedule RegisterPerfmon action");
118 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackRegisterPerfmon"), pwzName, COST_PERFMON_UNREGISTER); 118 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackRegisterPerfmon"), pwzName, COST_PERFMON_UNREGISTER);
119 ExitOnFailure(hr, "failed to schedule RollbackRegisterPerfmon action"); 119 ExitOnFailure(hr, "failed to schedule RollbackRegisterPerfmon action");
120 } 120 }
121 121
@@ -158,9 +158,9 @@ extern "C" UINT __stdcall ConfigurePerfmonUninstall(
158 ExitOnFailure(hr, "Failed to initialize"); 158 ExitOnFailure(hr, "Failed to initialize");
159 159
160 // check to see if necessary tables are specified 160 // check to see if necessary tables are specified
161 if (WcaTableExists(L"Perfmon") != S_OK) 161 if (WcaTableExists(L"Wix4Perfmon") != S_OK)
162 { 162 {
163 WcaLog(LOGMSG_VERBOSE, "Skipping UnregisterPerfmon() because Perfmon table not present"); 163 WcaLog(LOGMSG_VERBOSE, "Skipping UnregisterPerfmon() because Wix4Perfmon table not present");
164 ExitFunction1(hr = S_FALSE); 164 ExitFunction1(hr = S_FALSE);
165 } 165 }
166 166
@@ -186,9 +186,9 @@ extern "C" UINT __stdcall ConfigurePerfmonUninstall(
186 ExitOnFailure(hr, "failed to get File for PerfMon"); 186 ExitOnFailure(hr, "failed to get File for PerfMon");
187 187
188 WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonUninstall's CustomActionData: '%ls', '%ls'", pwzName, pwzFile); 188 WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonUninstall's CustomActionData: '%ls', '%ls'", pwzName, pwzFile);
189 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"UnregisterPerfmon"), pwzName, COST_PERFMON_UNREGISTER); 189 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"UnregisterPerfmon"), pwzName, COST_PERFMON_UNREGISTER);
190 ExitOnFailure(hr, "failed to schedule UnregisterPerfmon action"); 190 ExitOnFailure(hr, "failed to schedule UnregisterPerfmon action");
191 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackUnregisterPerfmon"), pwzFile, COST_PERFMON_REGISTER); 191 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackUnregisterPerfmon"), pwzFile, COST_PERFMON_REGISTER);
192 ExitOnFailure(hr, "failed to schedule RollbackUnregisterPerfmon action"); 192 ExitOnFailure(hr, "failed to schedule RollbackUnregisterPerfmon action");
193 } 193 }
194 194
@@ -229,26 +229,26 @@ static HRESULT ProcessPerformanceCategory(
229 LPWSTR pwzCustomActionData = NULL; 229 LPWSTR pwzCustomActionData = NULL;
230 230
231 // check to see if necessary tables are specified 231 // check to see if necessary tables are specified
232 if (S_OK != WcaTableExists(L"PerformanceCategory")) 232 if (S_OK != WcaTableExists(L"Wix4PerformanceCategory"))
233 { 233 {
234 ExitFunction1(hr = S_FALSE); 234 ExitFunction1(hr = S_FALSE);
235 } 235 }
236 236
237 hr = WcaOpenExecuteView(vcsPerfCounterDataQuery, &hView); 237 hr = WcaOpenExecuteView(vcsPerfCounterDataQuery, &hView);
238 ExitOnFailure(hr, "failed to open view on PerformanceCategory table"); 238 ExitOnFailure(hr, "failed to open view on Wix4PerformanceCategory table");
239 while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) 239 while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
240 { 240 {
241 hr = WcaGetRecordString(hRec, pcdqId, &pwzId); 241 hr = WcaGetRecordString(hRec, pcdqId, &pwzId);
242 ExitOnFailure(hr, "Failed to get id for PerformanceCategory."); 242 ExitOnFailure(hr, "Failed to get id for Wix4PerformanceCategory.");
243 243
244 // Check to see if the Component is being installed or uninstalled 244 // Check to see if the Component is being installed or uninstalled
245 // when we are processing the same. 245 // when we are processing the same.
246 hr = WcaGetRecordString(hRec, pcdqComponent, &pwzComponent); 246 hr = WcaGetRecordString(hRec, pcdqComponent, &pwzComponent);
247 ExitOnFailure(hr, "Failed to get Component for PerformanceCategory: %ls", pwzId); 247 ExitOnFailure(hr, "Failed to get Component for Wix4PerformanceCategory: %ls", pwzId);
248 248
249 er = ::MsiGetComponentStateW(hInstall, pwzComponent, &isInstalled, &isAction); 249 er = ::MsiGetComponentStateW(hInstall, pwzComponent, &isInstalled, &isAction);
250 hr = HRESULT_FROM_WIN32(er); 250 hr = HRESULT_FROM_WIN32(er);
251 ExitOnFailure(hr, "Failed to get Component state for PerformanceCategory: %ls", pwzId); 251 ExitOnFailure(hr, "Failed to get Component state for Wix4PerformanceCategory: %ls", pwzId);
252 252
253 if ((fInstall && !WcaIsInstalling(isInstalled, isAction)) || 253 if ((fInstall && !WcaIsInstalling(isInstalled, isAction)) ||
254 (!fInstall && !WcaIsUninstalling(isInstalled, isAction))) 254 (!fInstall && !WcaIsUninstalling(isInstalled, isAction)))
@@ -257,45 +257,45 @@ static HRESULT ProcessPerformanceCategory(
257 } 257 }
258 258
259 hr = WcaGetRecordString(hRec, pcdqName, &pwzName); 259 hr = WcaGetRecordString(hRec, pcdqName, &pwzName);
260 ExitOnFailure(hr, "Failed to get Name for PerformanceCategory: %ls", pwzId); 260 ExitOnFailure(hr, "Failed to get Name for Wix4PerformanceCategory: %ls", pwzId);
261 hr = WcaWriteStringToCaData(pwzName, &pwzCustomActionData); 261 hr = WcaWriteStringToCaData(pwzName, &pwzCustomActionData);
262 ExitOnFailure(hr, "Failed to add Name to CustomActionData for PerformanceCategory: %ls", pwzId); 262 ExitOnFailure(hr, "Failed to add Name to CustomActionData for Wix4PerformanceCategory: %ls", pwzId);
263 263
264 hr = WcaGetRecordString(hRec, pcdqIniData, &pwzData); 264 hr = WcaGetRecordString(hRec, pcdqIniData, &pwzData);
265 ExitOnFailure(hr, "Failed to get IniData for PerformanceCategory: %ls", pwzId); 265 ExitOnFailure(hr, "Failed to get IniData for Wix4PerformanceCategory: %ls", pwzId);
266 hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData); 266 hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData);
267 ExitOnFailure(hr, "Failed to add IniData to CustomActionData for PerformanceCategory: %ls", pwzId); 267 ExitOnFailure(hr, "Failed to add IniData to CustomActionData for Wix4PerformanceCategory: %ls", pwzId);
268 268
269 hr = WcaGetRecordString(hRec, pcdqConstantData, &pwzData); 269 hr = WcaGetRecordString(hRec, pcdqConstantData, &pwzData);
270 ExitOnFailure(hr, "Failed to get ConstantData for PerformanceCategory: %ls", pwzId); 270 ExitOnFailure(hr, "Failed to get ConstantData for Wix4PerformanceCategory: %ls", pwzId);
271 hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData); 271 hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData);
272 ExitOnFailure(hr, "Failed to add ConstantData to CustomActionData for PerformanceCategory: %ls", pwzId); 272 ExitOnFailure(hr, "Failed to add ConstantData to CustomActionData for Wix4PerformanceCategory: %ls", pwzId);
273 } 273 }
274 274
275 if (hr == E_NOMOREITEMS) 275 if (hr == E_NOMOREITEMS)
276 { 276 {
277 hr = S_OK; 277 hr = S_OK;
278 } 278 }
279 ExitOnFailure(hr, "Failure while processing PerformanceCategory table."); 279 ExitOnFailure(hr, "Failure while processing Wix4PerformanceCategory table.");
280 280
281 // If there was any data built up, schedule it for execution. 281 // If there was any data built up, schedule it for execution.
282 if (pwzCustomActionData) 282 if (pwzCustomActionData)
283 { 283 {
284 if (fInstall) 284 if (fInstall)
285 { 285 {
286 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackRegisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_UNREGISTER); 286 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackRegisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_UNREGISTER);
287 ExitOnFailure(hr, "Failed to schedule RollbackRegisterPerfCounterData action for PerformanceCategory: %ls", pwzId); 287 ExitOnFailure(hr, "Failed to schedule RollbackRegisterPerfCounterData action for Wix4PerformanceCategory: %ls", pwzId);
288 288
289 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RegisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_REGISTER); 289 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RegisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_REGISTER);
290 ExitOnFailure(hr, "Failed to schedule RegisterPerfCounterData action for PerformanceCategory: %ls", pwzId); 290 ExitOnFailure(hr, "Failed to schedule RegisterPerfCounterData action for Wix4PerformanceCategory: %ls", pwzId);
291 } 291 }
292 else 292 else
293 { 293 {
294 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"RollbackUnregisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_REGISTER); 294 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackUnregisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_REGISTER);
295 ExitOnFailure(hr, "Failed to schedule RollbackUnregisterPerfCounterData action for PerformanceCategory: %ls", pwzId); 295 ExitOnFailure(hr, "Failed to schedule RollbackUnregisterPerfCounterData action for Wix4PerformanceCategory: %ls", pwzId);
296 296
297 hr = WcaDoDeferredAction(PLATFORM_DECORATION(L"UnregisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_UNREGISTER); 297 hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"UnregisterPerfCounterData"), pwzCustomActionData, COST_PERFMON_UNREGISTER);
298 ExitOnFailure(hr, "Failed to schedule UnregisterPerfCounterData action for PerformanceCategory: %ls", pwzId); 298 ExitOnFailure(hr, "Failed to schedule UnregisterPerfCounterData action for Wix4PerformanceCategory: %ls", pwzId);
299 } 299 }
300 } 300 }
301 301