From 6a45cb7687de57056532fe897a708435deec2ea3 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Fri, 9 Sep 2022 21:21:55 -0400 Subject: Update hashes are now hex strings. Fixes https://github.com/wixtoolset/issues/issues/6901. --- src/burn/engine/pseudobundle.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/burn/engine/pseudobundle.cpp') diff --git a/src/burn/engine/pseudobundle.cpp b/src/burn/engine/pseudobundle.cpp index 082c4487..8b30ebfc 100644 --- a/src/burn/engine/pseudobundle.cpp +++ b/src/burn/engine/pseudobundle.cpp @@ -142,9 +142,8 @@ extern "C" HRESULT PseudoBundleInitializeUpdateBundle( __in_z_opt LPCWSTR wzDownloadSource, __in DWORD64 qwSize, __in_z LPCWSTR wzInstallArguments, - __in_opt const BYTE* pbHash, - __in const DWORD cbHash - ) + __in_opt LPCWSTR wzHash +) { HRESULT hr = S_OK; BURN_PAYLOAD* pPayload = NULL; @@ -176,13 +175,20 @@ extern "C" HRESULT PseudoBundleInitializeUpdateBundle( ExitOnFailure(hr, "Failed to copy download source for pseudo bundle."); } - if (pbHash) + if (wzHash && *wzHash) { + BYTE* rgbHash = NULL; + DWORD cbHash = 0; + + hr = StrAllocHexDecode(wzHash, &rgbHash, &cbHash); + ExitOnFailure(hr, "Failed to decode hash string: %ls.", wzHash); + pPayload->pbHash = static_cast(MemAlloc(cbHash, FALSE)); ExitOnNull(pPayload->pbHash, hr, E_OUTOFMEMORY, "Failed to allocate memory for update bundle payload hash."); pPayload->cbHash = cbHash; - memcpy_s(pPayload->pbHash, pPayload->cbHash, pbHash, cbHash); + + memcpy_s(pPayload->pbHash, pPayload->cbHash, rgbHash, cbHash); } pPackage->type = BURN_PACKAGE_TYPE_EXE; -- cgit v1.2.3-55-g6feb