Skip to content

Commit

Permalink
Remove generated VftblPtr type
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Nov 26, 2023
1 parent 38a732b commit e185a67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/WinRT.Runtime/Interop/IUnknownVftbl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
using System;
using System.Runtime.InteropServices;

namespace WinRT
{
internal struct VftblPtr
{
public IntPtr Vftbl;
}
}

namespace WinRT.Interop
{
[Guid("00000000-0000-0000-C000-000000000046")]
Expand Down
4 changes: 1 addition & 3 deletions src/cswinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -6706,9 +6706,7 @@ internal IInspectable.Vftbl IInspectableVftbl;
w.write(R"(%
internal unsafe Vftbl(IntPtr thisPtr) : this()
{
var vftblPtr = Marshal.PtrToStructure<VftblPtr>(thisPtr);
var vftbl = (IntPtr*)vftblPtr.Vftbl;
IInspectableVftbl = Marshal.PtrToStructure<IInspectable.Vftbl>(vftblPtr.Vftbl);
IInspectableVftbl = *(IInspectable.Vftbl*)*(void***)thisPtr;
%}
)",
bind_each([&](writer& w, MethodDef const& method)
Expand Down
4 changes: 0 additions & 4 deletions src/cswinrt/strings/WinRT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,6 @@ internal static unsafe int RoGetAgileReference(uint options, ref Guid iid, IntPt
}
}

internal struct VftblPtr
{
public IntPtr Vftbl;
}
internal static partial class Context
{
[DllImport("api-ms-win-core-com-l1-1-0.dll")]
Expand Down

0 comments on commit e185a67

Please sign in to comment.