79355253

Date: 2025-01-14 14:04:29
Score: 1.5
Natty:
Report link

Thanks to @HansPassant, here are the registry keys and values required for serving a single class with a single interface from a C# Windows Service called MyService:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\TypeLib\{TlbGuid}]
@=""

[HKEY_CLASSES_ROOT\TypeLib\{TlbGuid}\1.0]
@="MyService"

[HKEY_CLASSES_ROOT\TypeLib\{TlbGuid}\1.0\0]

[HKEY_CLASSES_ROOT\TypeLib\{TlbGuid}\1.0\0\win64]
@="C:\\path\\to\\MyService.tlb"

[HKEY_CLASSES_ROOT\TypeLib\{TlbGuid}\1.0\FLAGS]
@="0"

[HKEY_CLASSES_ROOT\Interface\{InterfaceGuid}]
@="IMyInterface"

[HKEY_CLASSES_ROOT\Interface\{InterfaceGuid}\ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\Interface\{InterfaceGuid}\TypeLib]
@="{TlbGuid}"
"Version"="1.0"

[HKEY_CLASSES_ROOT\CLSID\{ClassGuid}]
@="My class name"
"AppID"="{AppIdOrGuid}"

[HKEY_CLASSES_ROOT\CLSID\{ClassGuid}\Version]
@="1.0"

[HKEY_CLASSES_ROOT\AppID\{AppIdOrGuid}]
"LocalService"="MyService"

Then the implementation is easy on the c++ side:

#import "C:\path\to\MyService.tlb"
...
IMyInterfacePtr ptr(__uuidof(MyImplementingClass));
ptr->CallSomeFunction();
...
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @HansPassant
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Uriel G