diff --git a/appveyor.cmd b/appveyor.cmd index cc3f798..4803384 100644 --- a/appveyor.cmd +++ b/appveyor.cmd @@ -6,6 +6,7 @@ nuget restore || exit /b msbuild -p:Configuration=Release;Platform=x86 || exit /b msbuild -p:Configuration=Release -t:Pack src\stub\stub.vcxproj || exit /b +msbuild -p:Configuration=Release -t:Pack src\WixToolset.BootstrapperCore.Native\WixToolset.BootstrapperCore.Native.proj || exit /b @popd @endlocal \ No newline at end of file diff --git a/nuget.config b/nuget.config index ae9532b..405367b 100644 --- a/nuget.config +++ b/nuget.config @@ -3,7 +3,6 @@ - diff --git a/src/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.nuspec b/src/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.nuspec new file mode 100644 index 0000000..b10b75d --- /dev/null +++ b/src/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.nuspec @@ -0,0 +1,19 @@ + + + + $id$ + $version$ + WiX Toolset Team + WiX Toolset Team + MS-RL + https://github.com/wixtoolset/BootstrapperCore + false + $description$ + $copyright$ + + + + + + + diff --git a/src/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.proj b/src/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.proj new file mode 100644 index 0000000..113fe7a --- /dev/null +++ b/src/WixToolset.BootstrapperCore.Native/WixToolset.BootstrapperCore.Native.proj @@ -0,0 +1,19 @@ + + + + + + + WixToolset.BootstrapperCore.Native + WiX Bootstrapper native interfaces + + + + + + + + + + + \ No newline at end of file diff --git a/src/WixToolset.BootstrapperCore.Native/build/WixToolset.BootstrapperCore.Native.props b/src/WixToolset.BootstrapperCore.Native/build/WixToolset.BootstrapperCore.Native.props new file mode 100644 index 0000000..82f8116 --- /dev/null +++ b/src/WixToolset.BootstrapperCore.Native/build/WixToolset.BootstrapperCore.Native.props @@ -0,0 +1,13 @@ + + + + + + + $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) + + + $(MSBuildThisFileDirectory)native\include\;%(AdditionalIncludeDirectories) + + + diff --git a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h new file mode 100644 index 0000000..36d788c --- /dev/null +++ b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperApplication.h @@ -0,0 +1,1054 @@ +#pragma once +// 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. + + +enum BOOTSTRAPPER_DISPLAY +{ + BOOTSTRAPPER_DISPLAY_UNKNOWN, + BOOTSTRAPPER_DISPLAY_EMBEDDED, + BOOTSTRAPPER_DISPLAY_NONE, + BOOTSTRAPPER_DISPLAY_PASSIVE, + BOOTSTRAPPER_DISPLAY_FULL, +}; + +enum BOOTSTRAPPER_RESTART +{ + BOOTSTRAPPER_RESTART_UNKNOWN, + BOOTSTRAPPER_RESTART_NEVER, + BOOTSTRAPPER_RESTART_PROMPT, + BOOTSTRAPPER_RESTART_AUTOMATIC, + BOOTSTRAPPER_RESTART_ALWAYS, +}; + +enum BOOTSTRAPPER_RESUME_TYPE +{ + BOOTSTRAPPER_RESUME_TYPE_NONE, + BOOTSTRAPPER_RESUME_TYPE_INVALID, // resume information is present but invalid + BOOTSTRAPPER_RESUME_TYPE_INTERRUPTED, // relaunched after an unexpected interruption + BOOTSTRAPPER_RESUME_TYPE_REBOOT_PENDING, // reboot has not taken place yet + BOOTSTRAPPER_RESUME_TYPE_REBOOT, // relaunched after reboot + BOOTSTRAPPER_RESUME_TYPE_SUSPEND, // relaunched after suspend + BOOTSTRAPPER_RESUME_TYPE_ARP, // launched from ARP +}; + +enum BOOTSTRAPPER_ERROR_TYPE +{ + BOOTSTRAPPER_ERROR_TYPE_ELEVATE, // error occurred trying to elevate. + BOOTSTRAPPER_ERROR_TYPE_WINDOWS_INSTALLER, // error came from windows installer. + BOOTSTRAPPER_ERROR_TYPE_EXE_PACKAGE, // error came from an exe package. + BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_SERVER, // error occurred trying to authenticate with HTTP server. + BOOTSTRAPPER_ERROR_TYPE_HTTP_AUTH_PROXY, // error occurred trying to authenticate with HTTP proxy. + BOOTSTRAPPER_ERROR_TYPE_APPLY, // error occurred during apply. +}; + +enum BOOTSTRAPPER_RELATED_OPERATION +{ + BOOTSTRAPPER_RELATED_OPERATION_NONE, + BOOTSTRAPPER_RELATED_OPERATION_DOWNGRADE, + BOOTSTRAPPER_RELATED_OPERATION_MINOR_UPDATE, + BOOTSTRAPPER_RELATED_OPERATION_MAJOR_UPGRADE, + BOOTSTRAPPER_RELATED_OPERATION_REMOVE, + BOOTSTRAPPER_RELATED_OPERATION_INSTALL, + BOOTSTRAPPER_RELATED_OPERATION_REPAIR, +}; + +enum BOOTSTRAPPER_CACHE_OPERATION +{ + BOOTSTRAPPER_CACHE_OPERATION_COPY, + BOOTSTRAPPER_CACHE_OPERATION_DOWNLOAD, + BOOTSTRAPPER_CACHE_OPERATION_EXTRACT, +}; + +enum BOOTSTRAPPER_APPLY_RESTART +{ + BOOTSTRAPPER_APPLY_RESTART_NONE, + BOOTSTRAPPER_APPLY_RESTART_REQUIRED, + BOOTSTRAPPER_APPLY_RESTART_INITIATED, +}; + +enum BOOTSTRAPPER_RELATION_TYPE +{ + BOOTSTRAPPER_RELATION_NONE, + BOOTSTRAPPER_RELATION_DETECT, + BOOTSTRAPPER_RELATION_UPGRADE, + BOOTSTRAPPER_RELATION_ADDON, + BOOTSTRAPPER_RELATION_PATCH, + BOOTSTRAPPER_RELATION_DEPENDENT, + BOOTSTRAPPER_RELATION_UPDATE, +}; + +enum BOOTSTRAPPER_APPLICATION_MESSAGE +{ + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONSYSTEMSHUTDOWN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTFORWARDCOMPATIBLEBUNDLE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTUPDATECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDBUNDLE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTCOMPATIBLEMSIPACKAGE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTRELATEDMSIPACKAGE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTTARGETMSIPACKAGE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTMSIFEATURE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONDETECTPACKAGECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANRELATEDBUNDLE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANTARGETMSIPACKAGE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIFEATURE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANPACKAGECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONELEVATECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPROGRESS, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONERROR, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONREGISTERCOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIREPROGRESS, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONRESOLVESOURCE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEACQUIRECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEVERIFYCOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHEPACKAGECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONCACHECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPATCHTARGET, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPROGRESS, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEMSIMESSAGE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEFILESINUSE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTEPACKAGECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONEXECUTECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONUNREGISTERCOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONAPPLYCOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXEBEGIN, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONLAUNCHAPPROVEDEXECOMPLETE, + BOOTSTRAPPER_APPLICATION_MESSAGE_ONPLANMSIPACKAGE, +}; + +enum BOOTSTRAPPER_APPLYCOMPLETE_ACTION +{ + BOOTSTRAPPER_APPLYCOMPLETE_ACTION_NONE, + // Instructs the engine to restart. + // The engine will not launch again after the machine is rebooted. + // Ignored if reboot was already initiated by OnExecutePackageComplete(). + BOOTSTRAPPER_APPLYCOMPLETE_ACTION_RESTART, +}; + +enum BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION +{ + BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_NONE, + // Instructs the engine to try the acquisition of the package again. + // Ignored if hrStatus is a success. + BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION_RETRY, +}; + +enum BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION +{ + BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_NONE, + // Instructs the engine to ignore non-vital package failures and + // continue with the caching. + // Ignored if hrStatus is a success or the package is vital. + BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_IGNORE, + // Instructs the engine to try the acquisition and verification of the package again. + // Ignored if hrStatus is a success. + BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION_RETRY, +}; + +enum BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION +{ + BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_NONE, + // Ignored if hrStatus is a success. + BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYVERIFICATION, + // Ignored if hrStatus is a success. + BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION_RETRYACQUISITION, +}; + +enum BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION +{ + BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_NONE, + // Instructs the engine to ignore non-vital package failures and + // continue with the install. + // Ignored if hrStatus is a success or the package is vital. + BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_IGNORE, + // Instructs the engine to try the execution of the package again. + // Ignored if hrStatus is a success. + BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RETRY, + // Instructs the engine to stop processing the chain and restart. + // The engine will launch again after the machine is restarted. + BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_RESTART, + // Instructs the engine to stop processing the chain and + // suspend the current state. + BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION_SUSPEND, +}; + +enum BOOTSTRAPPER_RESOLVESOURCE_ACTION +{ + // Instructs the engine that the source can't be found. + BOOTSTRAPPER_RESOLVESOURCE_ACTION_NONE, + // Instructs the engine to try the local source again. + BOOTSTRAPPER_RESOLVESOURCE_ACTION_RETRY, + // Instructs the engine to try the download source. + BOOTSTRAPPER_RESOLVESOURCE_ACTION_DOWNLOAD, +}; + +enum BOOTSTRAPPER_SHUTDOWN_ACTION +{ + BOOTSTRAPPER_SHUTDOWN_ACTION_NONE, + // Instructs the engine to restart. + // The engine will not launch again after the machine is rebooted. + // Ignored if reboot was already initiated by OnExecutePackageComplete(). + BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART, + // Instructs the engine to unload the bootstrapper application and + // restart the engine which will load the bootstrapper application again. + // Typically used to switch from a native bootstrapper application to a managed one. + BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER, +}; + +enum BURN_MSI_PROPERTY +{ + BURN_MSI_PROPERTY_NONE, // no property added + BURN_MSI_PROPERTY_INSTALL, // add BURNMSIINSTALL=1 + BURN_MSI_PROPERTY_MODIFY, // add BURNMSIMODIFY=1 + BURN_MSI_PROPERTY_REPAIR, // add BURNMSIREPAIR=1 + BURN_MSI_PROPERTY_UNINSTALL,// add BURNMSIUNINSTALL=1 +}; + +struct BOOTSTRAPPER_COMMAND +{ + DWORD cbSize; + BOOTSTRAPPER_ACTION action; + BOOTSTRAPPER_DISPLAY display; + BOOTSTRAPPER_RESTART restart; + + LPWSTR wzCommandLine; + int nCmdShow; + + BOOTSTRAPPER_RESUME_TYPE resumeType; + HWND hwndSplashScreen; + + // If this was run from a related bundle, specifies the relation type + BOOTSTRAPPER_RELATION_TYPE relationType; + BOOL fPassthrough; + + LPWSTR wzLayoutDirectory; + LPWSTR wzBootstrapperWorkingFolder; + LPWSTR wzBootstrapperApplicationDataPath; +}; + +struct BA_ONAPPLYBEGIN_ARGS +{ + DWORD cbSize; + DWORD dwPhaseCount; +}; + +struct BA_ONAPPLYBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONAPPLYCOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; + // Indicates whether any package required a reboot or initiated the reboot already. + BOOTSTRAPPER_APPLY_RESTART restart; + BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation; +}; + +struct BA_ONAPPLYCOMPLETE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_APPLYCOMPLETE_ACTION action; +}; + +struct BA_ONCACHEACQUIREBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; + BOOTSTRAPPER_CACHE_OPERATION operation; + LPCWSTR wzSource; +}; + +struct BA_ONCACHEACQUIREBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONCACHEACQUIRECOMPLETE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; + HRESULT hrStatus; + BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation; +}; + +struct BA_ONCACHEACQUIRECOMPLETE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action; +}; + +struct BA_ONCACHEACQUIREPROGRESS_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; + DWORD64 dw64Progress; + DWORD64 dw64Total; + DWORD dwOverallPercentage; +}; + +struct BA_ONCACHEACQUIREPROGRESS_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONCACHEBEGIN_ARGS +{ + DWORD cbSize; +}; + +struct BA_ONCACHEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONCACHECOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONCACHECOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONCACHEPACKAGEBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + DWORD cCachePayloads; + DWORD64 dw64PackageCacheSize; +}; + +struct BA_ONCACHEPACKAGEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONCACHEPACKAGECOMPLETE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + HRESULT hrStatus; + BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation; +}; + +struct BA_ONCACHEPACKAGECOMPLETE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action; +}; + +struct BA_ONCACHEVERIFYBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; +}; + +struct BA_ONCACHEVERIFYBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONCACHEVERIFYCOMPLETE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; + HRESULT hrStatus; + BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation; +}; + +struct BA_ONCACHEVERIFYCOMPLETE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action; +}; + +struct BA_ONDETECTBEGIN_ARGS +{ + DWORD cbSize; + BOOL fInstalled; + DWORD cPackages; +}; + +struct BA_ONDETECTBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONDETECTCOMPATIBLEMSIPACKAGE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzCompatiblePackageId; + DWORD64 dw64CompatiblePackageVersion; +}; + +struct BA_ONDETECTCOMPATIBLEMSIPACKAGE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONDETECTCOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONDETECTCOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_ARGS +{ + DWORD cbSize; + LPCWSTR wzBundleId; + BOOTSTRAPPER_RELATION_TYPE relationType; + LPCWSTR wzBundleTag; + BOOL fPerMachine; + DWORD64 dw64Version; +}; + +struct BA_ONDETECTFORWARDCOMPATIBLEBUNDLE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BOOL fIgnoreBundle; +}; + +struct BA_ONDETECTMSIFEATURE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzFeatureId; + BOOTSTRAPPER_FEATURE_STATE state; +}; + +struct BA_ONDETECTMSIFEATURE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONDETECTPACKAGEBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; +}; + +struct BA_ONDETECTPACKAGEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONDETECTPACKAGECOMPLETE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + HRESULT hrStatus; + BOOTSTRAPPER_PACKAGE_STATE state; +}; + +struct BA_ONDETECTPACKAGECOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONDETECTRELATEDBUNDLE_ARGS +{ + DWORD cbSize; + LPCWSTR wzBundleId; + BOOTSTRAPPER_RELATION_TYPE relationType; + LPCWSTR wzBundleTag; + BOOL fPerMachine; + DWORD64 dw64Version; + BOOTSTRAPPER_RELATED_OPERATION operation; +}; + +struct BA_ONDETECTRELATEDBUNDLE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONDETECTRELATEDMSIPACKAGE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzUpgradeCode; + LPCWSTR wzProductCode; + BOOL fPerMachine; + DWORD64 dw64Version; + BOOTSTRAPPER_RELATED_OPERATION operation; +}; + +struct BA_ONDETECTRELATEDMSIPACKAGE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONDETECTTARGETMSIPACKAGE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzProductCode; + BOOTSTRAPPER_PACKAGE_STATE patchState; +}; + +struct BA_ONDETECTTARGETMSIPACKAGE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONDETECTUPDATE_ARGS +{ + DWORD cbSize; + LPCWSTR wzUpdateLocation; + DWORD64 dw64Size; + DWORD64 dw64Version; + LPCWSTR wzTitle; + LPCWSTR wzSummary; + LPCWSTR wzContentType; + LPCWSTR wzContent; +}; + +struct BA_ONDETECTUPDATE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BOOL fStopProcessingUpdates; +}; + +struct BA_ONDETECTUPDATEBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzUpdateLocation; +}; + +struct BA_ONDETECTUPDATEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BOOL fSkip; +}; + +struct BA_ONDETECTUPDATECOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONDETECTUPDATECOMPLETE_RESULTS +{ + DWORD cbSize; + BOOL fIgnoreError; +}; + +struct BA_ONELEVATEBEGIN_ARGS +{ + DWORD cbSize; +}; + +struct BA_ONELEVATEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONELEVATECOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONELEVATECOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONERROR_ARGS +{ + DWORD cbSize; + BOOTSTRAPPER_ERROR_TYPE errorType; + LPCWSTR wzPackageId; + DWORD dwCode; + LPCWSTR wzError; + DWORD dwUIHint; + DWORD cData; + LPCWSTR* rgwzData; + int nRecommendation; +}; + +struct BA_ONERROR_RESULTS +{ + DWORD cbSize; + int nResult; +}; + +struct BA_ONEXECUTEBEGIN_ARGS +{ + DWORD cbSize; + DWORD cExecutingPackages; +}; + +struct BA_ONEXECUTEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONEXECUTECOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONEXECUTECOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONEXECUTEFILESINUSE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + DWORD cFiles; + LPCWSTR* rgwzFiles; + int nRecommendation; +}; + +struct BA_ONEXECUTEFILESINUSE_RESULTS +{ + DWORD cbSize; + int nResult; +}; + +struct BA_ONEXECUTEMSIMESSAGE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + INSTALLMESSAGE messageType; + DWORD dwUIHint; + LPCWSTR wzMessage; + DWORD cData; + LPCWSTR* rgwzData; + int nRecommendation; +}; + +struct BA_ONEXECUTEMSIMESSAGE_RESULTS +{ + DWORD cbSize; + int nResult; +}; + +struct BA_ONEXECUTEPACKAGEBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + BOOL fExecute; // false means rollback. + BOOTSTRAPPER_ACTION_STATE action; + INSTALLUILEVEL uiLevel; + BOOL fDisableExternalUiHandler; +}; + +struct BA_ONEXECUTEPACKAGEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONEXECUTEPACKAGECOMPLETE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + HRESULT hrStatus; + // Indicates whether this package requires a reboot or initiated the reboot already. + BOOTSTRAPPER_APPLY_RESTART restart; + BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation; +}; + +struct BA_ONEXECUTEPACKAGECOMPLETE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action; +}; + +struct BA_ONEXECUTEPATCHTARGET_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzTargetProductCode; +}; + +struct BA_ONEXECUTEPATCHTARGET_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONEXECUTEPROGRESS_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + DWORD dwProgressPercentage; + DWORD dwOverallPercentage; +}; + +struct BA_ONEXECUTEPROGRESS_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONLAUNCHAPPROVEDEXEBEGIN_ARGS +{ + DWORD cbSize; +}; + +struct BA_ONLAUNCHAPPROVEDEXEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; + // Only valid if the operation succeeded. + DWORD dwProcessId; +}; + +struct BA_ONLAUNCHAPPROVEDEXECOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONPLANBEGIN_ARGS +{ + DWORD cbSize; + DWORD cPackages; +}; + +struct BA_ONPLANBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzCompatiblePackageId; + DWORD64 dw64CompatiblePackageVersion; + BOOTSTRAPPER_REQUEST_STATE recommendedState; +}; + +struct BA_ONPLANCOMPATIBLEMSIPACKAGEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BOOTSTRAPPER_REQUEST_STATE requestedState; +}; + +struct BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzCompatiblePackageId; + HRESULT hrStatus; + BOOTSTRAPPER_PACKAGE_STATE state; + BOOTSTRAPPER_REQUEST_STATE requested; + BOOTSTRAPPER_ACTION_STATE execute; + BOOTSTRAPPER_ACTION_STATE rollback; +}; + +struct BA_ONPLANCOMPATIBLEMSIPACKAGECOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONPLANCOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONPLANCOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONPLANMSIFEATURE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzFeatureId; + BOOTSTRAPPER_FEATURE_STATE recommendedState; +}; + +struct BA_ONPLANMSIFEATURE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_FEATURE_STATE requestedState; + BOOL fCancel; +}; + +struct BA_ONPLANMSIPACKAGE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + BOOL fExecute; // false means rollback. + BOOTSTRAPPER_ACTION_STATE action; +}; + +struct BA_ONPLANMSIPACKAGE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BURN_MSI_PROPERTY actionMsiProperty; + INSTALLUILEVEL uiLevel; + BOOL fDisableExternalUiHandler; +}; + +struct BA_ONPLANPACKAGEBEGIN_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + BOOTSTRAPPER_REQUEST_STATE recommendedState; +}; + +struct BA_ONPLANPACKAGEBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BOOTSTRAPPER_REQUEST_STATE requestedState; +}; + +struct BA_ONPLANPACKAGECOMPLETE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + HRESULT hrStatus; + BOOTSTRAPPER_PACKAGE_STATE state; + BOOTSTRAPPER_REQUEST_STATE requested; + BOOTSTRAPPER_ACTION_STATE execute; + BOOTSTRAPPER_ACTION_STATE rollback; +}; + +struct BA_ONPLANPACKAGECOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONPLANRELATEDBUNDLE_ARGS +{ + DWORD cbSize; + LPCWSTR wzBundleId; + BOOTSTRAPPER_REQUEST_STATE recommendedState; +}; + +struct BA_ONPLANRELATEDBUNDLE_RESULTS +{ + DWORD cbSize; + BOOL fCancel; + BOOTSTRAPPER_REQUEST_STATE requestedState; +}; + +struct BA_ONPLANTARGETMSIPACKAGE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageId; + LPCWSTR wzProductCode; + BOOTSTRAPPER_REQUEST_STATE recommendedState; +}; + +struct BA_ONPLANTARGETMSIPACKAGE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_REQUEST_STATE requestedState; + BOOL fCancel; +}; + +struct BA_ONPROGRESS_ARGS +{ + DWORD cbSize; + DWORD dwProgressPercentage; + DWORD dwOverallPercentage; +}; + +struct BA_ONPROGRESS_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONREGISTERBEGIN_ARGS +{ + DWORD cbSize; +}; + +struct BA_ONREGISTERBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONREGISTERCOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONREGISTERCOMPLETE_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONRESOLVESOURCE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; + LPCWSTR wzLocalSource; + LPCWSTR wzDownloadSource; + BOOTSTRAPPER_RESOLVESOURCE_ACTION recommendation; +}; + +struct BA_ONRESOLVESOURCE_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_RESOLVESOURCE_ACTION action; + BOOL fCancel; +}; + +struct BA_ONSHUTDOWN_ARGS +{ + DWORD cbSize; +}; + +struct BA_ONSHUTDOWN_RESULTS +{ + DWORD cbSize; + BOOTSTRAPPER_SHUTDOWN_ACTION action; +}; + +struct BA_ONSTARTUP_ARGS +{ + DWORD cbSize; +}; + +struct BA_ONSTARTUP_RESULTS +{ + DWORD cbSize; +}; + +struct BA_ONSYSTEMSHUTDOWN_ARGS +{ + DWORD cbSize; + DWORD dwEndSession; +}; + +struct BA_ONSYSTEMSHUTDOWN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONUNREGISTERBEGIN_ARGS +{ + DWORD cbSize; +}; + +struct BA_ONUNREGISTERBEGIN_RESULTS +{ + DWORD cbSize; + BOOL fCancel; +}; + +struct BA_ONUNREGISTERCOMPLETE_ARGS +{ + DWORD cbSize; + HRESULT hrStatus; +}; + +struct BA_ONUNREGISTERCOMPLETE_RESULTS +{ + DWORD cbSize; +}; + + + +extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_PROC)( + __in BOOTSTRAPPER_APPLICATION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ); + +extern "C" typedef void (WINAPI *PFN_BOOTSTRAPPER_APPLICATION_DESTROY)(); + + + +struct BOOTSTRAPPER_CREATE_ARGS +{ + DWORD cbSize; + DWORD64 qwEngineAPIVersion; + PFN_BOOTSTRAPPER_ENGINE_PROC pfnBootstrapperEngineProc; + LPVOID pvBootstrapperEngineProcContext; + BOOTSTRAPPER_COMMAND* pCommand; +}; + +struct BOOTSTRAPPER_CREATE_RESULTS +{ + DWORD cbSize; + PFN_BOOTSTRAPPER_APPLICATION_PROC pfnBootstrapperApplicationProc; + LPVOID pvBootstrapperApplicationProcContext; + BOOL fDisableUnloading; // indicates the BA dll must not be unloaded after BootstrapperApplicationDestroy. +}; + +extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_APPLICATION_CREATE)( + __in const BOOTSTRAPPER_CREATE_ARGS* pArgs, + __inout BOOTSTRAPPER_CREATE_RESULTS* pResults + ); diff --git a/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h new file mode 100644 index 0000000..0dcaba7 --- /dev/null +++ b/src/WixToolset.BootstrapperCore.Native/inc/BootstrapperEngine.h @@ -0,0 +1,430 @@ +#pragma once +// 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. + + +#if defined(__cplusplus) +extern "C" { +#endif + +#define IDERROR -1 +#define IDNOACTION 0 + +#ifndef FACILITY_WIX +#define FACILITY_WIX 500 +#endif + +static const HRESULT E_SUSPECTED_AV_INTERFERENCE = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIX, 2000); + +// Note that ordering of the enumeration values is important. +// Some code paths use < or > comparisions and simply reording values will break those comparisons. +enum BOOTSTRAPPER_ACTION +{ + BOOTSTRAPPER_ACTION_UNKNOWN, + BOOTSTRAPPER_ACTION_HELP, + BOOTSTRAPPER_ACTION_LAYOUT, + BOOTSTRAPPER_ACTION_UNINSTALL, + BOOTSTRAPPER_ACTION_CACHE, + BOOTSTRAPPER_ACTION_INSTALL, + BOOTSTRAPPER_ACTION_MODIFY, + BOOTSTRAPPER_ACTION_REPAIR, + BOOTSTRAPPER_ACTION_UPDATE_REPLACE, + BOOTSTRAPPER_ACTION_UPDATE_REPLACE_EMBEDDED, +}; + +enum BOOTSTRAPPER_ACTION_STATE +{ + BOOTSTRAPPER_ACTION_STATE_NONE, + BOOTSTRAPPER_ACTION_STATE_UNINSTALL, + BOOTSTRAPPER_ACTION_STATE_INSTALL, + BOOTSTRAPPER_ACTION_STATE_ADMIN_INSTALL, + BOOTSTRAPPER_ACTION_STATE_MODIFY, + BOOTSTRAPPER_ACTION_STATE_REPAIR, + BOOTSTRAPPER_ACTION_STATE_MINOR_UPGRADE, + BOOTSTRAPPER_ACTION_STATE_MAJOR_UPGRADE, + BOOTSTRAPPER_ACTION_STATE_PATCH, +}; + +enum BOOTSTRAPPER_PACKAGE_STATE +{ + BOOTSTRAPPER_PACKAGE_STATE_UNKNOWN, + BOOTSTRAPPER_PACKAGE_STATE_OBSOLETE, + BOOTSTRAPPER_PACKAGE_STATE_ABSENT, + BOOTSTRAPPER_PACKAGE_STATE_CACHED, + BOOTSTRAPPER_PACKAGE_STATE_PRESENT, + BOOTSTRAPPER_PACKAGE_STATE_SUPERSEDED, +}; + +enum BOOTSTRAPPER_REQUEST_STATE +{ + BOOTSTRAPPER_REQUEST_STATE_NONE, + BOOTSTRAPPER_REQUEST_STATE_FORCE_ABSENT, + BOOTSTRAPPER_REQUEST_STATE_ABSENT, + BOOTSTRAPPER_REQUEST_STATE_CACHE, + BOOTSTRAPPER_REQUEST_STATE_PRESENT, + BOOTSTRAPPER_REQUEST_STATE_REPAIR, +}; + +enum BOOTSTRAPPER_FEATURE_STATE +{ + BOOTSTRAPPER_FEATURE_STATE_UNKNOWN, + BOOTSTRAPPER_FEATURE_STATE_ABSENT, + BOOTSTRAPPER_FEATURE_STATE_ADVERTISED, + BOOTSTRAPPER_FEATURE_STATE_LOCAL, + BOOTSTRAPPER_FEATURE_STATE_SOURCE, +}; + +enum BOOTSTRAPPER_FEATURE_ACTION +{ + BOOTSTRAPPER_FEATURE_ACTION_NONE, + BOOTSTRAPPER_FEATURE_ACTION_ADDLOCAL, + BOOTSTRAPPER_FEATURE_ACTION_ADDSOURCE, + BOOTSTRAPPER_FEATURE_ACTION_ADDDEFAULT, + BOOTSTRAPPER_FEATURE_ACTION_REINSTALL, + BOOTSTRAPPER_FEATURE_ACTION_ADVERTISE, + BOOTSTRAPPER_FEATURE_ACTION_REMOVE, +}; + +enum BOOTSTRAPPER_LOG_LEVEL +{ + BOOTSTRAPPER_LOG_LEVEL_NONE, // turns off report (only valid for XXXSetLevel()) + BOOTSTRAPPER_LOG_LEVEL_STANDARD, // written if reporting is on + BOOTSTRAPPER_LOG_LEVEL_VERBOSE, // written only if verbose reporting is on + BOOTSTRAPPER_LOG_LEVEL_DEBUG, // reporting useful when debugging code + BOOTSTRAPPER_LOG_LEVEL_ERROR, // always gets reported, but can never be specified +}; + +enum BOOTSTRAPPER_UPDATE_HASH_TYPE +{ + BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE, + BOOTSTRAPPER_UPDATE_HASH_TYPE_SHA1, +}; + +enum BOOTSTRAPPER_ENGINE_MESSAGE +{ + BOOTSTRAPPER_ENGINE_MESSAGE_GETPACKAGECOUNT, + BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLENUMERIC, + BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLESTRING, + BOOTSTRAPPER_ENGINE_MESSAGE_GETVARIABLEVERSION, + BOOTSTRAPPER_ENGINE_MESSAGE_FORMATSTRING, + BOOTSTRAPPER_ENGINE_MESSAGE_ESCAPESTRING, + BOOTSTRAPPER_ENGINE_MESSAGE_EVALUATECONDITION, + BOOTSTRAPPER_ENGINE_MESSAGE_LOG, + BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDERROR, + BOOTSTRAPPER_ENGINE_MESSAGE_SENDEMBEDDEDPROGRESS, + BOOTSTRAPPER_ENGINE_MESSAGE_SETUPDATE, + BOOTSTRAPPER_ENGINE_MESSAGE_SETLOCALSOURCE, + BOOTSTRAPPER_ENGINE_MESSAGE_SETDOWNLOADSOURCE, + BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLENUMERIC, + BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLESTRING, + BOOTSTRAPPER_ENGINE_MESSAGE_SETVARIABLEVERSION, + BOOTSTRAPPER_ENGINE_MESSAGE_CLOSESPLASHSCREEN, + BOOTSTRAPPER_ENGINE_MESSAGE_DETECT, + BOOTSTRAPPER_ENGINE_MESSAGE_PLAN, + BOOTSTRAPPER_ENGINE_MESSAGE_ELEVATE, + BOOTSTRAPPER_ENGINE_MESSAGE_APPLY, + BOOTSTRAPPER_ENGINE_MESSAGE_QUIT, + BOOTSTRAPPER_ENGINE_MESSAGE_LAUNCHAPPROVEDEXE, +}; + +typedef struct _BAENGINE_APPLY_ARGS +{ + DWORD cbSize; + HWND hwndParent; +} BAENGINE_APPLY_ARGS; + +typedef struct _BAENGINE_APPLY_RESULTS +{ + DWORD cbSize; +} BAENGINE_APPLY_RESULTS; + +typedef struct _BAENGINE_CLOSESPLASHSCREEN_ARGS +{ + DWORD cbSize; +} BAENGINE_CLOSESPLASHSCREEN_ARGS; + +typedef struct _BAENGINE_CLOSESPLASHSCREEN_RESULTS +{ + DWORD cbSize; +} BAENGINE_CLOSESPLASHSCREEN_RESULTS; + +typedef struct _BAENGINE_DETECT_ARGS +{ + DWORD cbSize; + HWND hwndParent; +} BAENGINE_DETECT_ARGS; + +typedef struct _BAENGINE_DETECT_RESULTS +{ + DWORD cbSize; +} BAENGINE_DETECT_RESULTS; + +typedef struct _BAENGINE_ELEVATE_ARGS +{ + DWORD cbSize; + HWND hwndParent; +} BAENGINE_ELEVATE_ARGS; + +typedef struct _BAENGINE_ELEVATE_RESULTS +{ + DWORD cbSize; +} BAENGINE_ELEVATE_RESULTS; + +typedef struct _BAENGINE_ESCAPESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzIn; +} BAENGINE_ESCAPESTRING_ARGS; + +typedef struct _BAENGINE_ESCAPESTRING_RESULTS +{ + DWORD cbSize; + LPWSTR wzOut; + // Should be initialized to the size of wzOut. + DWORD cchOut; +} BAENGINE_ESCAPESTRING_RESULTS; + +typedef struct _BAENGINE_EVALUATECONDITION_ARGS +{ + DWORD cbSize; + LPCWSTR wzCondition; +} BAENGINE_EVALUATECONDITION_ARGS; + +typedef struct _BAENGINE_EVALUATECONDITION_RESULTS +{ + DWORD cbSize; + BOOL f; +} BAENGINE_EVALUATECONDITION_RESULTS; + +typedef struct _BAENGINE_FORMATSTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzIn; +} BAENGINE_FORMATSTRING_ARGS; + +typedef struct _BAENGINE_FORMATSTRING_RESULTS +{ + DWORD cbSize; + // The contents of wzOut may be sensitive, should keep encrypted and SecureZeroFree. + LPWSTR wzOut; + // Should be initialized to the size of wzOut. + DWORD cchOut; +} BAENGINE_FORMATSTRING_RESULTS; + +typedef struct _BAENGINE_GETPACKAGECOUNT_ARGS +{ + DWORD cbSize; +} BAENGINE_GETPACKAGECOUNT_ARGS; + +typedef struct _BAENGINE_GETPACKAGECOUNT_RESULTS +{ + DWORD cbSize; + DWORD cPackages; +} BAENGINE_GETPACKAGECOUNT_RESULTS; + +typedef struct _BAENGINE_GETVARIABLENUMERIC_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BAENGINE_GETVARIABLENUMERIC_ARGS; + +typedef struct _BAENGINE_GETVARIABLENUMERIC_RESULTS +{ + DWORD cbSize; + // The contents of llValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroMemory. + LONGLONG llValue; +} BAENGINE_GETVARIABLENUMERIC_RESULTS; + +typedef struct _BAENGINE_GETVARIABLESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BAENGINE_GETVARIABLESTRING_ARGS; + +typedef struct _BAENGINE_GETVARIABLESTRING_RESULTS +{ + DWORD cbSize; + // The contents of wzValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroFree. + LPWSTR wzValue; + // Should be initialized to the size of wzValue. + DWORD cchValue; +} BAENGINE_GETVARIABLESTRING_RESULTS; + +typedef struct _BAENGINE_GETVARIABLEVERSION_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BAENGINE_GETVARIABLEVERSION_ARGS; + +typedef struct _BAENGINE_GETVARIABLEVERSION_RESULTS +{ + DWORD cbSize; + // The contents of qwValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroMemory. + DWORD64 qwValue; +} BAENGINE_GETVARIABLEVERSION_RESULTS; + +typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_ARGS +{ + DWORD cbSize; + HWND hwndParent; + LPCWSTR wzApprovedExeForElevationId; + LPCWSTR wzArguments; + DWORD dwWaitForInputIdleTimeout; +} BAENGINE_LAUNCHAPPROVEDEXE_ARGS; + +typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_RESULTS +{ + DWORD cbSize; +} BAENGINE_LAUNCHAPPROVEDEXE_RESULTS; + +typedef struct _BAENGINE_LOG_ARGS +{ + DWORD cbSize; + BOOTSTRAPPER_LOG_LEVEL level; + LPCWSTR wzMessage; +} BAENGINE_LOG_ARGS; + +typedef struct _BAENGINE_LOG_RESULTS +{ + DWORD cbSize; +} BAENGINE_LOG_RESULTS; + +typedef struct _BAENGINE_PLAN_ARGS +{ + DWORD cbSize; + BOOTSTRAPPER_ACTION action; +} BAENGINE_PLAN_ARGS; + +typedef struct _BAENGINE_PLAN_RESULTS +{ + DWORD cbSize; +} BAENGINE_PLAN_RESULTS; + +typedef struct _BAENGINE_QUIT_ARGS +{ + DWORD cbSize; + DWORD dwExitCode; +} BAENGINE_QUIT_ARGS; + +typedef struct _BAENGINE_QUIT_RESULTS +{ + DWORD cbSize; +} BAENGINE_QUIT_RESULTS; + +typedef struct _BAENGINE_SENDEMBEDDEDERROR_ARGS +{ + DWORD cbSize; + DWORD dwErrorCode; + LPCWSTR wzMessage; + DWORD dwUIHint; +} BAENGINE_SENDEMBEDDEDERROR_ARGS; + +typedef struct _BAENGINE_SENDEMBEDDEDERROR_RESULTS +{ + DWORD cbSize; + int nResult; +} BAENGINE_SENDEMBEDDEDERROR_RESULTS; + +typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_ARGS +{ + DWORD cbSize; + DWORD dwProgressPercentage; + DWORD dwOverallProgressPercentage; +} BAENGINE_SENDEMBEDDEDPROGRESS_ARGS; + +typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS +{ + DWORD cbSize; + int nResult; +} BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS; + +typedef struct _BAENGINE_SETDOWNLOADSOURCE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; + LPCWSTR wzUrl; + LPCWSTR wzUser; + LPCWSTR wzPassword; +} BAENGINE_SETDOWNLOADSOURCE_ARGS; + +typedef struct _BAENGINE_SETDOWNLOADSOURCE_RESULTS +{ + DWORD cbSize; +} BAENGINE_SETDOWNLOADSOURCE_RESULTS; + +typedef struct _BAENGINE_SETLOCALSOURCE_ARGS +{ + DWORD cbSize; + LPCWSTR wzPackageOrContainerId; + LPCWSTR wzPayloadId; + LPCWSTR wzPath; +} BAENGINE_SETLOCALSOURCE_ARGS; + +typedef struct _BAENGINE_SETLOCALSOURCE_RESULTS +{ + DWORD cbSize; +} BAENGINE_SETLOCALSOURCE_RESULTS; + +typedef struct _BAENGINE_SETUPDATE_ARGS +{ + DWORD cbSize; + LPCWSTR wzLocalSource; + LPCWSTR wzDownloadSource; + DWORD64 qwSize; + BOOTSTRAPPER_UPDATE_HASH_TYPE hashType; + BYTE* rgbHash; + DWORD cbHash; +} BAENGINE_SETUPDATE_ARGS; + +typedef struct _BAENGINE_SETUPDATE_RESULTS +{ + DWORD cbSize; +} BAENGINE_SETUPDATE_RESULTS; + +typedef struct _BAENGINE_SETVARIABLENUMERIC_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LONGLONG llValue; +} BAENGINE_SETVARIABLENUMERIC_ARGS; + +typedef struct _BAENGINE_SETVARIABLENUMERIC_RESULTS +{ + DWORD cbSize; +} BAENGINE_SETVARIABLENUMERIC_RESULTS; + +typedef struct _BAENGINE_SETVARIABLESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LPCWSTR wzValue; +} BAENGINE_SETVARIABLESTRING_ARGS; + +typedef struct _BAENGINE_SETVARIABLESTRING_RESULTS +{ + DWORD cbSize; +} BAENGINE_SETVARIABLESTRING_RESULTS; + +typedef struct _BAENGINE_SETVARIABLEVERSION_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + DWORD64 qwValue; +} BAENGINE_SETVARIABLEVERSION_ARGS; + +typedef struct _BAENGINE_SETVARIABLEVERSION_RESULTS +{ + DWORD cbSize; +} BAENGINE_SETVARIABLEVERSION_RESULTS; + + +extern "C" typedef HRESULT(WINAPI *PFN_BOOTSTRAPPER_ENGINE_PROC)( + __in BOOTSTRAPPER_ENGINE_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ); + +#if defined(__cplusplus) +} +#endif diff --git a/src/WixToolset.BootstrapperCore.Native/inc/BundleExtension.h b/src/WixToolset.BootstrapperCore.Native/inc/BundleExtension.h new file mode 100644 index 0000000..5c7d126 --- /dev/null +++ b/src/WixToolset.BootstrapperCore.Native/inc/BundleExtension.h @@ -0,0 +1,59 @@ +#pragma once +// 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. + + +#if defined(__cplusplus) +extern "C" { +#endif + +enum BUNDLE_EXTENSION_MESSAGE +{ + BUNDLE_EXTENSION_MESSAGE_SEARCH, +}; + +typedef struct _BUNDLE_EXTENSION_SEARCH_ARGS +{ + DWORD cbSize; + LPCWSTR wzId; + LPCWSTR wzVariable; +} BUNDLE_EXTENSION_SEARCH_ARGS; + +typedef struct _BUNDLE_EXTENSION_SEARCH_RESULTS +{ + DWORD cbSize; +} BUNDLE_EXTENSION_SEARCH_RESULTS; + +extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_PROC)( + __in BUNDLE_EXTENSION_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ); + +typedef struct _BUNDLE_EXTENSION_CREATE_ARGS +{ + DWORD cbSize; + DWORD64 qwEngineAPIVersion; + PFN_BUNDLE_EXTENSION_ENGINE_PROC pfnBundleExtensionEngineProc; + LPVOID pvBundleExtensionEngineProcContext; + LPCWSTR wzBootstrapperWorkingFolder; + LPCWSTR wzBundleExtensionDataPath; +} BUNDLE_EXTENSION_CREATE_ARGS; + +typedef struct _BUNDLE_EXTENSION_CREATE_RESULTS +{ + DWORD cbSize; + PFN_BUNDLE_EXTENSION_PROC pfnBundleExtensionProc; + LPVOID pvBundleExtensionProcContext; +} BUNDLE_EXTENSION_CREATE_RESULTS; + +extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_CREATE)( + __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs, + __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults + ); + +extern "C" typedef void (WINAPI *PFN_BUNDLE_EXTENSION_DESTROY)(); + +#if defined(__cplusplus) +} +#endif diff --git a/src/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h b/src/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h new file mode 100644 index 0000000..03c4f20 --- /dev/null +++ b/src/WixToolset.BootstrapperCore.Native/inc/BundleExtensionEngine.h @@ -0,0 +1,184 @@ +#pragma once +// 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. + + +#if defined(__cplusplus) +extern "C" { +#endif + +enum BUNDLE_EXTENSION_LOG_LEVEL +{ + BUNDLE_EXTENSION_LOG_LEVEL_NONE, // turns off report (only valid for XXXSetLevel()) + BUNDLE_EXTENSION_LOG_LEVEL_STANDARD, // written if reporting is on + BUNDLE_EXTENSION_LOG_LEVEL_VERBOSE, // written only if verbose reporting is on + BUNDLE_EXTENSION_LOG_LEVEL_DEBUG, // reporting useful when debugging code + BUNDLE_EXTENSION_LOG_LEVEL_ERROR, // always gets reported, but can never be specified +}; + +enum BUNDLE_EXTENSION_ENGINE_MESSAGE +{ + BUNDLE_EXTENSION_ENGINE_MESSAGE_ESCAPESTRING, + BUNDLE_EXTENSION_ENGINE_MESSAGE_EVALUATECONDITION, + BUNDLE_EXTENSION_ENGINE_MESSAGE_FORMATSTRING, + BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLENUMERIC, + BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLESTRING, + BUNDLE_EXTENSION_ENGINE_MESSAGE_GETVARIABLEVERSION, + BUNDLE_EXTENSION_ENGINE_MESSAGE_LOG, + BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLELITERALSTRING, + BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLENUMERIC, + BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLESTRING, + BUNDLE_EXTENSION_ENGINE_MESSAGE_SETVARIABLEVERSION, +}; + +typedef struct _BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzIn; +} BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS +{ + DWORD cbSize; + LPWSTR wzOut; + // Should be initialized to the size of wzOut. + DWORD cchOut; +} BUNDLE_EXTENSION_ENGINE_ESCAPESTRING_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS +{ + DWORD cbSize; + LPCWSTR wzCondition; +} BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS +{ + DWORD cbSize; + BOOL f; +} BUNDLE_EXTENSION_ENGINE_EVALUATECONDITION_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzIn; +} BUNDLE_EXTENSION_ENGINE_FORMATSTRING_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS +{ + DWORD cbSize; + // The contents of wzOut may be sensitive, should keep encrypted and SecureZeroFree. + LPWSTR wzOut; + // Should be initialized to the size of wzOut. + DWORD cchOut; +} BUNDLE_EXTENSION_ENGINE_FORMATSTRING_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS +{ + DWORD cbSize; + // The contents of llValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroMemory. + LONGLONG llValue; +} BUNDLE_EXTENSION_ENGINE_GETVARIABLENUMERIC_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS +{ + DWORD cbSize; + // The contents of wzValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroFree. + LPWSTR wzValue; + // Should be initialized to the size of wzValue. + DWORD cchValue; +} BUNDLE_EXTENSION_ENGINE_GETVARIABLESTRING_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; +} BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS +{ + DWORD cbSize; + // The contents of qwValue may be sensitive, if variable is hidden should keep value encrypted and SecureZeroMemory. + DWORD64 qwValue; +} BUNDLE_EXTENSION_ENGINE_GETVARIABLEVERSION_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_LOG_ARGS +{ + DWORD cbSize; + BUNDLE_EXTENSION_LOG_LEVEL level; + LPCWSTR wzMessage; +} BUNDLE_EXTENSION_ENGINE_LOG_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_LOG_RESULTS +{ + DWORD cbSize; +} BUNDLE_EXTENSION_ENGINE_LOG_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLELITERALSTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LPCWSTR wzValue; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLELITERALSTRING_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLELITERALSTRING_RESULTS +{ + DWORD cbSize; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLELITERALSTRING_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LONGLONG llValue; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS +{ + DWORD cbSize; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLENUMERIC_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + LPCWSTR wzValue; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS +{ + DWORD cbSize; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLESTRING_RESULTS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS +{ + DWORD cbSize; + LPCWSTR wzVariable; + DWORD64 qwValue; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_ARGS; + +typedef struct _BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS +{ + DWORD cbSize; +} BUNDLE_EXTENSION_ENGINE_SETVARIABLEVERSION_RESULTS; + +extern "C" typedef HRESULT(WINAPI *PFN_BUNDLE_EXTENSION_ENGINE_PROC)( + __in BUNDLE_EXTENSION_ENGINE_MESSAGE message, + __in const LPVOID pvArgs, + __inout LPVOID pvResults, + __in_opt LPVOID pvContext + ); + +#if defined(__cplusplus) +} +#endif diff --git a/src/engine/engine.vcxproj b/src/engine/engine.vcxproj index 6d064a4..906792a 100644 --- a/src/engine/engine.vcxproj +++ b/src/engine/engine.vcxproj @@ -2,7 +2,6 @@ - @@ -42,10 +41,6 @@ - - $(ProjectDir)..\inc - - @@ -96,6 +91,10 @@ + + + + @@ -166,7 +165,6 @@ rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc" This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - diff --git a/src/engine/packages.config b/src/engine/packages.config index 98db4ce..04a6553 100644 --- a/src/engine/packages.config +++ b/src/engine/packages.config @@ -1,6 +1,5 @@  - \ No newline at end of file diff --git a/src/engine/precomp.h b/src/engine/precomp.h index 04dfa50..c60d7c0 100644 --- a/src/engine/precomp.h +++ b/src/engine/precomp.h @@ -61,10 +61,10 @@ #include #include -#include "BootstrapperEngine.h" -#include "BootstrapperApplication.h" -#include "BundleExtensionEngine.h" -#include "BundleExtension.h" +#include "..\WixToolset.BootstrapperCore.Native\inc\BootstrapperEngine.h" +#include "..\WixToolset.BootstrapperCore.Native\inc\BootstrapperApplication.h" +#include "..\WixToolset.BootstrapperCore.Native\inc\BundleExtensionEngine.h" +#include "..\WixToolset.BootstrapperCore.Native\inc\BundleExtension.h" #include "platform.h" #include "variant.h" diff --git a/src/test/BurnUnitTest/BurnUnitTest.vcxproj b/src/test/BurnUnitTest/BurnUnitTest.vcxproj index 3f3c7b4..eb2ec4e 100644 --- a/src/test/BurnUnitTest/BurnUnitTest.vcxproj +++ b/src/test/BurnUnitTest/BurnUnitTest.vcxproj @@ -4,7 +4,6 @@ - @@ -28,7 +27,7 @@ - ..\..\engine + ..\..\engine;..\..\WixToolset.BootstrapperCore.Native\inc cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wintrust.lib;gdiplus.lib @@ -81,7 +80,6 @@ - diff --git a/src/test/BurnUnitTest/packages.config b/src/test/BurnUnitTest/packages.config index 27527ed..24bfe34 100644 --- a/src/test/BurnUnitTest/packages.config +++ b/src/test/BurnUnitTest/packages.config @@ -9,6 +9,5 @@ - \ No newline at end of file