-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add VBS attribute and more debugging projects
- Loading branch information
Showing
10 changed files
with
243 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0-windows10.0.22621</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Windows.Internal.Flighting\Windows.Internal.Flighting.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Playground | ||
{ | ||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine(new Windows.Internal.Flighting.PlatformCTAC("WU_OS", "10.0.26058.1000").UriQuery); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Windows.Internal.Flighting | ||
{ | ||
internal class NativeMethods | ||
{ | ||
[DllImport("wincorlib.dll", CharSet = CharSet.Unicode, EntryPoint = "#129", SetLastError = true)] | ||
internal static extern int GetActivationFactoryByPCWSTR(string typeName, ref Guid typeGuid, out IntPtr ppOut); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Windows.Internal.Flighting | ||
{ | ||
public class PlatformCTAC : IEquatable<PlatformCTAC> | ||
{ | ||
private static ClientAttributes ClientAttributes; | ||
|
||
public string JSON | ||
{ | ||
get | ||
{ | ||
ThrowIfFailed(ClientAttributes.ToJsonString(out string value)); | ||
return value; | ||
} | ||
} | ||
|
||
public string UriQuery | ||
{ | ||
get | ||
{ | ||
ThrowIfFailed(ClientAttributes.ToUriQueryString(out string value)); | ||
return value; | ||
} | ||
} | ||
|
||
public readonly string ApplicationIdentifier; | ||
|
||
public readonly string ApplicationVersion; | ||
|
||
public IReadOnlyDictionary<string, int> AttributeErrors => ClientAttributes.AttributeErrors; | ||
|
||
public PlatformCTAC(string ApplicationIdentifier, string ApplicationVersion) | ||
{ | ||
this.ApplicationIdentifier = ApplicationIdentifier; | ||
this.ApplicationVersion = ApplicationVersion; | ||
|
||
ClientAttributes = GetCurrentClientAttributes(); | ||
} | ||
|
||
private ClientAttributes GetCurrentClientAttributes() | ||
{ | ||
return new ClientAttributes(ApplicationIdentifier, ApplicationVersion); | ||
} | ||
|
||
private static void ThrowIfFailed(int hResult) | ||
{ | ||
if (hResult < 0) | ||
{ | ||
Marshal.ThrowExceptionForHR(hResult); | ||
} | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
return Equals(obj as PlatformCTAC); | ||
} | ||
|
||
public bool Equals(PlatformCTAC other) | ||
{ | ||
return other is not null && | ||
JSON == other.JSON && | ||
UriQuery == other.UriQuery && | ||
EqualityComparer<IReadOnlyDictionary<string, int>>.Default.Equals(AttributeErrors, other.AttributeErrors); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
int hashCode = 1698843082; | ||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(JSON); | ||
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(UriQuery); | ||
hashCode = hashCode * -1521134295 + EqualityComparer<IReadOnlyDictionary<string, int>>.Default.GetHashCode(AttributeErrors); | ||
return hashCode; | ||
} | ||
|
||
public static bool operator ==(PlatformCTAC left, PlatformCTAC right) | ||
{ | ||
return EqualityComparer<PlatformCTAC>.Default.Equals(left, right); | ||
} | ||
|
||
public static bool operator !=(PlatformCTAC left, PlatformCTAC right) | ||
{ | ||
return !(left == right); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Windows.Internal.Flighting/Windows.Internal.Flighting.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0-windows10.0.22621.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Windows.Internal.Flighting"> | ||
<HintPath>..\..\winmds\Windows.Internal.Flighting.winmd</HintPath> | ||
<IsWinMDFile>true</IsWinMDFile> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<!--CsWinRT properties--> | ||
<PropertyGroup> | ||
<!--Specify namespaces to create a C# projection for--> | ||
<CsWinRTIncludes>Windows.Internal.Flighting</CsWinRTIncludes> | ||
<!--Set output path for generated source files/projection dll to OutDir (defined in Directory.Build.props)--> | ||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import "windowscontracts.idl"; | ||
import "Windows.Foundation.idl"; | ||
|
||
namespace Windows.Internal.Flighting | ||
{ | ||
[contractversion(1.0)] | ||
apicontract FlightingContract | ||
{ | ||
} | ||
|
||
[contract(Windows.Internal.Flighting.FlightingContract, 1.0)] | ||
[exclusiveto(Windows.Internal.Flighting.ClientAttributes)] | ||
[uuid(0723a53d-52e6-453b-9361-7826398f0111)] | ||
interface IClientAttributes : IInspectable | ||
{ | ||
Int32 ToJsonString(out String JsonString); | ||
Int32 ToUriQueryString(out String UriQueryString); | ||
Windows.Foundation.Collections.IMapView<String, Int32> AttributeErrors { get; }; | ||
} | ||
|
||
[contract(Windows.Internal.Flighting.FlightingContract, 1.0)] | ||
[exclusiveto(Windows.Internal.Flighting.ClientAttributes)] | ||
[uuid(41845433-1668-4264-8a63-315eb82ab0d6)] | ||
interface IClientAttributesFactory : IInspectable | ||
{ | ||
HRESULT GetClientAttributesForApp([in] HSTRING ApplicationId, [in] HSTRING ApplicationVersion, [out] [retval] Windows.Internal.Flighting.ClientAttributes** ClientAttributes); | ||
HRESULT GetClientAttributesFromList([in] Windows.Foundation.Collections.IIterable<HSTRING>* AttributeList, [out] [retval] Windows.Internal.Flighting.ClientAttributes** ClientAttributes); | ||
HRESULT GetClientAttributesForAppEx([in] HSTRING ApplicationId, [in] HSTRING ApplicationVersion, [in] INT32 ClientAttributeFlags, [out] [retval] Windows.Internal.Flighting.ClientAttributes** ClientAttributes); | ||
} | ||
|
||
[activatable(Windows.Internal.Flighting.IClientAttributesFactory, Windows.Internal.Flighting.FlightingContract, 1.0)] | ||
[contract(Windows.Internal.Flighting.FlightingContract, 1.0)] | ||
[marshaling_behavior(agile)] | ||
runtimeclass ClientAttributes | ||
{ | ||
[default] interface Windows.Internal.Flighting.IClientAttributes; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
midlrt Windows.Internal.Flighting.idl /metadata_dir "C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0\Windows.Foundation.FoundationContract\4.0.0.0" |