Export (0) Print
Expand All

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(
  [in]   IUnknown *pObject,
  [out]  IUnknown **ppStub
);

Parameters

pObject [in]

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

ppStub [out]

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 script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application 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 XP

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Unsecapp.exe

See also

IUnsecuredApartment
Calling a Method
IWbemObjectSink
IWbemUnsecuredApartment::CreateSinkStub
Setting Security on an Asynchronous Call
Lowering the Security for a Sink in a Separate Process
Performing Access Checks

 

 

Show:
© 2014 Microsoft