IFunctionDiscoveryProvider::InstanceQueryService method (functiondiscoveryprovider.h)

[Function Discovery is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

Creates a provider-specific COM object for the function instance. Provider writers can implement this method to offer additional functionality through the COM object.

Syntax

HRESULT InstanceQueryService(
  [in]  IFunctionInstance *pIFunctionInstance,
  [in]  INT_PTR           iProviderInstanceContext,
  [in]  REFGUID           guidService,
  [in]  REFIID            riid,
  [out] IUnknown          **ppIUnknown
);

Parameters

[in] pIFunctionInstance

A pointer to the IFunctionInstance interface.

[in] iProviderInstanceContext

The context associated with the specific function instance.

[in] guidService

The unique identifier of the service (a SID). This is the service ID defined by the provider writer. For an example, see FunctionDiscoveryServiceIDs.h.

[in] riid

The unique identifier of the interface the caller wishes to receive for the service.

[out] ppIUnknown

A pointer that receives the interface pointer of the service. The caller is responsible for calling Release through this interface pointer when the service is no longer needed.

Return value

Possible return values include, but are not limited to, the following.

Return code Description
S_OK
The method completed successfully.
E_NOINTERFACE
The provider does implement the service identified by guidService but does not implement the interface identified by rrid.
E_OUTOFMEMORY
The method is unable to allocate the memory required to perform this operation.
E_NOTIMPL
The provider does not implement the IFunctionInstance::QueryService method, or the service identifier specified by guidService does not match the provider's service identifier.

Remarks

InstanceQueryService creates or accesses the implementation the service identified with guidService, returning the address of the interface specified by riid in the ppv argument. Providers can implement the service and this method provides a mechanism for the provider to supply this implementation rather then requiring the creation of a new object to implement the service.

The provider should return E_NOINTERFACE if the guidService does not belong to this provider, or the riid interface is not supported. The provider should return E_NOTIMPL if it simply does not implement this method or does not implement the requested SID.

Any provider that supports embedded services or devices must implement the SID_PNPXServiceCollection service. If the SID_PNPXServiceCollection service is supported, the client can call IFunctionInstance::QueryService to access the information and metadata associated with the embedded services or devices. For example, the PnP-X providers (that is, the SSDP provider and the WSD provider) implement support for the SID_PNPXServiceCollection service. Not all providers implement SID_PNPXServiceCollection service support.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header functiondiscoveryprovider.h

See also

IFunctionDiscoveryProvider