Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create COM object from file without regsvr32

Tags:

c#

com

directshow

Is it possible to create an instance of a COM object with just the dll and no regsvr32?

My main goal here is to create an instance of a directshow filter and insert it into my graph-but I don't want to us regsvr32 to register the filter. The filter will be in a dll/ax that will be distributed with my application and will be present in my path. I will know the CLSID as well.

So basically all I need is a way to create an instance of the type while just having the dll/ax and the CLSID. Is this possible in C#?

like image 707
Duane Avatar asked Dec 27 '10 22:12

Duane


2 Answers

Sounds like you want to use registration-free COM.

like image 134
Logan Capaldo Avatar answered Sep 23 '22 10:09

Logan Capaldo


It's possible, LoadLibrary() and GetProcAddress to the get the DllGetClassObject() entrypoint. You are bypassing a bunch of COM plumbing code that was designed to make you fall into the pit of success. Especially the stuff that takes care of the ThreadingModel. Or the tricks you can use to make 32-bit code run in a 64-bit process, tends to be important with video.

Using reg-free COM with a manifest can make you fall back into that pit.

like image 35
Hans Passant Avatar answered Sep 25 '22 10:09

Hans Passant