Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 38 additions & 11 deletions inc/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Producing the Projection Headers

Current projection packages:

* [Microsoft.WindowsAppSDK.ML v1.8.2091](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.ML/1.8.2091)
* [Microsoft.WindowsAppSDK.Runtime v1.8.250916003](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.Runtime/1.8.250916003)
Current projection packages, for [Microsoft.WindowsAppSDK v1.8.251106002](https://www.nuget.org/packages/Microsoft.WindowsAppSDK/1.8.251106002):
* [Microsoft.WindowsAppSDK.InteractiveExperiences v1.8.251104001](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.InteractiveExperiences/1.8.251104001)
* [Microsoft.WindowsAppSDK.Foundation v1.8.251104000](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.Foundation/1.8.251104000)
* [Microsoft.WindowsAppSDK.AI v1.8.39](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.AI/1.8.39)
* [Microsoft.WindowsAppSDK.ML v1.8.2109](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.ML/1.8.2109)
* [Microsoft.WindowsAppSDK.Runtime v1.8.251106002](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.Runtime/1.8.251106002)

## Acquire Tooling

Expand All @@ -24,12 +26,22 @@ nuget install Microsoft.Windows.AbiWinRT -OutputDirectory $working_dir\packages

## Acquire metadata from latest release

Fetch the package from nuget using the above package names:
Fetch component packages from nuget using the above package names:

```pwsh
$ml_version = "1.8.2091"
$runtime_version = "1.8.250916003"
$ixp_version = "1.8.251104001"
nuget install Microsoft.WindowsAppSDK.InteractiveExperiences -Version $ixp_version -OutputDirectory $working_dir\packages

$foundation_version = "1.8.251104000"
nuget install Microsoft.WindowsAppSDK.Foundation -Version $foundation_version -OutputDirectory $working_dir\packages

$ai_version = "1.8.39"
nuget install Microsoft.WindowsAppSDK.AI -Version $ai_version -OutputDirectory $working_dir\packages

$ml_version = "1.8.2109"
nuget install Microsoft.WindowsAppSDK.ML -Version $ml_version -OutputDirectory $working_dir\packages

$runtime_version = "1.8.251106002"
nuget install Microsoft.WindowsAppSDK.Runtime -Version $runtime_version -OutputDirectory $working_dir\packages
```

Expand All @@ -41,11 +53,26 @@ File a new issue to request inclusion of other content.
From the root of the repo:

```pwsh
# Generate WinML projections, copy headers (replace inc\abi\winml with inc\abi\othercomponent as needed)
mkdir inc\abi\winml -ErrorAction SilentlyContinue
# Generate and copy projection headers for a selection of components
$abiwinrt = gci -r $working_dir\packages\*abi*\abi.exe
$metadata = gci -r $working_dir\packages\microsoft.windowsappsdk.ml.$ml_version\metadata
& $abiwinrt -input $metadata -reference sdk -output inc\abi\winml -lowercase-include-guard -ns-prefix always

mkdir inc\abi\interactiveexperiences -ErrorAction SilentlyContinue
$ixp_metadata = gci -r "$working_dir\packages\microsoft.windowsappsdk.interactiveexperiences.$ixp_version\metadata\10.0.17763.0\*.winmd"
& $abiwinrt -input $ixp_metadata.FullName -reference sdk -output inc\abi\interactiveexperiences -lowercase-include-guard -ns-prefix always
copy $working_dir\packages\microsoft.windowsappsdk.interactiveexperiences.$ixp_version\include\* inc\abi\interactiveexperiences -recurse -force

mkdir inc\abi\foundation -ErrorAction SilentlyContinue
$foundation_metadata = gci -r "$working_dir\packages\microsoft.windowsappsdk.foundation.$foundation_version\metadata\*.winmd"
& $abiwinrt -input $foundation_metadata.FullName -reference sdk $ixp_metadata.FullName -output inc\abi\foundation -lowercase-include-guard -ns-prefix always
copy $working_dir\packages\microsoft.windowsappsdk.foundation.$foundation_version\include\* inc\abi\foundation -recurse -force

mkdir inc\abi\winai -ErrorAction SilentlyContinue
$ai_metadata = gci -r "$working_dir\packages\microsoft.windowsappsdk.ai.$ai_version\metadata\*.winmd"
& $abiwinrt -input $ai_metadata.FullName -reference sdk -output inc\abi\winai -lowercase-include-guard -ns-prefix always

mkdir inc\abi\winml -ErrorAction SilentlyContinue
$ml_metadata = gci -r "$working_dir\packages\microsoft.windowsappsdk.ml.$ml_version\metadata\*.winmd"
& $abiwinrt -input $ml_metadata.FullName -reference sdk -output inc\abi\winml -lowercase-include-guard -ns-prefix always
copy $working_dir\packages\microsoft.windowsappsdk.ml.$ml_version\include\* inc\abi\winml -recurse -force

# Copy common runtime headers
Expand Down
58 changes: 58 additions & 0 deletions inc/abi/foundation/DeploymentManagerAutoInitializer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#include <Windows.h>
#include <stdlib.h>

#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>

#include <winrt/Windows.Management.Deployment.h>
#include <winrt/Windows.System.h>
#include <winrt/Microsoft.Windows.ApplicationModel.WindowsAppRuntime.h>

// If any options are defined use them, else use the default
#if !defined(MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT)
// Default isn't defined. Define it if no options are defined
#if defined(MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_NONE)
#elif defined(MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERRORSHOWUI)
#else
// No options specified! Use the default
#define MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT
#endif
#endif

namespace Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentManager
{
namespace AutoInitialize
{
static ::winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentInitializeOptions Options()
{
::winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentInitializeOptions options;
#if defined(MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT)
// Use the default options
options.OnErrorShowUI(true);
#elif defined(MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_NONE)
// No options!
#else
// Use the specified options
#if defined(MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERRORSHOWUI)
options.OnErrorShowUI(true);
#endif
#endif
return options;
}

// Called by WindowsAppRuntimeAutoInitializer.cpp
void Initialize()
{
auto options{ Options() };
auto deploymentResult{ ::winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentManager::Initialize(options) };
if (deploymentResult.Status() != ::winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::DeploymentStatus::Ok)
{
const HRESULT hr{ deploymentResult.ExtendedError().value };
exit(hr);
}
}
};
}
60 changes: 60 additions & 0 deletions inc/abi/foundation/DeploymentManagerAutoInitializer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License. See LICENSE in the project root for license information.

// <auto-generated>
// Exclude this file from StyleCop analysis. This file isn't generated but is added to projects.
// DO NOT MODIFY. Changes to this file may cause incorrect behavior and will be lost on updates.
// </auto-generated>

// If any options are defined use them, else use the default
#if !MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT
// Default isn't defined. Define it if no options are defined
#if MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_NONE
#elif MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERRORSHOWUI
#else
// No options specified! Use the default
#define MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT
#endif
#endif

using System.Reflection;
using System.Runtime.InteropServices;

namespace Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManagerCS
{
class AutoInitialize
{
// Called by WindowsAppRuntimeAutoInitializer.cs
internal static void AccessWindowsAppSDK()
{
var options = Options;
global::Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentResult deploymentResult = global::Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManager.Initialize(options);
if (deploymentResult.Status != global::Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentStatus.Ok)
{
int hr = deploymentResult.ExtendedError.HResult;
global::System.Environment.Exit(hr);
global::System.Environment.FailFast("WindowsAppRuntime.DeploymentManager.Initialize error 0x{hr:X}");
}
}

internal static global::Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions Options
{
get
{
var options = new global::Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions();
#if MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_DEFAULT
// Use the default options
options.OnErrorShowUI = true;
#elif MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_NONE
// No options!
#else
// Use the specified options
#if MICROSOFT_WINDOWSAPPSDK_DEPLOYMENTMANAGER_AUTO_INITIALIZE_OPTIONS_ONERRORSHOWUI
options.OnErrorShowUI = true;
#endif
#endif
return options;
}
}
}
}
133 changes: 133 additions & 0 deletions inc/abi/foundation/MRM.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#ifdef __cplusplus
extern "C"
{
#endif

DECLARE_HANDLE(MrmManagerHandle);
DECLARE_HANDLE(MrmContextHandle);
DECLARE_HANDLE(MrmMapHandle);

enum MrmType
{
MrmType_Unknown,
MrmType_String,
MrmType_Path,
MrmType_Embedded
};

struct MrmResourceData
{
UINT32 size;
void* data;
};

STDAPI MrmCreateResourceManager(_In_ PCWSTR priFileName, _Out_ MrmManagerHandle* resourceManager);
STDAPI_(void) MrmDestroyResourceManager(_In_opt_ MrmManagerHandle resourceManager);

STDAPI MrmCreateResourceContext(_In_ MrmManagerHandle resourceManager, _Out_ MrmContextHandle* resourceContext);
STDAPI_(void) MrmFreeQualifierNamesOrValues(UINT32 size, _In_reads_(size) PWSTR* names);
STDAPI MrmGetAllQualifierNames(_In_ MrmContextHandle resourceContext, _Out_ UINT32* size, _Outptr_result_buffer_(*size) PWSTR** names);
STDAPI MrmGetQualifier(_In_ MrmContextHandle resourceContext, _In_ PCWSTR qualifierName, _Outptr_ PWSTR* qualifierValue);
STDAPI MrmSetQualifier(_In_ MrmContextHandle resourceContext, _In_ PCWSTR qualifierName, _In_ PCWSTR qualifierValue);
STDAPI_(void) MrmDestroyResourceContext(_In_opt_ MrmContextHandle resourceContext);

// Resource maps are owned by the resource manager and so do not need to be destroyed.
STDAPI MrmGetChildResourceMap(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmMapHandle resourceMap,
_In_ PCWSTR childResourceMapName,
_Out_ MrmMapHandle* childResourceMap);

STDAPI MrmGetResourceCount(_In_ MrmManagerHandle resourceManager, _In_opt_ MrmMapHandle resourceMap, _Out_ UINT32* count);

STDAPI MrmLoadStringResource(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_opt_ MrmMapHandle resourceMap,
_In_ PCWSTR resourceId,
_Outptr_ PWSTR* resourceString);

STDAPI MrmLoadStringResourceFromResourceUri(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_ PCWSTR resourceUri,
_Outptr_ PWSTR* resourceString);

STDAPI MrmLoadEmbeddedResource(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_opt_ MrmMapHandle resourceMap,
_In_ PCWSTR resourceId,
_Out_ MrmResourceData* data);

STDAPI MrmLoadEmbeddedResourceFromResourceUri(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_ PCWSTR resourceUri,
_Out_ MrmResourceData* data);

STDAPI MrmLoadStringOrEmbeddedResource(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_opt_ MrmMapHandle resourceMap,
_In_ PCWSTR resourceId,
_Out_ MrmType* resourceType,
_Outptr_result_maybenull_ PWSTR* resourceString,
_Out_ MrmResourceData* data);

STDAPI MrmLoadStringOrEmbeddedResourceWithQualifierValues(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_opt_ MrmMapHandle resourceMap,
_In_ PCWSTR resourceId,
_Out_ MrmType* resourceType,
_Outptr_result_maybenull_ PWSTR* resourceString,
_Out_ MrmResourceData* data,
_Out_ UINT32* qualifierCount,
_Outptr_result_buffer_(*qualifierCount) PWSTR** qualifierNames,
_Outptr_result_buffer_(*qualifierCount) PWSTR** qualifierValues);

STDAPI MrmLoadStringOrEmbeddedFromResourceUri(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_ PCWSTR resourceUri,
_Out_ MrmType* resourceType,
_Outptr_result_maybenull_ PWSTR* resourceString,
_Out_ MrmResourceData* data);

STDAPI MrmLoadStringOrEmbeddedResourceByIndex(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_opt_ MrmMapHandle resourceMap,
UINT32 index,
_Out_ MrmType* resourceType,
_Outptr_ PWSTR* resourceName,
_Outptr_result_maybenull_ PWSTR* resourceString,
_Out_ MrmResourceData* data);

STDAPI MrmLoadStringOrEmbeddedResourceByIndexWithQualifierValues(
_In_ MrmManagerHandle resourceManager,
_In_opt_ MrmContextHandle resourceContext,
_In_opt_ MrmMapHandle resourceMap,
UINT32 index,
_Out_ MrmType* resourceType,
_Outptr_ PWSTR* resourceName,
_Outptr_result_maybenull_ PWSTR* resourceString,
_Out_ MrmResourceData* data,
_Out_ UINT32* qualifierCount,
_Outptr_result_buffer_(*qualifierCount) PWSTR** qualifierNames,
_Outptr_result_buffer_(*qualifierCount) PWSTR** qualifierValues);

STDAPI_(void*) MrmAllocateBuffer(size_t size);
STDAPI_(void) MrmFreeResource(_In_opt_ void* resource);

STDAPI MrmGetFilePathFromName(_In_opt_ PCWSTR filename, _Outptr_ PWSTR* filePath);

#ifdef __cplusplus
}
#endif
Loading