The CreateObjectStub method creates an object forwarder sink to assist in receiving asynchronous calls from Windows Management. This function binds an unsecured object sink to a local object sink so that COM security does not interfere with asynchronous retrieval of CIM objects. Because COM security is being bypassed, the remote Windows Management server is assumed to be a trusted component.
The general paradigm is that the original implementation of IWbemObjectSink in the client process is not directly used in asynchronous calls to IWbemServices. Rather, both the original implementation and a substitute object are created, bound together, and then the substitute object is used in the asynchronous methods of IWbemServices.
HRESULT CreateObjectStub( IUnknown *pObject, IUnknown **ppStub );
Pointer to the client's in-process implementation of IWbemObjectSink.
Receives a pointer to a substitute object to be used in asynchronous IWbemServices calls. The user receives an IUnknown pointer and must call QueryInterface for IID_WbemObjectSink before using this object in asynchronous IWbemServices calls.
This method returns standard COM error codes for QueryInterface. It returns S_OK if the call succeeds. If the call fails because the requested interface was not supported, the method returns E_NOINTERFACE.
COM-specific error codes also may be returned if network problems cause you to lose the remote connection to Windows Management.
For a complete example that shows how to use the IUnsecuredApartment interface, see Example: Receiving Event Notifications Through WMI.
|Minimum supported client||Windows Vista|
|Minimum supported server||Windows Server 2008 R2|
|Header||wbemcli.h (include Wbemidl.h)|