Skip to content

Commit

Permalink
Define more InterfaceIIDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaanstra committed Nov 5, 2023
1 parent 65aabe2 commit 0258835
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/WinRT.Runtime/ComWrappersSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ public static void MarshalDelegateInvoke<T>(IntPtr thisPtr, Action<T> invoke)
// This can either be if the object implements IAgileObject or the free threaded marshaler.
internal unsafe static bool IsFreeThreaded(IObjectReference objRef)
{
if (objRef.TryAs(ABI.WinRT.Interop.IAgileObject.IID, out var agilePtr) >= 0)
if (objRef.TryAs(InterfaceIIDs.IAgileObject_IID, out var agilePtr) >= 0)
{
Marshal.Release(agilePtr);
return true;
}
else if (objRef.TryAs(ABI.WinRT.Interop.IMarshal.IID, out var marshalPtr) >= 0)
else if (objRef.TryAs(InterfaceIIDs.IMarshal_IID, out var marshalPtr) >= 0)
{
try
{
Guid iid_IUnknown = IUnknownVftbl.IID;
Guid iid_IUnknown = InterfaceIIDs.IUnknown_IID;
Guid iid_unmarshalClass;
Marshal.ThrowExceptionForHR((**(ABI.WinRT.Interop.IMarshal.Vftbl**)marshalPtr).GetUnmarshalClass_0(
marshalPtr, &iid_IUnknown, IntPtr.Zero, MSHCTX.InProc, IntPtr.Zero, MSHLFLAGS.Normal, &iid_unmarshalClass));
Expand Down Expand Up @@ -229,7 +229,7 @@ internal static List<ComInterfaceEntry> GetInterfaceTableEntries(
Vtable = (IntPtr)ifaceAbiType.GetAbiToProjectionVftblPtr()
});

if (!hasCustomIMarshalInterface && iid == ABI.WinRT.Interop.IMarshal.IID)
if (!hasCustomIMarshalInterface && iid == InterfaceIIDs.IMarshal_IID)
{
hasCustomIMarshalInterface = true;
}
Expand Down Expand Up @@ -298,7 +298,7 @@ internal static List<ComInterfaceEntry> GetInterfaceTableEntries(

entries.Add(new ComInterfaceEntry
{
IID = ABI.WinRT.Interop.IWeakReferenceSource.IID,
IID = InterfaceIIDs.IWeakReferenceSource_IID,
Vtable = ABI.WinRT.Interop.IWeakReferenceSource.AbiToProjectionVftablePtr
});

Expand All @@ -308,15 +308,15 @@ internal static List<ComInterfaceEntry> GetInterfaceTableEntries(
{
entries.Add(new ComInterfaceEntry
{
IID = ABI.WinRT.Interop.IMarshal.IID,
IID = InterfaceIIDs.IMarshal_IID,
Vtable = ABI.WinRT.Interop.IMarshal.Vftbl.AbiToProjectionVftablePtr
});
}

// Add IAgileObject to all CCWs
entries.Add(new ComInterfaceEntry
{
IID = ABI.WinRT.Interop.IAgileObject.IID,
IID = InterfaceIIDs.IAgileObject_IID,
Vtable = IUnknownVftbl.AbiToProjectionVftblPtr
});

Expand All @@ -329,7 +329,7 @@ internal static List<ComInterfaceEntry> GetInterfaceTableEntries(
// This should be the last entry as it is included / excluded based on the flags.
entries.Add(new ComInterfaceEntry
{
IID = IUnknownVftbl.IID,
IID = InterfaceIIDs.IUnknown_IID,
Vtable = IUnknownVftbl.AbiToProjectionVftblPtr
});

Expand Down
2 changes: 1 addition & 1 deletion src/WinRT.Runtime/Interop/IAgileReference.net5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal interface IAgileReference
#endif
interface IAgileObject
{
public static readonly Guid IID = new(0x94ea2b94, 0xe9cc, 0x49e0, 0xc0, 0xff, 0xee, 0x64, 0xca, 0x8f, 0x5b, 0x90);
public static readonly Guid IID = InterfaceIIDs.IAgileObject_IID;
}

[WindowsRuntimeType]
Expand Down
2 changes: 1 addition & 1 deletion src/WinRT.Runtime/Interop/IContextCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace ABI.WinRT.Interop
[Guid("000001da-0000-0000-C000-000000000046")]
internal sealed unsafe class IContextCallback : global::WinRT.Interop.IContextCallback
{
internal static readonly Guid IID = new(0x000001da, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
internal static readonly Guid IID = InterfaceIIDs.IContextCallback_IID;

[Guid("000001da-0000-0000-C000-000000000046")]
public struct Vftbl
Expand Down
2 changes: 1 addition & 1 deletion src/WinRT.Runtime/Interop/IMarshal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace ABI.WinRT.Interop
[Guid("00000003-0000-0000-c000-000000000046")]
internal sealed class IMarshal
{
internal static readonly Guid IID = new(0x00000003, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46);
internal static readonly Guid IID = InterfaceIIDs.IMarshal_IID;

[DllImport("api-ms-win-core-com-l1-1-0.dll")]
private static extern int CoCreateFreeThreadedMarshaler(IntPtr outer, out IntPtr marshalerPtr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static int Do_Abi_GetWeakReference(IntPtr thisPtr, IntPtr* weakReference
}
}

internal static readonly Guid IID = new(0x00000038, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
internal static readonly Guid IID = InterfaceIIDs.IWeakReferenceSource_IID;
public static IntPtr AbiToProjectionVftablePtr => Vftbl.AbiToProjectionVftablePtr;
public static ObjectReference<Vftbl> FromAbi(IntPtr thisPtr) => ObjectReference<Vftbl>.FromAbi(thisPtr);

Expand Down

0 comments on commit 0258835

Please sign in to comment.