void HackToCreateStubInMTA(object param) { SinkForEventQuery obj = (SinkForEventQuery)param; IWmiSinkDemultiplexor sinkDmux = (IWmiSinkDemultiplexor) new WmiSinkDemultiplexor(); object dmuxStub = null; sinkDmux.GetDemultiplexedStub(obj, out dmuxStub); obj.stub = (IWbemObjectSink)dmuxStub; }
private IWbemObjectSink stub; // The secured IWbemObjectSink public SinkForEventQuery(ManagementEventWatcher eventWatcher, object context, IWbemServices services) { this.services = services; this.context = context; this.eventWatcher = eventWatcher; IWmiSinkDemultiplexor sinkDmux = (IWmiSinkDemultiplexor) new WmiSinkDemultiplexor(); object dmuxStub = null; sinkDmux.GetDemultiplexedStub(this, out dmuxStub); stub = (IWbemObjectSink)dmuxStub; }