✅ 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 it21 Replies
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
i would prefer using ComInterfaceMarshaller<IWTSPlugin>.ConvertToUnmanaged over instantiating the StrategyBasedComWrappers yourself
If it helps I'm compiling it for
win-x64
with
that doesn't change much, it's just a little cleaner and more efficient
i would also skip the PreserveSig, it's just more work
I'm assuming if I don't have
PreserveSig
it's just a void
return here as none of those functions have an out return valueyea
Thanks for the hint on
ComInterfaceMarshaller
, I'll start using thatwhere exactly do your logs say you get to
because at a first glance everything seems OK
only the
VirtualChannelGetInstance
is created
the WTSPlugin-log.txt
is not created which tells me it's failing to call Initialize()
how do you know it's crashing
the whole mstsc process crashes and I have an WER event log
I think I've got it working
Used
ConvertToUnmanaged
and played around with the ppObjArray
signaturei mean that looks the same, but if it works it works
you're telling me 🙂
idk i couldn't tell that anything was wrong
I'm assuming I messed up my
ppObjArray
signature and setting that value somehow
but as you said if it works it works
Do I need to keep the WTSPlugin
instance alive as a static field or can it be dropped after providing the pointer to it?it can be dropped
Thanks for the advice!
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
Use the /close command to mark a forum thread as answered
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
As sorry I wasn’t aware that was a thing here 🙂