Add CompareVersions engine method.
Sean Hall committed
Oct 18, 2020 at 14:10 UTC
e879388d96157db6a6e7b2ee79871ef7ebbd3015
7 files changed
+70
-2
src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h
+14
@@ -124,6 +124,7 @@ enum BOOTSTRAPPER_ENGINE_MESSAGE
124
BOOTSTRAPPER_ENGINE_MESSAGE_APPLY,
125
BOOTSTRAPPER_ENGINE_MESSAGE_QUIT,
126
BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE,
127
+ BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS,
128
};
129
130
typedef struct _BAENGINE_APPLY_ARGS
@@ -147,6 +148,19 @@ typedef struct _BAENGINE_CLOSESPLASHSCREEN_RESULTS
148
DWORD cbSize;
149
} BAENGINE_CLOSESPLASHSCREEN_RESULTS;
150
151
+typedef struct _BAENGINE_COMPAREVERSIONS_ARGS
152
+{
153
+ DWORD cbSize;
154
+ LPCWSTR wzVersion1;
155
+ LPCWSTR wzVersion2;
156
+} BAENGINE_COMPAREVERSIONS_ARGS;
157
+
158
+typedef struct _BAENGINE_COMPAREVERSIONS_RESULTS
159
+{
160
+ DWORD cbSize;
161
+ int nResult;
162
+} BAENGINE_COMPAREVERSIONS_RESULTS;
163
+
164
typedef struct _BAENGINE_DETECT_ARGS
165
{
166
DWORD cbSize;
src/WixToolset.BootstrapperCore.Native/inc/BundleExtension.h
+1
@@ -38,6 +38,7 @@ typedef struct _BUNDLE_EXTENSION_CREATE_ARGS
38
LPVOID pvBundleExtensionEngineProcContext;
39
LPCWSTR wzBootstrapperWorkingFolder;
40
LPCWSTR wzBundleExtensionDataPath;
41
+ LPCWSTR wzExtensionId;
42
} BUNDLE_EXTENSION_CREATE_ARGS;
43
44
typedef struct _BUNDLE_EXTENSION_CREATE_RESULTS
src/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h
+14
@@ -27,8 +27,22 @@ enum BUNDLE_EXTENSION_ENGINE_MESSAGE
27
BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC,
28
BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING,
29
BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION,
30
+ BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS,
31
};
32
33
+typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS
34
+{
35
+ DWORD cbSize;
36
+ LPCWSTR wzVersion1;
37
+ LPCWSTR wzVersion2;
38
+} BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS;
39
+
40
+typedef struct _BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS
41
+{
42
+ DWORD cbSize;
43
+ int nResult;
44
+} BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS;
45
+
46
typedef struct _BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS
47
{
48
DWORD cbSize;
src/engine/EngineForApplication.cpp
+19
@@ -616,6 +616,22 @@ static HRESULT BAEngineCloseSplashScreen(
616
return S_OK;
617
}
618
619
+static HRESULT BAEngineCompareVersions(
620
+ __in BOOTSTRAPPER_ENGINE_CONTEXT* /*pContext*/,
621
+ __in const BAENGINE_COMPAREVERSIONS_ARGS* pArgs,
622
+ __in BAENGINE_COMPAREVERSIONS_RESULTS* pResults
623
+ )
624
+{
625
+ HRESULT hr = S_OK;
626
+ LPCWSTR wzVersion1 = pArgs->wzVersion1;
627
+ LPCWSTR wzVersion2 = pArgs->wzVersion2;
628
+ int* pnResult = &pResults->nResult;
629
+
630
+ hr = VerCompareStringVersions(wzVersion1, wzVersion2, FALSE, pnResult);
631
+
632
+ return hr;
633
+}
634
+
635
static HRESULT BAEngineDetect(
636
__in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
637
__in BAENGINE_DETECT_ARGS* pArgs,
@@ -861,6 +877,9 @@ HRESULT WINAPI EngineForApplicationProc(
877
case BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE:
878
hr = BAEngineLaunchApprovedExe(pContext, reinterpret_cast<BAENGINE_LAUNCHAPPROVEDEXE_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LAUNCHAPPROVEDEXE_RESULTS*>(pvResults));
879
break;
880
+ case BOOTSTRAPPER_ENGINE_MESSAGE_COMPAREVERSIONS:
881
+ hr = BAEngineCompareVersions(pContext, reinterpret_cast<BAENGINE_COMPAREVERSIONS_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_COMPAREVERSIONS_RESULTS*>(pvResults));
882
+ break;
883
default:
884
hr = E_NOTIMPL;
885
break;
src/engine/EngineForExtension.cpp
+19
@@ -291,6 +291,22 @@ LExit:
291
return hr;
292
}
293
294
+static HRESULT BEEngineCompareVersions(
295
+ __in BURN_EXTENSION_ENGINE_CONTEXT* /*pContext*/,
296
+ __in const BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS* pArgs,
297
+ __in BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS* pResults
298
+ )
299
+{
300
+ HRESULT hr = S_OK;
301
+ LPCWSTR wzVersion1 = pArgs->wzVersion1;
302
+ LPCWSTR wzVersion2 = pArgs->wzVersion2;
303
+ int* pnResult = &pResults->nResult;
304
+
305
+ hr = VerCompareStringVersions(wzVersion1, wzVersion2, FALSE, pnResult);
306
+
307
+ return hr;
308
+}
309
+
310
HRESULT WINAPI EngineForExtensionProc(
311
__in BUNDLE_EXTENSION_ENGINE_MESSAGE message,
312
__in const LPVOID pvArgs,
@@ -338,6 +354,9 @@ HRESULT WINAPI EngineForExtensionProc(
354
case BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION:
355
hr = BEEngineSetVariableVersion(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS*>(pvResults));
356
break;
357
+ case BUNDLE_EXTENSION_ENGINE_MESSAGE_COMPAREVERSIONS:
358
+ hr = BEEngineCompareVersions(pContext, reinterpret_cast<BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_ARGS*>(pvArgs), reinterpret_cast<BUNDLE_EXTENSION_ENGINE_COMPAREVERSIONS_RESULTS*>(pvResults));
359
+ break;
360
default:
361
hr = E_NOTIMPL;
362
break;
src/engine/burnextension.cpp
+2
-1
@@ -126,9 +126,10 @@ EXTERN_C HRESULT BurnExtensionLoad(
126
args.cbSize = sizeof(BUNDLE_EXTENSION_CREATE_ARGS);
127
args.pfnBundleExtensionEngineProc = EngineForExtensionProc;
128
args.pvBundleExtensionEngineProcContext = pEngineContext;
129
- args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1); // TODO: need to decide whether to keep this, and if so when to update it.
129
+ args.qwEngineAPIVersion = MAKEQWORDVERSION(2020, 8, 31, 0);
130
args.wzBootstrapperWorkingFolder = pEngineContext->pEngineState->userExperience.sczTempDirectory;
131
args.wzBundleExtensionDataPath = sczBundleExtensionDataPath;
132
+ args.wzExtensionId = pExtension->sczId;
133
134
results.cbSize = sizeof(BUNDLE_EXTENSION_CREATE_RESULTS);
135
src/engine/userexperience.cpp
+1
-1
@@ -97,7 +97,7 @@ extern "C" HRESULT UserExperienceLoad(
97
args.pCommand = pCommand;
98
args.pfnBootstrapperEngineProc = EngineForApplicationProc;
99
args.pvBootstrapperEngineProcContext = pEngineContext;
100
- args.qwEngineAPIVersion = MAKEQWORDVERSION(2020, 5, 14, 0);
100
+ args.qwEngineAPIVersion = MAKEQWORDVERSION(2020, 8, 31, 0);
101
102
results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
103