diff options
author | Bob Arnson <bob@firegiant.com> | 2021-01-31 19:28:47 -0500 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2021-01-31 19:35:27 -0500 |
commit | f1f1a124df59e8639c2bcbfa7d3a4b37fb348bb7 (patch) | |
tree | 6866de4e995d3ae55affff6c70e3d93175583c65 | |
parent | 0e41fb8be9690ca7b81ec4df0734ead1978a9cf0 (diff) | |
download | wix-f1f1a124df59e8639c2bcbfa7d3a4b37fb348bb7.tar.gz wix-f1f1a124df59e8639c2bcbfa7d3a4b37fb348bb7.tar.bz2 wix-f1f1a124df59e8639c2bcbfa7d3a4b37fb348bb7.zip |
Remove Burn Authenticode
Fixes https://github.com/wixtoolset/issues/issues/6301
-rw-r--r-- | src/engine/cache.cpp | 252 | ||||
-rw-r--r-- | src/engine/cache.h | 7 | ||||
-rw-r--r-- | src/engine/catalog.cpp | 180 | ||||
-rw-r--r-- | src/engine/catalog.h | 56 | ||||
-rw-r--r-- | src/engine/core.cpp | 4 | ||||
-rw-r--r-- | src/engine/core.h | 1 | ||||
-rw-r--r-- | src/engine/engine.cpp | 1 | ||||
-rw-r--r-- | src/engine/engine.vcxproj | 18 | ||||
-rw-r--r-- | src/engine/manifest.cpp | 6 | ||||
-rw-r--r-- | src/engine/payload.cpp | 33 | ||||
-rw-r--r-- | src/engine/payload.h | 6 | ||||
-rw-r--r-- | src/engine/precomp.h | 1 | ||||
-rw-r--r-- | src/engine/userexperience.cpp | 2 | ||||
-rw-r--r-- | src/stub/stub.vcxproj | 4 | ||||
-rw-r--r-- | src/test/BurnUnitTest/BurnUnitTest.vcxproj | 2 | ||||
-rw-r--r-- | src/test/BurnUnitTest/precomp.h | 1 |
16 files changed, 12 insertions, 562 deletions
diff --git a/src/engine/cache.cpp b/src/engine/cache.cpp index 315281bc..92a79eb9 100644 --- a/src/engine/cache.cpp +++ b/src/engine/cache.cpp | |||
@@ -94,15 +94,6 @@ static HRESULT VerifyHash( | |||
94 | __in_z LPCWSTR wzUnverifiedPayloadPath, | 94 | __in_z LPCWSTR wzUnverifiedPayloadPath, |
95 | __in HANDLE hFile | 95 | __in HANDLE hFile |
96 | ); | 96 | ); |
97 | static HRESULT VerifyPayloadWithCatalog( | ||
98 | __in BURN_PAYLOAD* pPayload, | ||
99 | __in_z LPCWSTR wzUnverifiedPayloadPath, | ||
100 | __in HANDLE hFile | ||
101 | ); | ||
102 | static HRESULT VerifyPayloadAgainstChain( | ||
103 | __in BURN_PAYLOAD* pPayload, | ||
104 | __in PCCERT_CHAIN_CONTEXT pChainContext | ||
105 | ); | ||
106 | 97 | ||
107 | 98 | ||
108 | extern "C" HRESULT CacheInitialize( | 99 | extern "C" HRESULT CacheInitialize( |
@@ -189,7 +180,7 @@ LExit: | |||
189 | } | 180 | } |
190 | 181 | ||
191 | extern "C" HRESULT CacheEnsureWorkingFolder( | 182 | extern "C" HRESULT CacheEnsureWorkingFolder( |
192 | __in_z LPCWSTR wzBundleId, | 183 | __in_z_opt LPCWSTR wzBundleId, |
193 | __deref_out_z_opt LPWSTR* psczWorkingFolder | 184 | __deref_out_z_opt LPWSTR* psczWorkingFolder |
194 | ) | 185 | ) |
195 | { | 186 | { |
@@ -964,56 +955,6 @@ LExit: | |||
964 | return hr; | 955 | return hr; |
965 | } | 956 | } |
966 | 957 | ||
967 | extern "C" HRESULT CacheVerifyPayloadSignature( | ||
968 | __in BURN_PAYLOAD* pPayload, | ||
969 | __in_z LPCWSTR wzUnverifiedPayloadPath, | ||
970 | __in HANDLE hFile | ||
971 | ) | ||
972 | { | ||
973 | HRESULT hr = S_OK; | ||
974 | LONG er = ERROR_SUCCESS; | ||
975 | |||
976 | GUID guidAuthenticode = WINTRUST_ACTION_GENERIC_VERIFY_V2; | ||
977 | WINTRUST_FILE_INFO wfi = { }; | ||
978 | WINTRUST_DATA wtd = { }; | ||
979 | CRYPT_PROVIDER_DATA* pProviderData = NULL; | ||
980 | CRYPT_PROVIDER_SGNR* pSigner = NULL; | ||
981 | |||
982 | // Verify the payload assuming online. | ||
983 | wfi.cbStruct = sizeof(wfi); | ||
984 | wfi.pcwszFilePath = wzUnverifiedPayloadPath; | ||
985 | wfi.hFile = hFile; | ||
986 | |||
987 | wtd.cbStruct = sizeof(wtd); | ||
988 | wtd.dwUnionChoice = WTD_CHOICE_FILE; | ||
989 | wtd.pFile = &wfi; | ||
990 | wtd.dwStateAction = WTD_STATEACTION_VERIFY; | ||
991 | wtd.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT; | ||
992 | wtd.dwUIChoice = WTD_UI_NONE; | ||
993 | |||
994 | er = ::WinVerifyTrust(static_cast<HWND>(INVALID_HANDLE_VALUE), &guidAuthenticode, &wtd); | ||
995 | if (er) | ||
996 | { | ||
997 | // Verify the payload assuming offline. | ||
998 | wtd.dwProvFlags |= WTD_CACHE_ONLY_URL_RETRIEVAL; | ||
999 | |||
1000 | er = ::WinVerifyTrust(static_cast<HWND>(INVALID_HANDLE_VALUE), &guidAuthenticode, &wtd); | ||
1001 | ExitOnWin32Error(er, hr, "Failed authenticode verification of payload: %ls", wzUnverifiedPayloadPath); | ||
1002 | } | ||
1003 | |||
1004 | pProviderData = WTHelperProvDataFromStateData(wtd.hWVTStateData); | ||
1005 | ExitOnNullWithLastError(pProviderData, hr, "Failed to get provider state from authenticode certificate."); | ||
1006 | |||
1007 | pSigner = WTHelperGetProvSignerFromChain(pProviderData, 0, FALSE, 0); | ||
1008 | ExitOnNullWithLastError(pSigner, hr, "Failed to get signer chain from authenticode certificate."); | ||
1009 | |||
1010 | hr = VerifyPayloadAgainstChain(pPayload, pSigner->pChainContext); | ||
1011 | ExitOnFailure(hr, "Failed to verify expected payload against actual certificate chain."); | ||
1012 | |||
1013 | LExit: | ||
1014 | return hr; | ||
1015 | } | ||
1016 | |||
1017 | extern "C" void CacheCleanup( | 958 | extern "C" void CacheCleanup( |
1018 | __in BOOL fPerMachine, | 959 | __in BOOL fPerMachine, |
1019 | __in_z LPCWSTR wzBundleId | 960 | __in_z LPCWSTR wzBundleId |
@@ -1098,7 +1039,7 @@ extern "C" void CacheUninitialize() | |||
1098 | // Internal functions. | 1039 | // Internal functions. |
1099 | 1040 | ||
1100 | static HRESULT CalculateWorkingFolder( | 1041 | static HRESULT CalculateWorkingFolder( |
1101 | __in_z LPCWSTR /*wzBundleId*/, | 1042 | __in_z_opt LPCWSTR /*wzBundleId*/, |
1102 | __deref_out_z LPWSTR* psczWorkingFolder | 1043 | __deref_out_z LPWSTR* psczWorkingFolder |
1103 | ) | 1044 | ) |
1104 | { | 1045 | { |
@@ -1387,18 +1328,7 @@ static HRESULT VerifyThenTransferPayload( | |||
1387 | ExitWithLastError(hr, "Failed to open payload in working path: %ls", wzUnverifiedPayloadPath); | 1328 | ExitWithLastError(hr, "Failed to open payload in working path: %ls", wzUnverifiedPayloadPath); |
1388 | } | 1329 | } |
1389 | 1330 | ||
1390 | // If the payload has a certificate root public key identifier provided, verify the certificate. | 1331 | if (pPayload->pbHash) // the payload should have a hash we can use to verify it. |
1391 | if (pPayload->pbCertificateRootPublicKeyIdentifier) | ||
1392 | { | ||
1393 | hr = CacheVerifyPayloadSignature(pPayload, wzUnverifiedPayloadPath, hFile); | ||
1394 | ExitOnFailure(hr, "Failed to verify payload signature: %ls", wzCachedPath); | ||
1395 | } | ||
1396 | else if (pPayload->pCatalog) // If catalog files are specified, attempt to verify the file with a catalog file | ||
1397 | { | ||
1398 | hr = VerifyPayloadWithCatalog(pPayload, wzUnverifiedPayloadPath, hFile); | ||
1399 | ExitOnFailure(hr, "Failed to verify payload signature: %ls", wzCachedPath); | ||
1400 | } | ||
1401 | else if (pPayload->pbHash) // the payload should have a hash we can use to verify it. | ||
1402 | { | 1332 | { |
1403 | hr = VerifyHash(pPayload->pbHash, pPayload->cbHash, wzUnverifiedPayloadPath, hFile); | 1333 | hr = VerifyHash(pPayload->pbHash, pPayload->cbHash, wzUnverifiedPayloadPath, hFile); |
1404 | ExitOnFailure(hr, "Failed to verify payload hash: %ls", wzCachedPath); | 1334 | ExitOnFailure(hr, "Failed to verify payload hash: %ls", wzCachedPath); |
@@ -1466,18 +1396,7 @@ static HRESULT VerifyFileAgainstPayload( | |||
1466 | ExitOnRootFailure(hr, "Failed to open payload at path: %ls", wzVerifyPath); | 1396 | ExitOnRootFailure(hr, "Failed to open payload at path: %ls", wzVerifyPath); |
1467 | } | 1397 | } |
1468 | 1398 | ||
1469 | // If the payload has a certificate root public key identifier provided, verify the certificate. | 1399 | if (pPayload->pbHash) // the payload should have a hash we can use to verify it. |
1470 | if (pPayload->pbCertificateRootPublicKeyIdentifier) | ||
1471 | { | ||
1472 | hr = CacheVerifyPayloadSignature(pPayload, wzVerifyPath, hFile); | ||
1473 | ExitOnFailure(hr, "Failed to verify signature of payload: %ls", pPayload->sczKey); | ||
1474 | } | ||
1475 | else if (pPayload->pCatalog) // If catalog files are specified, attempt to verify the file with a catalog file | ||
1476 | { | ||
1477 | hr = VerifyPayloadWithCatalog(pPayload, wzVerifyPath, hFile); | ||
1478 | ExitOnFailure(hr, "Failed to verify catalog signature of payload: %ls", pPayload->sczKey); | ||
1479 | } | ||
1480 | else if (pPayload->pbHash) // the payload should have a hash we can use to verify it. | ||
1481 | { | 1400 | { |
1482 | hr = VerifyHash(pPayload->pbHash, pPayload->cbHash, wzVerifyPath, hFile); | 1401 | hr = VerifyHash(pPayload->pbHash, pPayload->cbHash, wzVerifyPath, hFile); |
1483 | ExitOnFailure(hr, "Failed to verify hash of payload: %ls", pPayload->sczKey); | 1402 | ExitOnFailure(hr, "Failed to verify hash of payload: %ls", pPayload->sczKey); |
@@ -1517,7 +1436,7 @@ LExit: | |||
1517 | 1436 | ||
1518 | static HRESULT ResetPathPermissions( | 1437 | static HRESULT ResetPathPermissions( |
1519 | __in BOOL fPerMachine, | 1438 | __in BOOL fPerMachine, |
1520 | __in LPCWSTR wzPath | 1439 | __in_z LPCWSTR wzPath |
1521 | ) | 1440 | ) |
1522 | { | 1441 | { |
1523 | HRESULT hr = S_OK; | 1442 | HRESULT hr = S_OK; |
@@ -1863,164 +1782,3 @@ LExit: | |||
1863 | 1782 | ||
1864 | return hr; | 1783 | return hr; |
1865 | } | 1784 | } |
1866 | |||
1867 | static HRESULT VerifyPayloadWithCatalog( | ||
1868 | __in BURN_PAYLOAD* pPayload, | ||
1869 | __in_z LPCWSTR wzUnverifiedPayloadPath, | ||
1870 | __in HANDLE hFile | ||
1871 | ) | ||
1872 | { | ||
1873 | HRESULT hr = S_FALSE; | ||
1874 | DWORD er = ERROR_SUCCESS; | ||
1875 | WINTRUST_DATA WinTrustData = { }; | ||
1876 | WINTRUST_CATALOG_INFO WinTrustCatalogInfo = { }; | ||
1877 | GUID gSubSystemDriver = WINTRUST_ACTION_GENERIC_VERIFY_V2; | ||
1878 | LPWSTR sczLowerCaseFile = NULL; | ||
1879 | LPWSTR pCurrent = NULL; | ||
1880 | LPWSTR sczName = NULL; | ||
1881 | DWORD dwHashSize = 0; | ||
1882 | DWORD dwTagSize; | ||
1883 | LPBYTE pbHash = NULL; | ||
1884 | |||
1885 | // Get lower case file name. Older operating systems need a lower case file | ||
1886 | // to match in the catalog | ||
1887 | hr = StrAllocString(&sczLowerCaseFile, wzUnverifiedPayloadPath, 0); | ||
1888 | ExitOnFailure(hr, "Failed to allocate memory"); | ||
1889 | |||
1890 | // Go through each character doing the lower case of each letter | ||
1891 | pCurrent = sczLowerCaseFile; | ||
1892 | while ('\0' != *pCurrent) | ||
1893 | { | ||
1894 | *pCurrent = (WCHAR)_tolower(*pCurrent); | ||
1895 | pCurrent++; | ||
1896 | } | ||
1897 | |||
1898 | // Get file hash | ||
1899 | CryptCATAdminCalcHashFromFileHandle(hFile, &dwHashSize, pbHash, 0); | ||
1900 | er = ::GetLastError(); | ||
1901 | if (ERROR_INSUFFICIENT_BUFFER == er) | ||
1902 | { | ||
1903 | pbHash = (LPBYTE)MemAlloc(dwHashSize, TRUE); | ||
1904 | if (!CryptCATAdminCalcHashFromFileHandle(hFile, &dwHashSize, pbHash, 0)) | ||
1905 | { | ||
1906 | ExitWithLastError(hr, "Failed to get file hash."); | ||
1907 | } | ||
1908 | } | ||
1909 | else | ||
1910 | { | ||
1911 | ExitOnWin32Error(er, hr, "Failed to get file hash."); | ||
1912 | } | ||
1913 | |||
1914 | // Make the hash into a string. This is the member tag for the catalog | ||
1915 | dwTagSize = (dwHashSize * 2) + 1; | ||
1916 | hr = StrAlloc(&sczName, dwTagSize); | ||
1917 | ExitOnFailure(hr, "Failed to allocate string."); | ||
1918 | hr = StrHexEncode(pbHash, dwHashSize, sczName, dwTagSize); | ||
1919 | ExitOnFailure(hr, "Failed to encode file hash."); | ||
1920 | |||
1921 | // Set up the WinVerifyTrust structures assuming online. | ||
1922 | WinTrustData.cbStruct = sizeof(WINTRUST_DATA); | ||
1923 | WinTrustData.dwUIChoice = WTD_UI_NONE; | ||
1924 | WinTrustData.dwUnionChoice = WTD_CHOICE_CATALOG; | ||
1925 | WinTrustData.dwStateAction = WTD_STATEACTION_VERIFY; | ||
1926 | WinTrustData.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT; | ||
1927 | WinTrustData.pCatalog = &WinTrustCatalogInfo; | ||
1928 | |||
1929 | WinTrustCatalogInfo.cbStruct = sizeof(WINTRUST_CATALOG_INFO); | ||
1930 | WinTrustCatalogInfo.pbCalculatedFileHash = pbHash; | ||
1931 | WinTrustCatalogInfo.cbCalculatedFileHash = dwHashSize; | ||
1932 | WinTrustCatalogInfo.hMemberFile = hFile; | ||
1933 | WinTrustCatalogInfo.pcwszMemberTag = sczName; | ||
1934 | WinTrustCatalogInfo.pcwszMemberFilePath = sczLowerCaseFile; | ||
1935 | WinTrustCatalogInfo.pcwszCatalogFilePath = pPayload->pCatalog->sczLocalFilePath; | ||
1936 | |||
1937 | hr = ::WinVerifyTrust(static_cast<HWND>(INVALID_HANDLE_VALUE), &gSubSystemDriver, &WinTrustData); | ||
1938 | if (hr) | ||
1939 | { | ||
1940 | // Set up the WinVerifyTrust structures assuming online. | ||
1941 | WinTrustData.dwProvFlags |= WTD_CACHE_ONLY_URL_RETRIEVAL; | ||
1942 | |||
1943 | er = ::WinVerifyTrust(static_cast<HWND>(INVALID_HANDLE_VALUE), &gSubSystemDriver, &WinTrustData); | ||
1944 | |||
1945 | // WinVerifyTrust returns 0 for success, a few different Win32 error codes if it can't | ||
1946 | // find the provider, and any other error code is provider specific, so may not | ||
1947 | // be an actual Win32 error code | ||
1948 | ExitOnWin32Error(er, hr, "Could not verify file %ls.", wzUnverifiedPayloadPath); | ||
1949 | } | ||
1950 | |||
1951 | // Need to close the WinVerifyTrust action | ||
1952 | WinTrustData.dwStateAction = WTD_STATEACTION_CLOSE; | ||
1953 | er = ::WinVerifyTrust(static_cast<HWND>(INVALID_HANDLE_VALUE), &gSubSystemDriver, &WinTrustData); | ||
1954 | ExitOnWin32Error(er, hr, "Could not close verify handle."); | ||
1955 | |||
1956 | LExit: | ||
1957 | ReleaseStr(sczLowerCaseFile); | ||
1958 | ReleaseStr(sczName); | ||
1959 | ReleaseMem(pbHash); | ||
1960 | |||
1961 | return hr; | ||
1962 | } | ||
1963 | |||
1964 | static HRESULT VerifyPayloadAgainstChain( | ||
1965 | __in BURN_PAYLOAD* pPayload, | ||
1966 | __in PCCERT_CHAIN_CONTEXT pChainContext | ||
1967 | ) | ||
1968 | { | ||
1969 | HRESULT hr = S_OK; | ||
1970 | PCCERT_CONTEXT pChainElementCertContext = NULL; | ||
1971 | |||
1972 | BYTE rgbPublicKeyIdentifier[SHA1_HASH_LEN] = { }; | ||
1973 | DWORD cbPublicKeyIdentifier = sizeof(rgbPublicKeyIdentifier); | ||
1974 | BYTE* pbThumbprint = NULL; | ||
1975 | DWORD cbThumbprint = 0; | ||
1976 | |||
1977 | // Walk up the chain looking for a certificate in the chain that matches our expected public key identifier | ||
1978 | // and thumbprint (if a thumbprint was provided). | ||
1979 | HRESULT hrChainVerification = E_NOTFOUND; // assume we won't find a match. | ||
1980 | for (DWORD i = 0; i < pChainContext->rgpChain[0]->cElement; ++i) | ||
1981 | { | ||
1982 | pChainElementCertContext = pChainContext->rgpChain[0]->rgpElement[i]->pCertContext; | ||
1983 | |||
1984 | // Get the certificate's public key identifier. | ||
1985 | if (!::CryptHashPublicKeyInfo(NULL, CALG_SHA1, 0, X509_ASN_ENCODING, &pChainElementCertContext->pCertInfo->SubjectPublicKeyInfo, rgbPublicKeyIdentifier, &cbPublicKeyIdentifier)) | ||
1986 | { | ||
1987 | ExitWithLastError(hr, "Failed to get certificate public key identifier."); | ||
1988 | } | ||
1989 | |||
1990 | // Compare the certificate's public key identifier with the payload's public key identifier. If they | ||
1991 | // match, we're one step closer to the a positive result. | ||
1992 | if (pPayload->cbCertificateRootPublicKeyIdentifier == cbPublicKeyIdentifier && | ||
1993 | 0 == memcmp(pPayload->pbCertificateRootPublicKeyIdentifier, rgbPublicKeyIdentifier, cbPublicKeyIdentifier)) | ||
1994 | { | ||
1995 | // If the payload specified a thumbprint for the certificate, verify it. | ||
1996 | if (pPayload->pbCertificateRootThumbprint) | ||
1997 | { | ||
1998 | hr = CertReadProperty(pChainElementCertContext, CERT_SHA1_HASH_PROP_ID, &pbThumbprint, &cbThumbprint); | ||
1999 | ExitOnFailure(hr, "Failed to read certificate thumbprint."); | ||
2000 | |||
2001 | if (pPayload->cbCertificateRootThumbprint == cbThumbprint && | ||
2002 | 0 == memcmp(pPayload->pbCertificateRootThumbprint, pbThumbprint, cbThumbprint)) | ||
2003 | { | ||
2004 | // If we got here, we found that our payload public key identifier and thumbprint | ||
2005 | // matched an element in the certficate chain. | ||
2006 | hrChainVerification = S_OK; | ||
2007 | break; | ||
2008 | } | ||
2009 | |||
2010 | ReleaseNullMem(pbThumbprint); | ||
2011 | } | ||
2012 | else // no thumbprint match necessary so we're good to go. | ||
2013 | { | ||
2014 | hrChainVerification = S_OK; | ||
2015 | break; | ||
2016 | } | ||
2017 | } | ||
2018 | } | ||
2019 | hr = hrChainVerification; | ||
2020 | ExitOnFailure(hr, "Failed to find expected public key in certificate chain."); | ||
2021 | |||
2022 | LExit: | ||
2023 | ReleaseMem(pbThumbprint); | ||
2024 | |||
2025 | return hr; | ||
2026 | } | ||
diff --git a/src/engine/cache.h b/src/engine/cache.h index 95e6cb90..f8ad2a90 100644 --- a/src/engine/cache.h +++ b/src/engine/cache.h | |||
@@ -16,7 +16,7 @@ HRESULT CacheInitialize( | |||
16 | __in_z_opt LPCWSTR wzSourceProcessPath | 16 | __in_z_opt LPCWSTR wzSourceProcessPath |
17 | ); | 17 | ); |
18 | HRESULT CacheEnsureWorkingFolder( | 18 | HRESULT CacheEnsureWorkingFolder( |
19 | __in LPCWSTR wzBundleId, | 19 | __in_z LPCWSTR wzBundleId, |
20 | __deref_out_z_opt LPWSTR* psczWorkingFolder | 20 | __deref_out_z_opt LPWSTR* psczWorkingFolder |
21 | ); | 21 | ); |
22 | HRESULT CacheCalculateBundleWorkingPath( | 22 | HRESULT CacheCalculateBundleWorkingPath( |
@@ -134,11 +134,6 @@ HRESULT CacheRemovePackage( | |||
134 | __in_z LPCWSTR wzPackageId, | 134 | __in_z LPCWSTR wzPackageId, |
135 | __in_z LPCWSTR wzCacheId | 135 | __in_z LPCWSTR wzCacheId |
136 | ); | 136 | ); |
137 | HRESULT CacheVerifyPayloadSignature( | ||
138 | __in BURN_PAYLOAD* pPayload, | ||
139 | __in_z LPCWSTR wzUnverifiedPayloadPath, | ||
140 | __in HANDLE hFile | ||
141 | ); | ||
142 | void CacheCleanup( | 137 | void CacheCleanup( |
143 | __in BOOL fPerMachine, | 138 | __in BOOL fPerMachine, |
144 | __in_z LPCWSTR wzBundleId | 139 | __in_z LPCWSTR wzBundleId |
diff --git a/src/engine/catalog.cpp b/src/engine/catalog.cpp deleted file mode 100644 index da086545..00000000 --- a/src/engine/catalog.cpp +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | // 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 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | |||
6 | // function definitions | ||
7 | |||
8 | extern "C" HRESULT CatalogsParseFromXml( | ||
9 | __in BURN_CATALOGS* pCatalogs, | ||
10 | __in IXMLDOMNode* pixnBundle | ||
11 | ) | ||
12 | { | ||
13 | HRESULT hr = S_OK; | ||
14 | IXMLDOMNodeList* pixnNodes = NULL; | ||
15 | IXMLDOMNode* pixnNode = NULL; | ||
16 | DWORD cNodes = 0; | ||
17 | LPWSTR scz = NULL; | ||
18 | |||
19 | // select catalog nodes | ||
20 | hr = XmlSelectNodes(pixnBundle, L"Catalog", &pixnNodes); | ||
21 | ExitOnFailure(hr, "Failed to select catalog nodes."); | ||
22 | |||
23 | // get catalog node count | ||
24 | hr = pixnNodes->get_length((long*)&cNodes); | ||
25 | ExitOnFailure(hr, "Failed to get payload node count."); | ||
26 | if (!cNodes) | ||
27 | { | ||
28 | ExitFunction(); | ||
29 | } | ||
30 | |||
31 | // allocate memory for catalogs | ||
32 | pCatalogs->rgCatalogs = (BURN_CATALOG*)MemAlloc(sizeof(BURN_CATALOG) * cNodes, TRUE); | ||
33 | ExitOnNull(pCatalogs->rgCatalogs, hr, E_OUTOFMEMORY, "Failed to allocate memory for payload structs."); | ||
34 | |||
35 | pCatalogs->cCatalogs = cNodes; | ||
36 | |||
37 | // parse catalog elements | ||
38 | for (DWORD i = 0; i < cNodes; ++i) | ||
39 | { | ||
40 | BURN_CATALOG* pCatalog = &pCatalogs->rgCatalogs[i]; | ||
41 | pCatalog->hFile = INVALID_HANDLE_VALUE; | ||
42 | |||
43 | hr = XmlNextElement(pixnNodes, &pixnNode, NULL); | ||
44 | ExitOnFailure(hr, "Failed to get next node."); | ||
45 | |||
46 | // @Id | ||
47 | hr = XmlGetAttributeEx(pixnNode, L"Id", &pCatalog->sczKey); | ||
48 | ExitOnFailure(hr, "Failed to get @Id."); | ||
49 | |||
50 | // @Payload | ||
51 | hr = XmlGetAttributeEx(pixnNode, L"Payload", &pCatalog->sczPayload); | ||
52 | ExitOnFailure(hr, "Failed to get @Payload."); | ||
53 | |||
54 | // prepare next iteration | ||
55 | ReleaseNullObject(pixnNode); | ||
56 | } | ||
57 | |||
58 | LExit: | ||
59 | ReleaseObject(pixnNodes); | ||
60 | ReleaseObject(pixnNode); | ||
61 | ReleaseStr(scz); | ||
62 | |||
63 | return hr; | ||
64 | } | ||
65 | |||
66 | extern "C" HRESULT CatalogFindById( | ||
67 | __in BURN_CATALOGS* pCatalogs, | ||
68 | __in_z LPCWSTR wzId, | ||
69 | __out BURN_CATALOG** ppCatalog | ||
70 | ) | ||
71 | { | ||
72 | HRESULT hr = S_OK; | ||
73 | BURN_CATALOG* pCatalog = NULL; | ||
74 | |||
75 | for (DWORD i = 0; i < pCatalogs->cCatalogs; ++i) | ||
76 | { | ||
77 | pCatalog = &pCatalogs->rgCatalogs[i]; | ||
78 | |||
79 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pCatalog->sczKey, -1, wzId, -1)) | ||
80 | { | ||
81 | *ppCatalog = pCatalog; | ||
82 | ExitFunction1(hr = S_OK); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | hr = E_NOTFOUND; | ||
87 | |||
88 | LExit: | ||
89 | return hr; | ||
90 | } | ||
91 | |||
92 | extern "C" HRESULT CatalogLoadFromPayload( | ||
93 | __in BURN_CATALOGS* pCatalogs, | ||
94 | __in BURN_PAYLOADS* pPayloads | ||
95 | ) | ||
96 | { | ||
97 | HRESULT hr = S_OK; | ||
98 | BURN_CATALOG* pCatalog = NULL; | ||
99 | BURN_PAYLOAD* pPayload = NULL; | ||
100 | |||
101 | // go through each catalog file | ||
102 | for (DWORD i = 0; i < pCatalogs->cCatalogs; i++) | ||
103 | { | ||
104 | pCatalog = &pCatalogs->rgCatalogs[i]; | ||
105 | |||
106 | // get the payload for this catalog file | ||
107 | hr = PayloadFindById(pPayloads, pCatalog->sczPayload, &pPayload); | ||
108 | ExitOnFailure(hr, "Failed to find payload for catalog file."); | ||
109 | |||
110 | // Get the local file name | ||
111 | hr = StrAllocString(&pCatalog->sczLocalFilePath, pPayload->sczLocalFilePath, 0); | ||
112 | ExitOnFailure(hr, "Failed to get catalog local file path"); | ||
113 | |||
114 | // Get a handle to the file | ||
115 | pCatalog->hFile = ::CreateFileW(pCatalog->sczLocalFilePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); | ||
116 | if (INVALID_HANDLE_VALUE == pCatalog->hFile) | ||
117 | { | ||
118 | ExitWithLastError(hr, "Failed to open catalog in working path: %ls", pCatalog->sczLocalFilePath); | ||
119 | } | ||
120 | |||
121 | // Verify the catalog file | ||
122 | hr = CacheVerifyPayloadSignature(pPayload, pCatalog->sczLocalFilePath, pCatalog->hFile); | ||
123 | ExitOnFailure(hr, "Failed to verify catalog signature: %ls", pCatalog->sczLocalFilePath); | ||
124 | } | ||
125 | |||
126 | LExit: | ||
127 | return hr; | ||
128 | } | ||
129 | |||
130 | extern "C" HRESULT CatalogElevatedUpdateCatalogFile( | ||
131 | __in BURN_CATALOGS* pCatalogs, | ||
132 | __in_z LPCWSTR wzId, | ||
133 | __in_z LPCWSTR wzPath | ||
134 | ) | ||
135 | { | ||
136 | HRESULT hr = S_OK; | ||
137 | BURN_CATALOG* pCatalog = NULL; | ||
138 | |||
139 | // Find the catalog | ||
140 | hr = CatalogFindById(pCatalogs, wzId, &pCatalog); | ||
141 | ExitOnFailure(hr, "Failed to locate catalog information."); | ||
142 | |||
143 | if (NULL == pCatalog->sczLocalFilePath) | ||
144 | { | ||
145 | hr = StrAllocString(&pCatalog->sczLocalFilePath, wzPath, 0); | ||
146 | ExitOnFailure(hr, "Failed to allocated catalog path."); | ||
147 | |||
148 | // Get a handle to the file | ||
149 | pCatalog->hFile = ::CreateFileW(pCatalog->sczLocalFilePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); | ||
150 | if (INVALID_HANDLE_VALUE == pCatalog->hFile) | ||
151 | { | ||
152 | ExitWithLastError(hr, "Failed to open catalog in working path: %ls", pCatalog->sczLocalFilePath); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | LExit: | ||
157 | return hr; | ||
158 | } | ||
159 | |||
160 | extern "C" void CatalogUninitialize( | ||
161 | __in BURN_CATALOGS* pCatalogs | ||
162 | ) | ||
163 | { | ||
164 | if (pCatalogs->rgCatalogs) | ||
165 | { | ||
166 | for (DWORD i = 0; i < pCatalogs->cCatalogs; ++i) | ||
167 | { | ||
168 | BURN_CATALOG* pCatalog = &pCatalogs->rgCatalogs[i]; | ||
169 | |||
170 | ReleaseHandle(pCatalog->hFile); | ||
171 | ReleaseStr(pCatalog->sczKey); | ||
172 | ReleaseStr(pCatalog->sczLocalFilePath); | ||
173 | ReleaseStr(pCatalog->sczPayload); | ||
174 | } | ||
175 | MemFree(pCatalogs->rgCatalogs); | ||
176 | } | ||
177 | |||
178 | // clear struct | ||
179 | memset(pCatalogs, 0, sizeof(BURN_CATALOGS)); | ||
180 | } | ||
diff --git a/src/engine/catalog.h b/src/engine/catalog.h deleted file mode 100644 index 3a87d0d2..00000000 --- a/src/engine/catalog.h +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | #pragma once | ||
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 | |||
4 | |||
5 | #if defined(__cplusplus) | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | // structs | ||
10 | |||
11 | typedef struct _BURN_CATALOG | ||
12 | { | ||
13 | LPWSTR sczKey; | ||
14 | LPWSTR sczPayload; | ||
15 | |||
16 | // mutable members | ||
17 | LPWSTR sczLocalFilePath; // location of extracted or downloaded copy | ||
18 | HANDLE hFile; | ||
19 | } BURN_CATALOG; | ||
20 | |||
21 | typedef struct _BURN_CATALOGS | ||
22 | { | ||
23 | BURN_CATALOG* rgCatalogs; | ||
24 | DWORD cCatalogs; | ||
25 | } BURN_CATALOGS; | ||
26 | |||
27 | typedef struct _BURN_PAYLOADS BURN_PAYLOADS; | ||
28 | |||
29 | |||
30 | // functions | ||
31 | |||
32 | HRESULT CatalogsParseFromXml( | ||
33 | __in BURN_CATALOGS* pCatalogs, | ||
34 | __in IXMLDOMNode* pixnBundle | ||
35 | ); | ||
36 | HRESULT CatalogFindById( | ||
37 | __in BURN_CATALOGS* pCatalogs, | ||
38 | __in_z LPCWSTR wzId, | ||
39 | __out BURN_CATALOG** ppCatalog | ||
40 | ); | ||
41 | HRESULT CatalogLoadFromPayload( | ||
42 | __in BURN_CATALOGS* pCatalogs, | ||
43 | __in BURN_PAYLOADS* pPayloads | ||
44 | ); | ||
45 | HRESULT CatalogElevatedUpdateCatalogFile( | ||
46 | __in BURN_CATALOGS* pCatalogs, | ||
47 | __in_z LPCWSTR wzId, | ||
48 | __in_z LPCWSTR wzPath | ||
49 | ); | ||
50 | void CatalogUninitialize( | ||
51 | __in BURN_CATALOGS* pCatalogs | ||
52 | ); | ||
53 | |||
54 | #if defined(__cplusplus) | ||
55 | } | ||
56 | #endif | ||
diff --git a/src/engine/core.cpp b/src/engine/core.cpp index 5b2454dc..0f5ea08a 100644 --- a/src/engine/core.cpp +++ b/src/engine/core.cpp | |||
@@ -151,10 +151,6 @@ extern "C" HRESULT CoreInitialize( | |||
151 | hr = PayloadExtractFromContainer(&pEngineState->userExperience.payloads, NULL, &containerContext, pEngineState->userExperience.sczTempDirectory); | 151 | hr = PayloadExtractFromContainer(&pEngineState->userExperience.payloads, NULL, &containerContext, pEngineState->userExperience.sczTempDirectory); |
152 | ExitOnFailure(hr, "Failed to extract bootstrapper application payloads."); | 152 | ExitOnFailure(hr, "Failed to extract bootstrapper application payloads."); |
153 | 153 | ||
154 | // Load the catalog files as soon as they are extracted. | ||
155 | hr = CatalogLoadFromPayload(&pEngineState->catalogs, &pEngineState->userExperience.payloads); | ||
156 | ExitOnFailure(hr, "Failed to load catalog files."); | ||
157 | |||
158 | hr = PathConcat(pEngineState->userExperience.sczTempDirectory, L"BootstrapperApplicationData.xml", &pEngineState->command.wzBootstrapperApplicationDataPath); | 154 | hr = PathConcat(pEngineState->userExperience.sczTempDirectory, L"BootstrapperApplicationData.xml", &pEngineState->command.wzBootstrapperApplicationDataPath); |
159 | ExitOnFailure(hr, "Failed to get BootstrapperApplicationDataPath."); | 155 | ExitOnFailure(hr, "Failed to get BootstrapperApplicationDataPath."); |
160 | 156 | ||
diff --git a/src/engine/core.h b/src/engine/core.h index 544c1786..0161eaa0 100644 --- a/src/engine/core.h +++ b/src/engine/core.h | |||
@@ -98,7 +98,6 @@ typedef struct _BURN_ENGINE_STATE | |||
98 | BURN_USER_EXPERIENCE userExperience; | 98 | BURN_USER_EXPERIENCE userExperience; |
99 | BURN_REGISTRATION registration; | 99 | BURN_REGISTRATION registration; |
100 | BURN_CONTAINERS containers; | 100 | BURN_CONTAINERS containers; |
101 | BURN_CATALOGS catalogs; | ||
102 | BURN_PAYLOADS payloads; | 101 | BURN_PAYLOADS payloads; |
103 | BURN_PACKAGES packages; | 102 | BURN_PACKAGES packages; |
104 | BURN_UPDATE update; | 103 | BURN_UPDATE update; |
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 3dbfb365..9eee7fde 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp | |||
@@ -400,7 +400,6 @@ static void UninitializeEngineState( | |||
400 | RegistrationUninitialize(&pEngineState->registration); | 400 | RegistrationUninitialize(&pEngineState->registration); |
401 | PayloadsUninitialize(&pEngineState->payloads); | 401 | PayloadsUninitialize(&pEngineState->payloads); |
402 | PackagesUninitialize(&pEngineState->packages); | 402 | PackagesUninitialize(&pEngineState->packages); |
403 | CatalogUninitialize(&pEngineState->catalogs); | ||
404 | SectionUninitialize(&pEngineState->section); | 403 | SectionUninitialize(&pEngineState->section); |
405 | ContainersUninitialize(&pEngineState->containers); | 404 | ContainersUninitialize(&pEngineState->containers); |
406 | 405 | ||
diff --git a/src/engine/engine.vcxproj b/src/engine/engine.vcxproj index 3db6802b..cb179a23 100644 --- a/src/engine/engine.vcxproj +++ b/src/engine/engine.vcxproj | |||
@@ -1,9 +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 | |||
4 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 3 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
5 | <Import Project="..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" /> | 4 | <Import Project="..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" /> |
6 | |||
7 | <ItemGroup Label="ProjectConfigurations"> | 5 | <ItemGroup Label="ProjectConfigurations"> |
8 | <ProjectConfiguration Include="Debug|Win32"> | 6 | <ProjectConfiguration Include="Debug|Win32"> |
9 | <Configuration>Debug</Configuration> | 7 | <Configuration>Debug</Configuration> |
@@ -30,7 +28,6 @@ | |||
30 | <Platform>ARM64</Platform> | 28 | <Platform>ARM64</Platform> |
31 | </ProjectConfiguration> | 29 | </ProjectConfiguration> |
32 | </ItemGroup> | 30 | </ItemGroup> |
33 | |||
34 | <PropertyGroup Label="Globals"> | 31 | <PropertyGroup Label="Globals"> |
35 | <ProjectGuid>{8119537D-E1D9-6591-D51A-49768A2F9C37}</ProjectGuid> | 32 | <ProjectGuid>{8119537D-E1D9-6591-D51A-49768A2F9C37}</ProjectGuid> |
36 | <ConfigurationType>StaticLibrary</ConfigurationType> | 33 | <ConfigurationType>StaticLibrary</ConfigurationType> |
@@ -39,22 +36,17 @@ | |||
39 | <CharacterSet>Unicode</CharacterSet> | 36 | <CharacterSet>Unicode</CharacterSet> |
40 | <Description>Native component of WixToolset.Burn</Description> | 37 | <Description>Native component of WixToolset.Burn</Description> |
41 | </PropertyGroup> | 38 | </PropertyGroup> |
42 | |||
43 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | 39 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
44 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | 40 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
45 | |||
46 | <ImportGroup Label="ExtensionSettings"> | 41 | <ImportGroup Label="ExtensionSettings"> |
47 | </ImportGroup> | 42 | </ImportGroup> |
48 | |||
49 | <ImportGroup Label="Shared"> | 43 | <ImportGroup Label="Shared"> |
50 | </ImportGroup> | 44 | </ImportGroup> |
51 | |||
52 | <ItemGroup> | 45 | <ItemGroup> |
53 | <ClCompile Include="apply.cpp" /> | 46 | <ClCompile Include="apply.cpp" /> |
54 | <ClCompile Include="approvedexe.cpp" /> | 47 | <ClCompile Include="approvedexe.cpp" /> |
55 | <ClCompile Include="bitsengine.cpp" /> | 48 | <ClCompile Include="bitsengine.cpp" /> |
56 | <ClCompile Include="burnextension.cpp" /> | 49 | <ClCompile Include="burnextension.cpp" /> |
57 | <ClCompile Include="catalog.cpp" /> | ||
58 | <ClCompile Include="detect.cpp" /> | 50 | <ClCompile Include="detect.cpp" /> |
59 | <ClCompile Include="embedded.cpp" /> | 51 | <ClCompile Include="embedded.cpp" /> |
60 | <ClCompile Include="EngineForApplication.cpp" /> | 52 | <ClCompile Include="EngineForApplication.cpp" /> |
@@ -95,7 +87,6 @@ | |||
95 | <ClCompile Include="variable.cpp" /> | 87 | <ClCompile Include="variable.cpp" /> |
96 | <ClCompile Include="variant.cpp" /> | 88 | <ClCompile Include="variant.cpp" /> |
97 | </ItemGroup> | 89 | </ItemGroup> |
98 | |||
99 | <ItemGroup> | 90 | <ItemGroup> |
100 | <ClInclude Include="apply.h" /> | 91 | <ClInclude Include="apply.h" /> |
101 | <ClInclude Include="approvedexe.h" /> | 92 | <ClInclude Include="approvedexe.h" /> |
@@ -107,7 +98,6 @@ | |||
107 | <ClInclude Include="burnextension.h" /> | 98 | <ClInclude Include="burnextension.h" /> |
108 | <ClInclude Include="cabextract.h" /> | 99 | <ClInclude Include="cabextract.h" /> |
109 | <ClInclude Include="cache.h" /> | 100 | <ClInclude Include="cache.h" /> |
110 | <ClInclude Include="catalog.h" /> | ||
111 | <ClInclude Include="condition.h" /> | 101 | <ClInclude Include="condition.h" /> |
112 | <ClInclude Include="container.h" /> | 102 | <ClInclude Include="container.h" /> |
113 | <ClInclude Include="core.h" /> | 103 | <ClInclude Include="core.h" /> |
@@ -145,11 +135,9 @@ | |||
145 | <ClInclude Include="variable.h" /> | 135 | <ClInclude Include="variable.h" /> |
146 | <ClInclude Include="variant.h" /> | 136 | <ClInclude Include="variant.h" /> |
147 | </ItemGroup> | 137 | </ItemGroup> |
148 | |||
149 | <ItemGroup> | 138 | <ItemGroup> |
150 | <None Include="packages.config" /> | 139 | <None Include="packages.config" /> |
151 | </ItemGroup> | 140 | </ItemGroup> |
152 | |||
153 | <ItemGroup> | 141 | <ItemGroup> |
154 | <CustomBuild Include="engine.mc"> | 142 | <CustomBuild Include="engine.mc"> |
155 | <Message>Compiling message file...</Message> | 143 | <Message>Compiling message file...</Message> |
@@ -158,10 +146,7 @@ rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command> | |||
158 | <Outputs>$(IntDir)engine.messages.h;$(IntDir)engine.messages.rc;$(OutDir)engine.res</Outputs> | 146 | <Outputs>$(IntDir)engine.messages.h;$(IntDir)engine.messages.rc;$(OutDir)engine.res</Outputs> |
159 | </CustomBuild> | 147 | </CustomBuild> |
160 | </ItemGroup> | 148 | </ItemGroup> |
161 | 149 | <Target Name="SetWixVersion" DependsOnTargets="GetBuildVersion" BeforeTargets="ClCompile"> | |
162 | <Target Name="SetWixVersion" | ||
163 | DependsOnTargets="GetBuildVersion" | ||
164 | BeforeTargets="ClCompile"> | ||
165 | <PropertyGroup> | 150 | <PropertyGroup> |
166 | <rmj>$(MajorMinorVersion.Split(`.`)[0])</rmj> | 151 | <rmj>$(MajorMinorVersion.Split(`.`)[0])</rmj> |
167 | <rmm>$(MajorMinorVersion.Split(`.`)[1])</rmm> | 152 | <rmm>$(MajorMinorVersion.Split(`.`)[1])</rmm> |
@@ -176,7 +161,6 @@ rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command> | |||
176 | </ClCompile> | 161 | </ClCompile> |
177 | </ItemGroup> | 162 | </ItemGroup> |
178 | </Target> | 163 | </Target> |
179 | |||
180 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | 164 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
181 | <Import Project="..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> | 165 | <Import Project="..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> |
182 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | 166 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
diff --git a/src/engine/manifest.cpp b/src/engine/manifest.cpp index fe8c6cad..fa454348 100644 --- a/src/engine/manifest.cpp +++ b/src/engine/manifest.cpp | |||
@@ -132,10 +132,6 @@ static HRESULT ParseFromXml( | |||
132 | hr = SearchesParseFromXml(&pEngineState->searches, &pEngineState->extensions, pixeBundle); | 132 | hr = SearchesParseFromXml(&pEngineState->searches, &pEngineState->extensions, pixeBundle); |
133 | ExitOnFailure(hr, "Failed to parse searches."); | 133 | ExitOnFailure(hr, "Failed to parse searches."); |
134 | 134 | ||
135 | // parse catalog files | ||
136 | hr = CatalogsParseFromXml(&pEngineState->catalogs, pixeBundle); | ||
137 | ExitOnFailure(hr, "Failed to parse catalog files."); | ||
138 | |||
139 | // parse registration | 135 | // parse registration |
140 | hr = RegistrationParseFromXml(&pEngineState->registration, pixeBundle); | 136 | hr = RegistrationParseFromXml(&pEngineState->registration, pixeBundle); |
141 | ExitOnFailure(hr, "Failed to parse registration."); | 137 | ExitOnFailure(hr, "Failed to parse registration."); |
@@ -149,7 +145,7 @@ static HRESULT ParseFromXml( | |||
149 | ExitOnFailure(hr, "Failed to parse containers."); | 145 | ExitOnFailure(hr, "Failed to parse containers."); |
150 | 146 | ||
151 | // parse payloads | 147 | // parse payloads |
152 | hr = PayloadsParseFromXml(&pEngineState->payloads, &pEngineState->containers, &pEngineState->catalogs, pixeBundle); | 148 | hr = PayloadsParseFromXml(&pEngineState->payloads, &pEngineState->containers, pixeBundle); |
153 | ExitOnFailure(hr, "Failed to parse payloads."); | 149 | ExitOnFailure(hr, "Failed to parse payloads."); |
154 | 150 | ||
155 | // parse packages | 151 | // parse packages |
diff --git a/src/engine/payload.cpp b/src/engine/payload.cpp index 6833288f..67eebe10 100644 --- a/src/engine/payload.cpp +++ b/src/engine/payload.cpp | |||
@@ -18,7 +18,6 @@ static HRESULT FindEmbeddedBySourcePath( | |||
18 | extern "C" HRESULT PayloadsParseFromXml( | 18 | extern "C" HRESULT PayloadsParseFromXml( |
19 | __in BURN_PAYLOADS* pPayloads, | 19 | __in BURN_PAYLOADS* pPayloads, |
20 | __in_opt BURN_CONTAINERS* pContainers, | 20 | __in_opt BURN_CONTAINERS* pContainers, |
21 | __in_opt BURN_CATALOGS* pCatalogs, | ||
22 | __in IXMLDOMNode* pixnBundle | 21 | __in IXMLDOMNode* pixnBundle |
23 | ) | 22 | ) |
24 | { | 23 | { |
@@ -130,26 +129,6 @@ extern "C" HRESULT PayloadsParseFromXml( | |||
130 | ExitOnFailure(hr, "Failed to parse @FileSize."); | 129 | ExitOnFailure(hr, "Failed to parse @FileSize."); |
131 | } | 130 | } |
132 | 131 | ||
133 | // @CertificateAuthorityKeyIdentifier | ||
134 | hr = XmlGetAttributeEx(pixnNode, L"CertificateRootPublicKeyIdentifier", &scz); | ||
135 | if (E_NOTFOUND != hr) | ||
136 | { | ||
137 | ExitOnFailure(hr, "Failed to get @CertificateRootPublicKeyIdentifier."); | ||
138 | |||
139 | hr = StrAllocHexDecode(scz, &pPayload->pbCertificateRootPublicKeyIdentifier, &pPayload->cbCertificateRootPublicKeyIdentifier); | ||
140 | ExitOnFailure(hr, "Failed to hex decode @CertificateRootPublicKeyIdentifier."); | ||
141 | } | ||
142 | |||
143 | // @CertificateThumbprint | ||
144 | hr = XmlGetAttributeEx(pixnNode, L"CertificateRootThumbprint", &scz); | ||
145 | if (E_NOTFOUND != hr) | ||
146 | { | ||
147 | ExitOnFailure(hr, "Failed to get @CertificateRootThumbprint."); | ||
148 | |||
149 | hr = StrAllocHexDecode(scz, &pPayload->pbCertificateRootThumbprint, &pPayload->cbCertificateRootThumbprint); | ||
150 | ExitOnFailure(hr, "Failed to hex decode @CertificateRootThumbprint."); | ||
151 | } | ||
152 | |||
153 | // @Hash | 132 | // @Hash |
154 | hr = XmlGetAttributeEx(pixnNode, L"Hash", &scz); | 133 | hr = XmlGetAttributeEx(pixnNode, L"Hash", &scz); |
155 | ExitOnFailure(hr, "Failed to get @Hash."); | 134 | ExitOnFailure(hr, "Failed to get @Hash."); |
@@ -157,16 +136,6 @@ extern "C" HRESULT PayloadsParseFromXml( | |||
157 | hr = StrAllocHexDecode(scz, &pPayload->pbHash, &pPayload->cbHash); | 136 | hr = StrAllocHexDecode(scz, &pPayload->pbHash, &pPayload->cbHash); |
158 | ExitOnFailure(hr, "Failed to hex decode the Payload/@Hash."); | 137 | ExitOnFailure(hr, "Failed to hex decode the Payload/@Hash."); |
159 | 138 | ||
160 | // @Catalog | ||
161 | hr = XmlGetAttributeEx(pixnNode, L"Catalog", &scz); | ||
162 | if (E_NOTFOUND != hr) | ||
163 | { | ||
164 | ExitOnFailure(hr, "Failed to get @Catalog."); | ||
165 | |||
166 | hr = CatalogFindById(pCatalogs, scz, &pPayload->pCatalog); | ||
167 | ExitOnFailure(hr, "Failed to find catalog."); | ||
168 | } | ||
169 | |||
170 | // prepare next iteration | 139 | // prepare next iteration |
171 | ReleaseNullObject(pixnNode); | 140 | ReleaseNullObject(pixnNode); |
172 | } | 141 | } |
@@ -194,8 +163,6 @@ extern "C" void PayloadsUninitialize( | |||
194 | ReleaseStr(pPayload->sczKey); | 163 | ReleaseStr(pPayload->sczKey); |
195 | ReleaseStr(pPayload->sczFilePath); | 164 | ReleaseStr(pPayload->sczFilePath); |
196 | ReleaseMem(pPayload->pbHash); | 165 | ReleaseMem(pPayload->pbHash); |
197 | ReleaseMem(pPayload->pbCertificateRootThumbprint); | ||
198 | ReleaseMem(pPayload->pbCertificateRootPublicKeyIdentifier); | ||
199 | ReleaseStr(pPayload->sczSourcePath); | 166 | ReleaseStr(pPayload->sczSourcePath); |
200 | ReleaseStr(pPayload->sczLocalFilePath); | 167 | ReleaseStr(pPayload->sczLocalFilePath); |
201 | ReleaseStr(pPayload->downloadSource.sczUrl); | 168 | ReleaseStr(pPayload->downloadSource.sczUrl); |
diff --git a/src/engine/payload.h b/src/engine/payload.h index 0c7b68e4..e8639d64 100644 --- a/src/engine/payload.h +++ b/src/engine/payload.h | |||
@@ -35,11 +35,6 @@ typedef struct _BURN_PAYLOAD | |||
35 | DWORD64 qwFileSize; | 35 | DWORD64 qwFileSize; |
36 | LPWSTR sczFilePath; // file path relative to the execute location | 36 | LPWSTR sczFilePath; // file path relative to the execute location |
37 | 37 | ||
38 | BURN_CATALOG *pCatalog; // used to verify this payload | ||
39 | BYTE* pbCertificateRootPublicKeyIdentifier; | ||
40 | DWORD cbCertificateRootPublicKeyIdentifier; | ||
41 | BYTE* pbCertificateRootThumbprint; | ||
42 | DWORD cbCertificateRootThumbprint; | ||
43 | BYTE* pbHash; | 38 | BYTE* pbHash; |
44 | DWORD cbHash; | 39 | DWORD cbHash; |
45 | 40 | ||
@@ -64,7 +59,6 @@ typedef struct _BURN_PAYLOADS | |||
64 | HRESULT PayloadsParseFromXml( | 59 | HRESULT PayloadsParseFromXml( |
65 | __in BURN_PAYLOADS* pPayloads, | 60 | __in BURN_PAYLOADS* pPayloads, |
66 | __in_opt BURN_CONTAINERS* pContainers, | 61 | __in_opt BURN_CONTAINERS* pContainers, |
67 | __in_opt BURN_CATALOGS* pCatalogs, | ||
68 | __in IXMLDOMNode* pixnBundle | 62 | __in IXMLDOMNode* pixnBundle |
69 | ); | 63 | ); |
70 | void PayloadsUninitialize( | 64 | void PayloadsUninitialize( |
diff --git a/src/engine/precomp.h b/src/engine/precomp.h index c0019476..53fa949a 100644 --- a/src/engine/precomp.h +++ b/src/engine/precomp.h | |||
@@ -68,7 +68,6 @@ | |||
68 | #include "section.h" | 68 | #include "section.h" |
69 | #include "approvedexe.h" | 69 | #include "approvedexe.h" |
70 | #include "container.h" | 70 | #include "container.h" |
71 | #include "catalog.h" | ||
72 | #include "payload.h" | 71 | #include "payload.h" |
73 | #include "cabextract.h" | 72 | #include "cabextract.h" |
74 | #include "burnextension.h" | 73 | #include "burnextension.h" |
diff --git a/src/engine/userexperience.cpp b/src/engine/userexperience.cpp index ce1662b8..8e782e71 100644 --- a/src/engine/userexperience.cpp +++ b/src/engine/userexperience.cpp | |||
@@ -55,7 +55,7 @@ extern "C" HRESULT UserExperienceParseFromXml( | |||
55 | } | 55 | } |
56 | 56 | ||
57 | // parse payloads | 57 | // parse payloads |
58 | hr = PayloadsParseFromXml(&pUserExperience->payloads, NULL, NULL, pixnUserExperienceNode); | 58 | hr = PayloadsParseFromXml(&pUserExperience->payloads, NULL, pixnUserExperienceNode); |
59 | ExitOnFailure(hr, "Failed to parse user experience payloads."); | 59 | ExitOnFailure(hr, "Failed to parse user experience payloads."); |
60 | 60 | ||
61 | // make sure we have at least one payload | 61 | // make sure we have at least one payload |
diff --git a/src/stub/stub.vcxproj b/src/stub/stub.vcxproj index a8fbdfeb..da19f3c6 100644 --- a/src/stub/stub.vcxproj +++ b/src/stub/stub.vcxproj | |||
@@ -63,14 +63,14 @@ | |||
63 | 63 | ||
64 | <PropertyGroup> | 64 | <PropertyGroup> |
65 | <ProjectAdditionalIncludeDirectories>$(ProjectDir)..\engine\inc</ProjectAdditionalIncludeDirectories> | 65 | <ProjectAdditionalIncludeDirectories>$(ProjectDir)..\engine\inc</ProjectAdditionalIncludeDirectories> |
66 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wintrust.lib;wuguid.lib;engine.lib;engine.res</ProjectAdditionalLinkLibraries> | 66 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wuguid.lib;engine.lib;engine.res</ProjectAdditionalLinkLibraries> |
67 | </PropertyGroup> | 67 | </PropertyGroup> |
68 | 68 | ||
69 | <ItemDefinitionGroup> | 69 | <ItemDefinitionGroup> |
70 | <Link> | 70 | <Link> |
71 | <SwapRunFromCD>true</SwapRunFromCD> | 71 | <SwapRunFromCD>true</SwapRunFromCD> |
72 | <SwapRunFromNET>true</SwapRunFromNET> | 72 | <SwapRunFromNET>true</SwapRunFromNET> |
73 | <DelayLoadDLLs>cabinet.dll;crypt32.dll;msi.dll;shlwapi.dll;version.dll;wininet.dll;wintrust.dll</DelayLoadDLLs> | 73 | <DelayLoadDLLs>cabinet.dll;crypt32.dll;msi.dll;shlwapi.dll;version.dll;wininet.dll</DelayLoadDLLs> |
74 | </Link> | 74 | </Link> |
75 | </ItemDefinitionGroup> | 75 | </ItemDefinitionGroup> |
76 | 76 | ||
diff --git a/src/test/BurnUnitTest/BurnUnitTest.vcxproj b/src/test/BurnUnitTest/BurnUnitTest.vcxproj index 1f4a7111..6ac21f9c 100644 --- a/src/test/BurnUnitTest/BurnUnitTest.vcxproj +++ b/src/test/BurnUnitTest/BurnUnitTest.vcxproj | |||
@@ -36,7 +36,7 @@ | |||
36 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | 36 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
37 | <PropertyGroup> | 37 | <PropertyGroup> |
38 | <ProjectAdditionalIncludeDirectories>..\..\engine;..\..\WixToolset.BootstrapperCore.Native\inc</ProjectAdditionalIncludeDirectories> | 38 | <ProjectAdditionalIncludeDirectories>..\..\engine;..\..\WixToolset.BootstrapperCore.Native\inc</ProjectAdditionalIncludeDirectories> |
39 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wintrust.lib</ProjectAdditionalLinkLibraries> | 39 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib</ProjectAdditionalLinkLibraries> |
40 | </PropertyGroup> | 40 | </PropertyGroup> |
41 | <ItemGroup> | 41 | <ItemGroup> |
42 | <ClCompile Include="AssemblyInfo.cpp" /> | 42 | <ClCompile Include="AssemblyInfo.cpp" /> |
diff --git a/src/test/BurnUnitTest/precomp.h b/src/test/BurnUnitTest/precomp.h index ddbdf9c6..a5db1555 100644 --- a/src/test/BurnUnitTest/precomp.h +++ b/src/test/BurnUnitTest/precomp.h | |||
@@ -43,7 +43,6 @@ | |||
43 | #include "section.h" | 43 | #include "section.h" |
44 | #include "approvedexe.h" | 44 | #include "approvedexe.h" |
45 | #include "container.h" | 45 | #include "container.h" |
46 | #include "catalog.h" | ||
47 | #include "payload.h" | 46 | #include "payload.h" |
48 | #include "cabextract.h" | 47 | #include "cabextract.h" |
49 | #include "burnextension.h" | 48 | #include "burnextension.h" |