Create COM object from file without regsvr32

Is it possible to create an instance of a COM object only with dll and without regsvr32?

My main goal here is to create an instance of the directshow filter and insert it into my graph, but I don't want regsvr32 to register the filter. The filter will be in dll / ax, which will be distributed along with my application and will be present in my path. I also recognize the CLSID.

So basically all I need is a way to instantiate the type just by having dll / ax and CLSID. Is this possible in C #?

+6
c # com directshow
source share
3 answers

It looks like you want to use COM without registration .

+7
source share

It is possible LoadLibrary () and GetProcAddress to get the entry point of DllGetClassObject (). You bypass a bunch of COM plumbing code that was designed to get you into the abyss of success. Especially the stuff that takes care of ThreadingModel. Or tricks that you can use to execute 32-bit code in a 64-bit process tend to be important with video.

Using reg-free COM with a manifest may make you return to this hole.

+3
source share

When you create a COM instance, Windows looks in the registry, finds out which DLL to load, how to load it, then loads the DLL and finds the class that you were looking for. If you want to skip this search algorithm, then you should implement it, and I don’t think it is easy. But certainly doable.

UPDATE: find the CoLoadLibrary function, maybe this is not so difficult. I think COM servers call CoRegisterClassObject when they load, since Windows finds them, and you can call CoGetClassObject. I'm still in the dark, so keep reading MSDN.

+1
source share

All Articles