Acts as the factory method for any services exposed through an implementation of IServiceProvider.
HRESULT QueryService( REFGUID guidService, REFIID riid, void **ppv );
- [in] The unique identifier of the service (an SID).
- [in] The unique identifier of the interface that the caller wants to receive for the service.
- [out] The 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 required.
Returns one of the following values.
S_OK The service was successfully created or retrieved. The caller is responsible for calling ((IUnknown *)*ppv)->Release();. 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 service is not supported.
QueryService creates or accesses the implementation of the service identified with guidService. In ppv, it returns the address of the interface that is specified by riid.
Because there is only one member function in this interface, E_NOTIMPL is not a valid return code. If QueryService is not implemented, the interface has no reason to exist.