diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-11-17 14:11:30 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-11-17 19:06:00 -0600 |
| commit | 643293e48d176ff78282670512f45b4cf889b0a5 (patch) | |
| tree | 663433bb793e6dfef5d043cea4ba24b6ee3fb03d /src/engine/externalengine.cpp | |
| parent | 4ca0a5b2a8711cae9e60cb4075799bffef4ce75a (diff) | |
| download | wix-643293e48d176ff78282670512f45b4cf889b0a5.tar.gz wix-643293e48d176ff78282670512f45b4cf889b0a5.tar.bz2 wix-643293e48d176ff78282670512f45b4cf889b0a5.zip | |
Allow E_IMPL from BA/bext and check all cbSizes from BA/bext.
Diffstat (limited to 'src/engine/externalengine.cpp')
| -rw-r--r-- | src/engine/externalengine.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/engine/externalengine.cpp b/src/engine/externalengine.cpp new file mode 100644 index 00000000..ef4f931d --- /dev/null +++ b/src/engine/externalengine.cpp | |||
| @@ -0,0 +1,30 @@ | |||
| 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 | // TODO: callers need to provide the original size (at the time of first public release) of the struct instead of the current size. | ||
| 9 | HRESULT WINAPI ExternalEngineValidateMessageParameter( | ||
| 10 | __in_opt const LPVOID pv, | ||
| 11 | __in SIZE_T cbSizeOffset, | ||
| 12 | __in DWORD dwMinimumSize | ||
| 13 | ) | ||
| 14 | { | ||
| 15 | HRESULT hr = S_OK; | ||
| 16 | |||
| 17 | if (!pv) | ||
| 18 | { | ||
| 19 | ExitFunction1(hr = E_INVALIDARG); | ||
| 20 | } | ||
| 21 | |||
| 22 | DWORD cbSize = *(DWORD*)((BYTE*)pv + cbSizeOffset); | ||
| 23 | if (dwMinimumSize < cbSize) | ||
| 24 | { | ||
| 25 | ExitFunction1(hr = E_INVALIDARG); | ||
| 26 | } | ||
| 27 | |||
| 28 | LExit: | ||
| 29 | return hr; | ||
| 30 | } | ||
