Skip to content
Merged
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
2 changes: 1 addition & 1 deletion build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ steps:
condition: and(succeeded(), and(eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release')))
continueOnError: True
inputs:
SourceFolder: $(Build.SourcesDirectory)\src\_build\$(BuildPlatform)\$(BuildConfiguration)\cswinrt\bin
SourceFolder: $(Build.SourcesDirectory)\src\WinRT.Internal\bin\$(BuildConfiguration)\net10.0-windows10.0.26100.1
Contents: WindowsRuntime.Internal.winmd
TargetFolder: $(StagingFolder)\native

Expand Down
26 changes: 25 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,37 @@
<PropertyGroup>
<VersionNumber Condition="'$(VersionNumber)'==''">0.0.0.0</VersionNumber>
<VersionString Condition="'$(VersionString)'==''">0.0.0-private.0</VersionString>

<!--
Default 'AssemblyVersionNumber' to '3.0.0.0' (the 'WinRT.Runtime' CsWinRT 3.0 baseline) so
that 'dotnet build' from the repo root works without explicit '/p:AssemblyVersionNumber=...'.
Official builds set this explicitly via the 'CsWinRT-Variables' pipeline.
-->
<AssemblyVersionNumber Condition="'$(AssemblyVersionNumber)' == ''">3.0.0.0</AssemblyVersionNumber>
<BuildPlatform>$(Platform)</BuildPlatform>
<BuildPlatform Condition="'$(Platform)'=='Win32'">x86</BuildPlatform>
<BuildOutDir Condition="'$(BuildOutDir)'==''">$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)_build', '$(BuildPlatform)', '$(Configuration)'))</BuildOutDir>

<!--
Legacy 'cswinrt' (C++) build-output paths. These are kept defined so existing
MSBuild infrastructure (e.g. the '$(CsWinRTExe)' argument still passed to the
'RunCsWinRTMergedProjectionGenerator' MSBuild task) continues to resolve to a path
string. The .exe file itself is no longer required to exist or to be built. The C#
'cswinrtprojectiongen.exe' tool only stores this value as metadata and never
reads or executes the file. It will be removed entirely once the legacy 'cswinrt'
project is dropped.
-->
<CsWinRTPath>$([MSBuild]::NormalizeDirectory('$(BuildOutDir)', 'cswinrt', 'bin'))</CsWinRTPath>
<CsWinRTPath Condition="'$(Platform)'=='ARM' or '$(Platform)'=='ARM64'">$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)_build', 'x86', '$(Configuration)', 'cswinrt', 'bin'))</CsWinRTPath>
<CsWinRTExe>$(CsWinRTPath)cswinrt.exe</CsWinRTExe>
<CsWinRTInteropMetadata Condition="'$(CsWinRTInteropMetadata)' == ''">$(CsWinRTPath)WindowsRuntime.Internal.winmd</CsWinRTInteropMetadata>

<!--
The 'WindowsRuntime.Internal.winmd' metadata used to bind the Windows SDK interop
interfaces (e.g. 'IPrintManagerInterop', 'IDragDropManagerInterop') is produced by
the managed 'WinRT.Internal' project, which targets the TFM below.
-->
<CsWinRTInternalTargetFramework Condition="'$(CsWinRTInternalTargetFramework)' == ''">net10.0-windows10.0.26100.1</CsWinRTInternalTargetFramework>
<CsWinRTInteropMetadata Condition="'$(CsWinRTInteropMetadata)' == ''">$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', 'WinRT.Internal', 'bin', '$(Configuration)', '$(CsWinRTInternalTargetFramework)', 'WindowsRuntime.Internal.winmd'))</CsWinRTInteropMetadata>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.vcxproj' or '$(MSBuildProjectExtension)' == '.wapproj'">
Expand Down
24 changes: 24 additions & 0 deletions src/WinRT.Internal/HWND.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#pragma warning disable IDE1006

namespace WindowsRuntime.Internal;

/// <summary>
/// Windows Runtime metadata representation of the Win32 <c>HWND</c> type.
/// </summary>
/// <remarks>
/// CsWinRT applies a custom mapping that projects <see cref="HWND"/> to <see cref="nint"/>
/// in generated C# code, so that interop methods on the runtime classes appear with normal handle
/// parameters. The <see cref="__Reserved"/> field exists only to give the struct a representable layout
/// in the Windows Runtime type system.
/// </remarks>
/// <see href="https://learn.microsoft.com/windows/win32/winprog/windows-data-types"/>
public struct HWND
{
/// <summary>
/// Reserved field. Not used by callers: the type is mapped to <see cref="nint"/> at the projection layer.
/// </summary>
public int __Reserved;
}
41 changes: 41 additions & 0 deletions src/WinRT.Internal/IAccountsSettingsPaneInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.Foundation;
using Windows.UI.ApplicationSettings;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving an <see cref="AccountsSettingsPane"/> bound to a Win32 window.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/accountssettingspaneinterop/">accountssettingspaneinterop.idl</see>.
/// </remarks>
[ProjectionInternal]
[Guid("D3EE12AD-3865-4362-9746-B75A682DF0E6")]
public interface IAccountsSettingsPaneInterop
{
/// <summary>
/// Gets the <see cref="AccountsSettingsPane"/> associated with the specified window.
/// </summary>
AccountsSettingsPane GetForWindow(
HWND appWindow,
ref Guid riid);

/// <summary>
/// Shows the manage-accounts UI for the specified window.
/// </summary>
IAsyncAction ShowManageAccountsForWindowAsync(
HWND appWindow,
ref Guid riid);

/// <summary>
/// Shows the add-account UI for the specified window.
/// </summary>
IAsyncAction ShowAddAccountForWindowAsync(
HWND appWindow,
ref Guid riid);
}
33 changes: 33 additions & 0 deletions src/WinRT.Internal/IDisplayInformationStaticsInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.Graphics.Display;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving <see cref="DisplayInformation"/> bound to a Win32 window or monitor handle.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/windows.graphics.display.interop/">WindowsGraphicsDisplayInterop.idl</see>.
/// </remarks>
[ProjectionInternal]
[Guid("7449121C-382B-4705-8DA7-A795BA482013")]
public interface IDisplayInformationStaticsInterop
{
/// <summary>
/// Gets the <see cref="DisplayInformation"/> associated with the specified window.
/// </summary>
DisplayInformation GetForWindow(
HWND window,
ref Guid riid);

/// <summary>
/// Gets the <see cref="DisplayInformation"/> associated with the specified monitor.
/// </summary>
DisplayInformation GetForMonitor(
HWND monitor,
ref Guid riid);
}
26 changes: 26 additions & 0 deletions src/WinRT.Internal/IDragDropManagerInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.ApplicationModel.DataTransfer.DragDrop.Core;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving a <see cref="CoreDragDropManager"/> bound to a Win32 window.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/dragdropinterop/">dragdropinterop.idl</see>.
/// </remarks>
[ProjectionInternal]
[Guid("5AD8CBA7-4C01-4DAC-9074-827894292D63")]
public interface IDragDropManagerInterop
{
/// <summary>
/// Gets the <see cref="CoreDragDropManager"/> associated with the specified window.
/// </summary>
CoreDragDropManager GetForWindow(
HWND hwnd,
ref Guid riid);
}
26 changes: 26 additions & 0 deletions src/WinRT.Internal/IInputPaneInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.UI.ViewManagement;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving an <see cref="InputPane"/> bound to a Win32 window.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/inputpaneinterop/">inputpaneinterop.idl</see>.
/// </remarks>
[ProjectionInternal]
[Guid("75CF2C57-9195-4931-8332-F0B409E916AF")]
public interface IInputPaneInterop
{
/// <summary>
/// Gets the <see cref="InputPane"/> associated with the specified window.
/// </summary>
InputPane GetForWindow(
HWND appWindow,
ref Guid riid);
}
32 changes: 32 additions & 0 deletions src/WinRT.Internal/IPlayToManagerInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.Media.PlayTo;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving a <see cref="PlayToManager"/> bound to a Win32 window.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/playtomanagerinterop/">PlayToManagerInterop.idl</see>.
/// </remarks>
[ProjectionInternal]
[Guid("24394699-1F2C-4EB3-8CD7-0EC1DA42A540")]
public interface IPlayToManagerInterop
{
/// <summary>
/// Gets the <see cref="PlayToManager"/> associated with the specified window.
/// </summary>
PlayToManager GetForWindow(
HWND appWindow,
ref Guid riid);

/// <summary>
/// Shows the Play To UI for the specified window.
/// </summary>
void ShowPlayToUIForWindow(
HWND appWindow);
}
34 changes: 34 additions & 0 deletions src/WinRT.Internal/IPrintManagerInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.Foundation;
using Windows.Graphics.Printing;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving a <see cref="PrintManager"/> bound to a Win32 window.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/printmanagerinterop/">PrintManagerInterop.idl</see>.
/// </remarks>
[ProjectionInternal]
[Guid("C5435A42-8D43-4E7B-A68A-EF311E392087")]
public interface IPrintManagerInterop
{
/// <summary>
/// Gets the <see cref="PrintManager"/> associated with the specified window.
/// </summary>
PrintManager GetForWindow(
HWND appWindow,
ref Guid riid);

/// <summary>
/// Shows the print UI for the specified window.
/// </summary>
IAsyncOperation<bool> ShowPrintUIForWindowAsync(
HWND appWindow,
ref Guid riid);
}
23 changes: 23 additions & 0 deletions src/WinRT.Internal/IRadialControllerConfigurationInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.UI.Input;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving a <see cref="RadialControllerConfiguration"/> bound to a Win32 window.
/// </summary>
[ProjectionInternal]
[Guid("787CDAAC-3186-476D-87E4-B9374A7B9970")]
public interface IRadialControllerConfigurationInterop
{
/// <summary>
/// Gets the <see cref="RadialControllerConfiguration"/> associated with the specified window.
/// </summary>
RadialControllerConfiguration GetForWindow(
HWND hwnd,
ref Guid riid);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.UI.Input.Core;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for creating a <see cref="RadialControllerIndependentInputSource"/> bound to a Win32 window.
/// </summary>
[ProjectionInternal]
[Guid("3D577EFF-4CEE-11E6-B535-001BDC06AB3B")]
public interface IRadialControllerIndependentInputSourceInterop
{
/// <summary>
/// Creates a <see cref="RadialControllerIndependentInputSource"/> for the specified window.
/// </summary>
RadialControllerIndependentInputSource CreateForWindow(
HWND hwnd,
ref Guid riid);
}
26 changes: 26 additions & 0 deletions src/WinRT.Internal/IRadialControllerInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.UI.Input;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for creating a <see cref="RadialController"/> bound to a Win32 window.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/radialcontrollerinterop/">RadialControllerInterop.idl</see>.
/// </remarks>
[ProjectionInternal]
[Guid("1B0535C9-57AD-45C1-9D79-AD5C34360513")]
public interface IRadialControllerInterop
{
/// <summary>
/// Creates a <see cref="RadialController"/> for the specified window.
/// </summary>
RadialController CreateForWindow(
HWND hwnd,
ref Guid riid);
}
27 changes: 27 additions & 0 deletions src/WinRT.Internal/ISpatialInteractionManagerInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Runtime.InteropServices;
using Windows.UI.Input.Spatial;

namespace WindowsRuntime.Internal;

/// <summary>
/// COM interop interface for retrieving a <see cref="SpatialInteractionManager"/> bound to a Win32 window.
/// </summary>
/// <remarks>
/// See <see href="https://learn.microsoft.com/windows/win32/api/spatialinteractionmanagerinterop/">SpatialInteractionManagerInterop.idl</see>.
/// This interop interface is duplicated by <c>IHolographicSpaceInterop</c>, which has the same IID.
/// </remarks>
[ProjectionInternal]
[Guid("5C4EE536-6A98-4B86-A170-587013D6FD4B")]
public interface ISpatialInteractionManagerInterop
{
/// <summary>
/// Gets the <see cref="SpatialInteractionManager"/> associated with the specified window.
/// </summary>
SpatialInteractionManager GetForWindow(
HWND window,
ref Guid riid);
}
Loading