Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IWbemServices::QueryObjectSink method

The IWbemServices::QueryObjectSink method allows the caller to obtain a notification handler that is exported by Windows Management. This allows the caller to write notifications and events directly to Windows Management. The caller should only write extrinsic events to Windows Management. For more information, see Determining the Type of Event to Receive.

Syntax


HRESULT QueryObjectSink(
  [in]   LONG lFlags,
  [out]  IWbemObjectSink **ppResponseHandler
);

Parameters

lFlags [in]

Reserved. This parameter must be 0.

ppResponseHandler [out]

Receives the interface pointer to the notification handler. This is set to point to NULL when there is an error. The returned pointer has a positive reference count, and the caller must call IWbemServices::Release on the pointer when it is no longer needed. A NULL value can be returned if no notification handler is available. This is not an error.

Note  The value of the ppResponseHandler parameter cannot be NULL when it is passed to this method.

Return value

This method returns an HRESULT indicating the status of the method call. The following table lists the value contained within an HRESULT.

COM-specific error codes also may be returned if network problems cause you to lose the remote connection to Windows Management.

Return codeDescription
WBEM_E_ACCESS_DENIED

The caller does not have permission to provide notifications to Windows Management.

WBEM_E_FAILED

This is an unspecified error.

WBEM_E_INVALID_PARAMETER

A specified parameter is not valid.

WBEM_E_OUT_OF_MEMORY

There was not enough memory to complete the operation.

WBEM_E_SHUTTING_DOWN

Windows Management service was probably stopped and restarted. A new call to ConnectServer is needed.

WBEM_E_TRANSPORT_FAILURE

This indicates the failure of the remote procedure call (RPC) link between the current process and Windows Management.

WBEM_S_NO_ERROR

The call succeeded.

 

Windows Server 2003 and Windows XP with SP1:  Firing events using QueryObjectSink is permitted by default for Administrators only. Extending the permission to other users requires giving them WBEM_FULL_WRITE permission.

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.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

Fastprox.dll;
Esscli.dll;
Framedyn.dll;
Ntevt.dll;
Stdprov.dll;
Viewprov.dll;
Wbemcomn.dll;
Wbemcore.dll;
Wbemess.dll;
Wbemsvc.dll;
Wmipicmp.dll;
Wmidcprv.dll;
Wmipjobj.dll;
Wmiprvsd.dll

See also

IWbemServices
Querying WMI
IWbemObjectSink

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.