diff options
Diffstat (limited to 'src/engine/payload.cpp')
| -rw-r--r-- | src/engine/payload.cpp | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/engine/payload.cpp b/src/engine/payload.cpp index 67eebe10..2be39b23 100644 --- a/src/engine/payload.cpp +++ b/src/engine/payload.cpp | |||
| @@ -18,6 +18,7 @@ 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_PAYLOAD_GROUP* pLayoutPayloads, | ||
| 21 | __in IXMLDOMNode* pixnBundle | 22 | __in IXMLDOMNode* pixnBundle |
| 22 | ) | 23 | ) |
| 23 | { | 24 | { |
| @@ -136,6 +137,17 @@ extern "C" HRESULT PayloadsParseFromXml( | |||
| 136 | hr = StrAllocHexDecode(scz, &pPayload->pbHash, &pPayload->cbHash); | 137 | hr = StrAllocHexDecode(scz, &pPayload->pbHash, &pPayload->cbHash); |
| 137 | ExitOnFailure(hr, "Failed to hex decode the Payload/@Hash."); | 138 | ExitOnFailure(hr, "Failed to hex decode the Payload/@Hash."); |
| 138 | 139 | ||
| 140 | if (pPayload->fLayoutOnly && pLayoutPayloads) | ||
| 141 | { | ||
| 142 | hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pLayoutPayloads->rgpPayloads), pLayoutPayloads->cPayloads + 1, sizeof(BURN_PAYLOAD*), 5); | ||
| 143 | ExitOnNull(pPayloads->rgPayloads, hr, E_OUTOFMEMORY, "Failed to allocate memory for layout payloads."); | ||
| 144 | |||
| 145 | pLayoutPayloads->rgpPayloads[pLayoutPayloads->cPayloads] = pPayload; | ||
| 146 | ++pLayoutPayloads->cPayloads; | ||
| 147 | |||
| 148 | pLayoutPayloads->qwTotalSize += pPayload->qwFileSize; | ||
| 149 | } | ||
| 150 | |||
| 139 | // prepare next iteration | 151 | // prepare next iteration |
| 140 | ReleaseNullObject(pixnNode); | 152 | ReleaseNullObject(pixnNode); |
| 141 | } | 153 | } |
| @@ -150,6 +162,24 @@ LExit: | |||
| 150 | return hr; | 162 | return hr; |
| 151 | } | 163 | } |
| 152 | 164 | ||
| 165 | extern "C" void PayloadUninitialize( | ||
| 166 | __in BURN_PAYLOAD* pPayload | ||
| 167 | ) | ||
| 168 | { | ||
| 169 | if (pPayload) | ||
| 170 | { | ||
| 171 | ReleaseStr(pPayload->sczKey); | ||
| 172 | ReleaseStr(pPayload->sczFilePath); | ||
| 173 | ReleaseMem(pPayload->pbHash); | ||
| 174 | ReleaseStr(pPayload->sczSourcePath); | ||
| 175 | ReleaseStr(pPayload->sczLocalFilePath); | ||
| 176 | ReleaseStr(pPayload->downloadSource.sczUrl); | ||
| 177 | ReleaseStr(pPayload->downloadSource.sczUser); | ||
| 178 | ReleaseStr(pPayload->downloadSource.sczPassword); | ||
| 179 | ReleaseStr(pPayload->sczUnverifiedPath); | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 153 | extern "C" void PayloadsUninitialize( | 183 | extern "C" void PayloadsUninitialize( |
| 154 | __in BURN_PAYLOADS* pPayloads | 184 | __in BURN_PAYLOADS* pPayloads |
| 155 | ) | 185 | ) |
| @@ -158,16 +188,7 @@ extern "C" void PayloadsUninitialize( | |||
| 158 | { | 188 | { |
| 159 | for (DWORD i = 0; i < pPayloads->cPayloads; ++i) | 189 | for (DWORD i = 0; i < pPayloads->cPayloads; ++i) |
| 160 | { | 190 | { |
| 161 | BURN_PAYLOAD* pPayload = &pPayloads->rgPayloads[i]; | 191 | PayloadUninitialize(pPayloads->rgPayloads + i); |
| 162 | |||
| 163 | ReleaseStr(pPayload->sczKey); | ||
| 164 | ReleaseStr(pPayload->sczFilePath); | ||
| 165 | ReleaseMem(pPayload->pbHash); | ||
| 166 | ReleaseStr(pPayload->sczSourcePath); | ||
| 167 | ReleaseStr(pPayload->sczLocalFilePath); | ||
| 168 | ReleaseStr(pPayload->downloadSource.sczUrl); | ||
| 169 | ReleaseStr(pPayload->downloadSource.sczUser); | ||
| 170 | ReleaseStr(pPayload->downloadSource.sczPassword); | ||
| 171 | } | 192 | } |
| 172 | MemFree(pPayloads->rgPayloads); | 193 | MemFree(pPayloads->rgPayloads); |
| 173 | } | 194 | } |
