IFunctionInstance::QueryService method

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

Acts as the factory method for any services exposed through an implementation of IFunctionInstance. QueryService creates and initializes instances of a requested interface if the service from which the interface was requested supports the interface.

Syntax


HRESULT QueryService(
  [in]  REFGUID guidService,
  [in]  REFGUID riid,
  [out] void    **ppv
);

Parameters

guidService [in]

Unique identifier of the service (an SID).

The following table shows some possible values. These values are defined in functiondiscoveryserviceids.h, and they correspond to the SIDs implemented by the in-box Function Discovery providers. Custom providers may implement different SIDs. You can pass any valid SID to this parameter.

ValueMeaning
SID_PnpProvider

The PnP provider service. This service is implemented by the PnP provider. You can get the IFunctionInstanceCollection interface from this service.

SID_UPnPActivator

The UPnP activator service. This service works with instances of the SSDP provider. You can get the IUPnPDevice interface from this service.

SID_PNPXAssociation

The PnP-X association service. This service works with instances of the WSD provider and the SSDP provider. You can get the IPNPXAssociation and IPNPXDeviceAssociation interfaces from this service.

SID_PNPXServiceCollection

The PnP-X service collection service. This service is implemented by the SSDP and WSD providers. You can get the IFunctionInstanceCollection interface from this service.

 

riid [in]

Unique identifier of the interface to be returned by the service. Use only the identifier for an interface that is supported by the service specified by guidService. To view the interfaces supported by each in-box service, see the table above.

ppv [out]

Address of the caller-allocated variable to receive the interface pointer of the service on successful return from this function. The caller becomes responsible for calling Release through this interface pointer when the service is no longer needed.

Return value

This method can return one of these values.

Return codeDescription
S_OK

The service was successfully created or retrieved. The caller is responsible for calling ((IUnknown *)*ppv)->Release();.

E_POINTER

ppv is NULL.

E_OUTOFMEMORY

There is insufficient memory to create the service.

E_UNEXPECTED

An unknown error occurred.

E_NOINTERFACE

The service exists, but the interface requested does not exist on that service.

E_NOTIMPL

The method was not implemented by the provider. The NetBIOS provider does not implement the QueryService method.

 

Remarks

This method is inherited from the IServiceProvider interface.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

FunctionDiscoveryAPI.h

IDL

FunctionDiscoveryAPI.idl

DLL

FunDisc.dll

See also

IFunctionInstance

 

 

Community Additions

ADD
Show: