0
votes

This is in Delphi XE7. I had an existing type library (for Dynamic Virtual Channels- the client side) and needed to add a method to the interface so an application on the client side could talk to the dll to send messages over the virtual channel. I created a new interface, got a new GUI for it, modified the .idl file (Windows SDK provides the tsvirtualchannels.idl file in the Windows SDK).

I used midl to create the .tlb type library from the .idl and then ran tlibimp (Embarcadero utility) to generate the delphi -tlb.pas

My Delphi class implements the new method. But the new interface wasn't registered with Windows and all attempts using the Embarcadero tregsvr (running in an elevated command prompt) to register the library failed with the message Error accessing the OLE registry

I have tried to register the new interface manually. I'd created my interface similar to IWTSListener and went through the registry finding that key, exporting it, then changing the interface name to mine and the GUID to the new GUID then reimported it. There were four instances.

When the client dll starts, it starts an out of process server and passes it the Agile Reference (of the client dll interface. An agile reference is how a MTA application can talk to an STA). However when I query the interface to get my new interface, I get interface not supported.

I've more or less given up on tregsvr. It provides no details of errors. Is there anything else I need to do to get the new interface registered?

It occurred to me there are one or two things that could prevent this course of action working:

  1. I haven't changed the dll main interface IWTSPlugin to IWTSPlugin2. Would Windows (i.e. mstsc) use IWTSPLUGIN2 for Virtual channels? Adding a new interface to this and not changing it is a mortal sin (I know- mea culpa).
1
InnoSetup has a regtypelib parameter in the Files section for that: jrsoftware.org/ishelp/index.php?topic=filessection - Uwe Raabe
There is also a Windows function for that: docs.microsoft.com/en-us/windows/win32/api/oleauto/… - Uwe Raabe
Are you running with an elevated command prompt when using those utilities? - Joseph Willcoxson
Uwe, I missed that function call for registering the TypeLibrary Thanks!. I'll try that. it might give me a clue as to what's failing, unlike tregsvr! Joseph. Yes. - David Bolton
I managed to get hold of the source code to tregsvr and debugged it. It's the call to the Windows function "RegisterTypeLib that is failing with the Registry access error. - David Bolton

1 Answers

0
votes

I resolved this eventually. The powers that be had added a policy to Windows so that tregsvr would not register a type library for all users, only if it had the -t -c parameters to register it for the current user. Lots of muttering was heard when I found it out...