Search code examples
c++delphiterminal-services

I'm a bit stuck with Dynamic Virtual Channels in Delphi


I'm in the process of converting code for Dynamic Virtual Channels in RDS (aka Terminal services) from C++ to Delphi based on the https://github.com/earthquake/UniversalDVC/tree/master/UDVC-Plugin in C++. This requires several classes for registering the client plugin and I found definitions in tsvirtualchannels.h and .idl on my Windows system at C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um .

Unfortunately the .idl file does not contain a type library, so I couldn't build a type library .tlb file and import that so I've been recreating it manually in Delphi.

Embarcadero use a .ridl file, similar but not quite the same as idl files. One of the attributes in the .idl file is cpp_quote("string"). For example

cpp_quote("EXTERN_C __declspec(selectany) const IID IID_IWTSListenerCallback = {0xA1230203, 0xd6a7, 0x11d8, {0xb9, 0xfd, 0x00, 0x0b, 0xdb, 0xd1, 0xf1, 0x98}};")
[
object,
uuid(A1230203-d6a7-11d8-b9fd-000bdbd1f198),
oleautomation,
helpstring("interface IWTSListenerCallback")

]
interface IWTSListenerCallback : IUnknown    

Ridl doesn't support cpp_quote, so I'm unsure how to deal with these.


Solution

  • midl.exe (from Windows SDK) should be able to generate a tlb from the idl file.

    If there's no library definition in the idl file, you can add one yourself, as explained by Hans Passant in his answer to this question.