using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
/// Exposes a general mechanism for objects to offer services to other objects on the same host.
/// Objects that expose a service first call QueryInterface on their host for this interface, then execute IProfferService::ProfferService.
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-iprofferservice
[PInvokeData("shobjidl_core.h", MSDNShortId = "NN:shobjidl_core.IProfferService")]
[ComImport, Guid("cb728b20-f786-11ce-92ad-00aa00a74cd0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IProfferService
{
/// Makes a service available to other objects on the same host.
///
/// Type: REFGUID
/// A value of type GUID that specifies the service being offered.
///
///
/// Type: IServiceProvider*
/// A pointer to an IServiceProvider interface.
///
///
/// Type: DWORD*
///
/// A pointer to a DWORD that receives an implementation-defined value used for identification purposes. The calling
/// application must keep track of this value for possible use in IProfferService::RevokeService.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-iprofferservice-profferservice HRESULT
// ProfferService( REFGUID guidService, IServiceProvider *psp, DWORD *pdwCookie );
void ProfferService(in Guid guidService, [In] IServiceProvider psp, out uint pdwCookie);
/// Makes a service unavailable that had previously been available to other objects through IProfferService::ProfferService.
///
/// Type: DWORD
///
/// A value of type DWORD that specifies an implementation-defined value used for identification purposes. The calling
/// application receives this value from IProfferService::ProfferService.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-iprofferservice-revokeservice HRESULT
// RevokeService( DWORD dwCookie );
void RevokeService(uint dwCookie);
}
/// Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.
[ComImport, Guid("6d5140c1-7436-11ce-8034-00aa006009fa"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[PInvokeData("servprov.h")]
public interface IServiceProvider
{
/// Performs as a factory for services that are exposed through an implementation of IServiceProvider.
/// A unique identifier of the requested service.
/// A unique identifier of the interface which the caller wishes to receive for the service.
/// The interface specified by the parameter.
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
[PreserveSig]
HRESULT QueryService(in Guid guidService, in Guid riid, [MarshalAs(UnmanagedType.Interface, IidParameterIndex = 0)] out object ppvObject);
}
}
}