0

I have interop assembly from I wolud like to get path to orginal COM dll. How this can be done?

Edit: Here is similar question with post marked as answer but it is so brief that I still don't know what to do. I have created object from interop dll and used GetModuleHandle( "mycomserver.dll" ) and 0 results returned.

Code looks like that:

class Program
{
    [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
    public static extern IntPtr GetModuleHandle(string libname);

    static void Main(string[] args)
    {
        IntPtr result = GetModuleHandle(typeof(InteropClass).Module.Name);
        Console.WriteLine(result);
    }
}

Regards, jotbek

Community
  • 1
  • 1
jotbek
  • 1,479
  • 3
  • 14
  • 22
  • 1
    Have you tried anything so far? Please read [faq] and [ask] – Soner Gönül Jan 02 '13 at 10:27
  • I will not post code for you but I will lead you to some things you could read as well as google search on your own.. http://stackoverflow.com/questions/849701/find-com-dll-path-from-com-interop-assembly – MethodMan Jan 02 '13 at 10:30
  • I found this already and a lot more links but none of them show in easy way how to get such path. – jotbek Jan 02 '13 at 10:32
  • 1
    This is not in general possible. A core feature of COM is that a COM server can run anywhere, even a DLL. Including out-of-process, hosted in COM+, in a surrogate process that takes care of a bitness problem, and on a machine halfway around the world. Accordingly, there is no way to find out. Do not attempt this, it will not come to a good end. – Hans Passant Jan 02 '13 at 14:28

0 Answers0