C#C
C#2y ago
jborean

✅ COM + NativeAOT Help

I'm fairly new to COM and I'm trying to implement an RDP Dynamic Virtual Channel client dll which uses the IWTSPlugin COM interface https://learn.microsoft.com/en-us/windows/win32/api/tsvirtualchannels/nn-tsvirtualchannels-iwtsplugin. Can anyone point out what I might be doing wrong here https://gist.github.com/jborean93/394592c89fc8bfd54990d814a29b924f as this just crashes my process and the WTSPlugin-log.txt is never created.

I'm not 100% confident on how I'm setting the COM pointer on the VirtualChannelGetInstance implementation but I know for sure that mstsc is calling that particular method it as the logs are showing that it is called and the process crashes because I am doing something dumb.

I do have a few other questions that hopefully someone might be able to clarify

  • Do I need to save the WTSPlugin and StrategyBasedComWrappers instance or can they be discarded once I've passed the pointer to the unmanaged instance
  • What is the correct way to define another COM interface (pointer to the interface type in COM land) as an argument
  • Are there any recommendations for PreserveSig or not having it
Gist
GitHub Gist: instantly share code, notes, and snippets.
Was this page helpful?