Finding an executable name from a managed dll, com-visible

I created a managed dll and I would like to get the executable name to which it is attached .... I read: How to get the executable path from a managed DLL

It works fine with .net executables .... but when a DLL starts in a com process, I don’t have a .Net assembly ... so Assembly.GetEntryAssembly () will not return anything ....

Any ideas?

+3
source share
1 answer

What about:

using System.Diagnostics;
...
Process process = Process.GetCurrentProcess();
string name = process.ProcessName;
ProcessModule module = process.MainModule;
string path = module == null ? null : module.FileName;
+2
source

Source: https://habr.com/ru/post/1704722/


All Articles