namespace Vanara.PInvoke;
public static partial class Shell32
{
///
/// Exposes a method to discover objects that are named with a GUID from another object. Unlike QueryService this interface
/// will not delegate its functionality on to other objects.
///
///
/// Similar to IServiceProvider, except that this method does not imply that unhandled or unknown requests should be forwarded.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-iobjectprovider
[PInvokeData("shobjidl_core.h", MSDNShortId = "NN:shobjidl_core.IObjectProvider")]
[ComImport, Guid("a6087428-3be3-4d73-b308-7c04a540bf1a"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IObjectProvider
{
/// Queries for a specified object.
///
/// Type: REFGUID
/// A reference to the GUID used to identify the object.
///
///
/// Type: REFIID
/// Specifies the desired interface ID.
///
///
/// Type: void**
/// On success, contains the address of a pointer to the object specified by riid.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
/// Object implementers that want to enable the discovery of other objects that they can produce or that they hold should
/// implement IObjectProvider::QueryObject and publish the GUID values that name those objects for clients of that
/// object. Note that objects should not pass on the request for an object to other objects like QueryService.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-iobjectprovider-queryobject HRESULT
// QueryObject( REFGUID guidObject, REFIID riid, void **ppvOut );
[PreserveSig]
HRESULT QueryObject(in Guid guidObject, in Guid riid, [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 1)] out object? ppvOut);
}
}