public HResult DetachObject() { lock (m_Obj) { m_IcyHandler = null; } return(HResult.S_OK); }
public HResult ShutdownObject() { lock (m_Obj) { if (m_IcyHandler != null) { // Shut it down (m_IcyHandler as IDisposable).Dispose(); // Reset for next time m_IcyHandler = null; } } return(HResult.S_OK); }
// We can't just return an object. It must be the specified interface. public HResult ActivateObject(Guid riid, out IntPtr ppv) { HResult hr; lock (m_Obj) { if (m_IcyHandler == null) { m_IcyHandler = new IcySchemeHandler() as IMFSchemeHandler; } // Note that if we don't support the requested riid, this is // essentially a noop. ppv = Marshal.GetIUnknownForObject(m_IcyHandler); hr = (HResult)Marshal.QueryInterface(ppv, ref riid, out ppv); //Release 1 of the 2 refs we just added. Marshal.Release(ppv); } return(hr); }