3

I'm looking into registering a directshow filter at runtime and probably need to use reflection to do this and then call regsvr32 somehow on binary data. Not sure if this is possible, sounds tricky. Basically I have a dll file that is a filter and I added it to the solution as an embedded resource but after this I'm stuck... not sure how to go about registering it. Does anybody have any insight? Is this possible to do or do I have to have the file existent to register it? Thanks.

Cheers.

bl4kh4k
  • 1,440
  • 4
  • 20
  • 34

1 Answers1

3

Are you sure you need to register it? You only need to do it if it is to participate in Intelligent Connect. Otherwise you might just LoadLibrary the DLL and create an instance of the filter via DllGetClassObject bypassing COM instantiation. Good news you don't have to be administrator with elevated privileges to do this, as opposed to registering the filter DLL.

Then see also:

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • I'm using ConnectDirect, would this suffice? – bl4kh4k Nov 19 '11 at 21:13
  • If you are using `ConnectDirect`, then you should alreade have the filter in the graph. So you should have added it, and you should already have instantiated it. So, my method would definitely work out. – Roman R. Nov 19 '11 at 21:16
  • This is good news, however I'm still a bit confused as to how to load if from an embedded resource, as of right now I have a stream object like so:Assembly assembly = Assembly.GetExecutingAssembly(); Stream stream = assembly.GetManifestResourceStream("Recorder.Libraries.Decklink64.dll"); – bl4kh4k Nov 19 '11 at 21:17
  • See "Embedding unmanaged dll into a managed C# dll" http://stackoverflow.com/questions/666799/embedding-unmanaged-dll-into-a-managed-c-sharp-dll – Roman R. Nov 19 '11 at 21:22