summaryrefslogtreecommitdiff
path: root/src/burn/engine/registration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/registration.cpp')
-rw-r--r--src/burn/engine/registration.cpp87
1 files changed, 1 insertions, 86 deletions
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp
index 78f8eeb1..f2b8383d 100644
--- a/src/burn/engine/registration.cpp
+++ b/src/burn/engine/registration.cpp
@@ -71,10 +71,6 @@ static HRESULT UpdateResumeMode(
71 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType, 71 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType,
72 __in BOOL fRestartInitiated 72 __in BOOL fRestartInitiated
73 ); 73 );
74static HRESULT ParseRelatedCodes(
75 __in BURN_REGISTRATION* pRegistration,
76 __in IXMLDOMNode* pixnBundle
77 );
78static HRESULT FormatUpdateRegistrationKey( 74static HRESULT FormatUpdateRegistrationKey(
79 __in BURN_REGISTRATION* pRegistration, 75 __in BURN_REGISTRATION* pRegistration,
80 __out_z LPWSTR* psczKey 76 __out_z LPWSTR* psczKey
@@ -143,7 +139,7 @@ extern "C" HRESULT RegistrationParseFromXml(
143 hr = XmlGetAttributeEx(pixnRegistrationNode, L"Tag", &pRegistration->sczTag); 139 hr = XmlGetAttributeEx(pixnRegistrationNode, L"Tag", &pRegistration->sczTag);
144 ExitOnFailure(hr, "Failed to get @Tag."); 140 ExitOnFailure(hr, "Failed to get @Tag.");
145 141
146 hr = ParseRelatedCodes(pRegistration, pixnBundle); 142 hr = BundlePackageEngineParseRelatedCodes(pixnBundle, &pRegistration->rgsczDetectCodes, &pRegistration->cDetectCodes, &pRegistration->rgsczUpgradeCodes, &pRegistration->cUpgradeCodes, &pRegistration->rgsczAddonCodes, &pRegistration->cAddonCodes, &pRegistration->rgsczPatchCodes, &pRegistration->cPatchCodes);
147 ExitOnFailure(hr, "Failed to parse related bundles"); 143 ExitOnFailure(hr, "Failed to parse related bundles");
148 144
149 // @Version 145 // @Version
@@ -1395,87 +1391,6 @@ LExit:
1395 return hr; 1391 return hr;
1396} 1392}
1397 1393
1398static HRESULT ParseRelatedCodes(
1399 __in BURN_REGISTRATION* pRegistration,
1400 __in IXMLDOMNode* pixnBundle
1401 )
1402{
1403 HRESULT hr = S_OK;
1404 IXMLDOMNodeList* pixnNodes = NULL;
1405 IXMLDOMNode* pixnElement = NULL;
1406 LPWSTR sczAction = NULL;
1407 LPWSTR sczId = NULL;
1408 DWORD cElements = 0;
1409
1410 hr = XmlSelectNodes(pixnBundle, L"RelatedBundle", &pixnNodes);
1411 ExitOnFailure(hr, "Failed to get RelatedBundle nodes");
1412
1413 hr = pixnNodes->get_length((long*)&cElements);
1414 ExitOnFailure(hr, "Failed to get RelatedBundle element count.");
1415
1416 for (DWORD i = 0; i < cElements; ++i)
1417 {
1418 hr = XmlNextElement(pixnNodes, &pixnElement, NULL);
1419 ExitOnFailure(hr, "Failed to get next RelatedBundle element.");
1420
1421 hr = XmlGetAttributeEx(pixnElement, L"Action", &sczAction);
1422 ExitOnFailure(hr, "Failed to get @Action.");
1423
1424 hr = XmlGetAttributeEx(pixnElement, L"Id", &sczId);
1425 ExitOnFailure(hr, "Failed to get @Id.");
1426
1427 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczAction, -1, L"Detect", -1))
1428 {
1429 hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pRegistration->rgsczDetectCodes), pRegistration->cDetectCodes + 1, sizeof(LPWSTR), 5);
1430 ExitOnFailure(hr, "Failed to resize Detect code array in registration");
1431
1432 pRegistration->rgsczDetectCodes[pRegistration->cDetectCodes] = sczId;
1433 sczId = NULL;
1434 ++pRegistration->cDetectCodes;
1435 }
1436 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczAction, -1, L"Upgrade", -1))
1437 {
1438 hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pRegistration->rgsczUpgradeCodes), pRegistration->cUpgradeCodes + 1, sizeof(LPWSTR), 5);
1439 ExitOnFailure(hr, "Failed to resize Upgrade code array in registration");
1440
1441 pRegistration->rgsczUpgradeCodes[pRegistration->cUpgradeCodes] = sczId;
1442 sczId = NULL;
1443 ++pRegistration->cUpgradeCodes;
1444 }
1445 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczAction, -1, L"Addon", -1))
1446 {
1447 hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pRegistration->rgsczAddonCodes), pRegistration->cAddonCodes + 1, sizeof(LPWSTR), 5);
1448 ExitOnFailure(hr, "Failed to resize Addon code array in registration");
1449
1450 pRegistration->rgsczAddonCodes[pRegistration->cAddonCodes] = sczId;
1451 sczId = NULL;
1452 ++pRegistration->cAddonCodes;
1453 }
1454 else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczAction, -1, L"Patch", -1))
1455 {
1456 hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pRegistration->rgsczPatchCodes), pRegistration->cPatchCodes + 1, sizeof(LPWSTR), 5);
1457 ExitOnFailure(hr, "Failed to resize Patch code array in registration");
1458
1459 pRegistration->rgsczPatchCodes[pRegistration->cPatchCodes] = sczId;
1460 sczId = NULL;
1461 ++pRegistration->cPatchCodes;
1462 }
1463 else
1464 {
1465 hr = E_INVALIDARG;
1466 ExitOnFailure(hr, "Invalid value for @Action: %ls", sczAction);
1467 }
1468 }
1469
1470LExit:
1471 ReleaseObject(pixnNodes);
1472 ReleaseObject(pixnElement);
1473 ReleaseStr(sczAction);
1474 ReleaseStr(sczId);
1475
1476 return hr;
1477}
1478
1479static HRESULT FormatUpdateRegistrationKey( 1394static HRESULT FormatUpdateRegistrationKey(
1480 __in BURN_REGISTRATION* pRegistration, 1395 __in BURN_REGISTRATION* pRegistration,
1481 __out_z LPWSTR* psczKey 1396 __out_z LPWSTR* psczKey