MddBootstrapInitialize function (mddbootstrap.h)

Initializes the calling process to use the version of the Windows App SDK framework package that best matches the specified criteria. This function is intended to be used by desktop apps that are not MSIX-packaged.

MddBootstrapInitialize2 offers usability and troubleshooting improvements over MddBootstrapInitialize.

Also see Constants.

Syntax

HRESULT MddBootstrapInitialize(
  UINT32          majorMinorVersion,
  PCWSTR          versionTag,
  PACKAGE_VERSION minVersion
) noexcept;

Parameters

majorMinorVersion

Type: UINT32

The major and minor version of the Windows App SDK product to load (e.g. 1.0). The version is encoded as 0xMMMMNNNN, where M = Major and N = Minor (for example, version 1.2 should be encoded as 0x00010002).

versionTag

Type: PCWSTR

The version tag of the Windows App SDK framework package to load (if any). For example, "prerelease".

minVersion

Type: PACKAGE_VERSION

The minimum version of the Windows App SDK runtime package to use. Note that this version (e.g. 0.319.455) is different than the Windows App SDK release version (e.g. 1.0.2) and product version (e.g. 1.0).

The Windows App SDK runtime version values can be obtained from the C++ header WindowsAppSDK-VersionInfo.h, see Example for more details.

Return value

Type: HRESULT

If the function succeeds it returns ERROR_SUCCESS. Otherwise, the function returns an error code.

Remarks

Any errors are logged to the EventLog's Application channel.

You can call this function multiple times provided that the parameters are compatible. The first call does the work to resolve a Framework package; subsequent calls are a no-op provided that the parameters are compatible with the Framework package resolved by the first call. If subsequent calls' parameters are not compatible, then the API fails and returns an error.

This function finds a Windows App SDK framework package that meets the specified criteria and makes the package available for use by the current process. If multiple packages meet the criteria, this function selects the best candidate.

This function must be called at startup before calling any other Windows App SDK APIs to ensure the bootstrapper component can properly initialize the Windows App SDK and add the runtime reference to the framework package.

This function also initializes the Dynamic Dependency Lifetime Manager (DDLM). The DDLM provides infrastructure to prevent the operating system (OS) from servicing the Windows App SDK framework package while it's being used by an unpackaged app.

Also see Use the Windows App SDK runtime for non-MSIX-packaged apps.

Note

COM must be initialized for the current thread before you call this function.

Note

For this API to succeed in an unpackaged app, it's necessary for the Windows App SDK packages to be installed on the device (see the Prerequisites section in Tutorial—Use the bootstrapper API in a non-MSIX-packaged app that uses the Windows App SDK).

Example

Using C:

#include <WindowsAppSDK-VersionInfo.h>
#include <MddBootstrap.h>
// ...

HRESULT hr = MddBootstrapInitialize(WINDOWSAPPSDK_RELEASE_MAJORMINOR, WINDOWSAPPSDK_RELEASE_VERSION_TAG_W, WINDOWSAPPSDK_RUNTIME_VERSION_UINT64);
if (FAILED(hr))
{
    wprintf(L"Error 0x%X in Bootstrap initialization\n", hr);
}

Using C++:

#include <WindowsAppSDK-VersionInfo.h>
#include <MddBootstrap.h>
// ...

if (FAILED(MddBootstrapInitialize(Microsoft::WindowsAppSDK::Release::MajorMinor, Microsoft::WindowsAppSDK::Release::VersionTag, Microsoft::WindowsAppSDK::Runtime::UInt64))) {
    throw std::exception("Error in Bootstrap initialization");
}

Requirements

   
Minimum supported client Windows 10, version 1809 (with Windows App SDK 1.0 Preview 1 or later)
Header mddbootstrap.h
Library Microsoft.WindowsAppRuntime.Bootstrap.lib
DLL Microsoft.WindowsAppRuntime.Bootstrap.dll

See also