IUnsecuredApartment::CreateObjectStub method

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.

Syntax

HRESULT CreateObjectStub(
  IUnknown *pObject,
  IUnknown **ppStub
);

Parameters

pObject

Pointer to the client's in-process implementation of IWbemObjectSink.

ppStub

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.

Return Value

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.

Remarks

Note  Because the call-back to the sink might not be returned at the same authentication level as the client requires, it is recommended that you use semisynchronous instead of asynchronous communication. For more information, see Calling a Method.
 

Examples

For a complete example that shows how to use the IUnsecuredApartment interface, see Example: Receiving Event Notifications Through WMI.

Requirements

   
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008 R2
Target Platform Windows
Header wbemcli.h (include Wbemidl.h)
Library Wbemuuid.lib
DLL Unsecapp.exe

See Also

Calling a Method

IUnsecuredApartment

IWbemObjectSink

IWbemUnsecuredApartment::CreateSinkStub

Lowering the Security for a Sink in a Separate Process

Performing Access Checks

Setting Security on an Asynchronous Call