0

I am working on a feasibility task, where I need to convert an existing WPF application (.exe) to a COM server.

Scenario:

WPFApp: .NET application written in C# to be launched as a COM server.

LauncherApp: MFC application used to launch the WPF application.

How can the above WPF application be converted to a COM server?

Steve Alex
  • 11
  • 2
  • Yes, you can build an Out-Of-Process COM server with .NET. There's an official sample that demonstrates it: https://github.com/dotnet/samples/tree/main/core/extensions/OutOfProcCOM (it's for .NET Core, but you can do it also with .NET Framework if needed). – Simon Mourier Feb 03 '22 at 11:44
  • Hi @simon, I was able to do the same with .NET Framework. When launching the COM server with CoCreateInstance, the integrity level of the COM server is the same as that of the launcher MFC app. According to [link](https://stackoverflow.com/q/1304847/18109256), in order to get a low IL, I need to launch a new thread, impersonate the current user on that thread, and then set a low IL, and then call CoCreateInstance. Is there an alternative to this method where after COM server registration, CoCreateInstance always launches the COM server in low IL irrespective of the launcher MFC app's IL? – Steve Alex Feb 11 '22 at 10:54
  • this is non trivial, you should ask another question – Simon Mourier Feb 11 '22 at 11:12
  • Alright, thank you. New question posted here - [Register COM server to always run in low privilege level](https://stackoverflow.com/q/71081261/18109256) – Steve Alex Feb 11 '22 at 14:07

0 Answers0