|
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
namespace System.Com
{
[Guid("00000146-0000-0000-C000-000000000046")]
[SupportedOSPlatform("windows5.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal unsafe partial struct IGlobalInterfaceTable
:IVTable<IGlobalInterfaceTable,IGlobalInterfaceTable.Vtbl>,IComIID {
/// <inheritdoc cref="QueryInterface(global::System.Guid*, void**)"/>
internal unsafe winmdroot.Foundation.HRESULT QueryInterface(in global::System.Guid riid, out void* ppvObject)
{
fixed (void** ppvObjectLocal = &ppvObject)
{
fixed (global::System.Guid* riidLocal = &riid)
{
winmdroot.Foundation.HRESULT __result = this.QueryInterface(riidLocal, ppvObjectLocal);
return __result;
}
}
}
public unsafe winmdroot.Foundation.HRESULT QueryInterface(global::System.Guid* riid, void** ppvObject)
{
return ((delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IGlobalInterfaceTable*)Unsafe.AsPointer(ref this), riid, ppvObject);
}
public uint AddRef()
{
return ((delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint>)lpVtbl[1])((IGlobalInterfaceTable*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return ((delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint>)lpVtbl[2])((IGlobalInterfaceTable*)Unsafe.AsPointer(ref this));
}
/// <inheritdoc cref="RegisterInterfaceInGlobal(winmdroot.System.Com.IUnknown*, global::System.Guid*, uint*)"/>
internal unsafe winmdroot.Foundation.HRESULT RegisterInterfaceInGlobal(winmdroot.System.Com.IUnknown* pUnk, in global::System.Guid riid, out uint pdwCookie)
{
fixed (uint* pdwCookieLocal = &pdwCookie)
{
fixed (global::System.Guid* riidLocal = &riid)
{
winmdroot.Foundation.HRESULT __result = this.RegisterInterfaceInGlobal(pUnk, riidLocal, pdwCookieLocal);
return __result;
}
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT RegisterInterfaceInGlobal(IGlobalInterfaceTable* pThis, winmdroot.System.Com.IUnknown* pUnk, global::System.Guid* riid, uint* pdwCookie)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.RegisterInterfaceInGlobal(pUnk, riid, pdwCookie);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Registers the specified interface on an object residing in one apartment of a process as a global interface, enabling other apartments access to that interface.</summary>
/// <param name="pUnk">An interface pointer of type <i>riid</i> on the object on which the interface to be registered as global is implemented.</param>
/// <param name="riid">The IID of the interface to be registered as global.</param>
/// <param name="pdwCookie">An identifier that can be used by another apartment to get access to a pointer to the interface being registered. The value of an invalid cookie is 0.</param>
/// <returns>
/// <para>This method can return the following values. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>Called in the apartment in which an object resides to register one of the object's interfaces as a global interface. This method supplies a pointer to a cookie that other apartments can use in a call to the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-iglobalinterfacetable-getinterfacefromglobal">GetInterfaceFromGlobal</a> method to get a pointer to that interface. The interface pointer may be a pointer to an in-process object, or it may be a pointer to a proxy for an object residing in another apartment, in another process, or on another computer. The apartment that calls this method must remain alive until the corresponding call to <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-iglobalinterfacetable-revokeinterfacefromglobal">RevokeInterfaceFromGlobal</a>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidlbase/nf-objidlbase-iglobalinterfacetable-registerinterfaceinglobal#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe winmdroot.Foundation.HRESULT RegisterInterfaceInGlobal(winmdroot.System.Com.IUnknown* pUnk, global::System.Guid* riid, uint* pdwCookie)
{
return ((delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,winmdroot.System.Com.IUnknown* ,global::System.Guid* ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IGlobalInterfaceTable*)Unsafe.AsPointer(ref this), pUnk, riid, pdwCookie);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT RevokeInterfaceFromGlobal(IGlobalInterfaceTable* pThis, uint dwCookie)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.RevokeInterfaceFromGlobal(dwCookie);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Revokes the registration of an interface in the global interface table.</summary>
/// <param name="dwCookie">Identifies the interface whose global registration is to be revoked.</param>
/// <returns>
/// <para>This method can return the following values. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>Call this method when an interface registered in the global interface table object no longer needs to be accessed by other apartments in the same process. This method can be called by any apartment in the process, including apartments other than the one that registered the interface in the global interface table.</remarks>
public winmdroot.Foundation.HRESULT RevokeInterfaceFromGlobal(uint dwCookie)
{
return ((delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IGlobalInterfaceTable*)Unsafe.AsPointer(ref this), dwCookie);
}
/// <inheritdoc cref="GetInterfaceFromGlobal(uint, global::System.Guid*, void**)"/>
internal unsafe winmdroot.Foundation.HRESULT GetInterfaceFromGlobal(uint dwCookie, in global::System.Guid riid, out void* ppv)
{
fixed (void** ppvLocal = &ppv)
{
fixed (global::System.Guid* riidLocal = &riid)
{
winmdroot.Foundation.HRESULT __result = this.GetInterfaceFromGlobal(dwCookie, riidLocal, ppvLocal);
return __result;
}
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT GetInterfaceFromGlobal(IGlobalInterfaceTable* pThis, uint dwCookie, global::System.Guid* riid, void** ppv)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.GetInterfaceFromGlobal(dwCookie, riid, ppv);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Retrieves a pointer to an interface on an object that is usable by the calling apartment. This interface must be currently registered in the global interface table.</summary>
/// <param name="dwCookie">Identifies the interface (and its object), and is retrieved through a call to <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-iglobalinterfacetable-registerinterfaceinglobal">IGlobalInterfaceTable::RegisterInterfaceInGlobal</a>.</param>
/// <param name="riid">The IID of the interface.</param>
/// <param name="ppv">A pointer to the pointer for the requested interface.</param>
/// <returns>
/// <para>This method can return the following values. </para>
/// <para>This doc was truncated.</para>
/// </returns>
/// <remarks>
/// <para>After an interface has been registered in the global interface table, an apartment can get a pointer to this interface by calling the <b>GetInterfaceFromGlobal</b> method with the supplied cookie. This pointer to the interface can be used in the calling apartment but not by other apartments in the process. The application is responsible for coordinating access to the global variable during calls to <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-iglobalinterfacetable-revokeinterfacefromglobal">IGlobalInterfaceTable::RevokeInterfaceFromGlobal</a>. That is, the application should ensure that one thread does not call <b>RevokeInterfaceFromGlobal</b> while another thread is calling <b>GetInterfaceFromGlobal</b> with the same cookie. Multiple calls to <b>GetInterfaceFromGlobal</b> for the same cookie are permitted. The <b>GetInterfaceFromGlobal</b> method calls <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-addref">AddRef</a> on the pointer obtained in the <i>ppv</i> parameter. It is the caller's responsibility to call <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-release">Release</a> on this pointer.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidlbase/nf-objidlbase-iglobalinterfacetable-getinterfacefromglobal#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe winmdroot.Foundation.HRESULT GetInterfaceFromGlobal(uint dwCookie, global::System.Guid* riid, void** ppv)
{
return ((delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint ,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IGlobalInterfaceTable*)Unsafe.AsPointer(ref this), dwCookie, riid, ppv);
}
internal unsafe global::Windows.Win32.Foundation.HRESULT QueryInterface<T>(out T* ppv)
where T : unmanaged
{
var hr = this.QueryInterface(typeof(T).GUID, out void* pv);
if (hr.Succeeded)
{
ppv = (T*)pv;
}
else
{
ppv = null;
}
return hr;
}
internal struct Vtbl
{
internal delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;
internal delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint> AddRef_2;
internal delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint> Release_3;
internal delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,winmdroot.System.Com.IUnknown* ,global::System.Guid* ,uint* ,winmdroot.Foundation.HRESULT> RegisterInterfaceInGlobal_4;
internal delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint ,winmdroot.Foundation.HRESULT> RevokeInterfaceFromGlobal_5;
internal delegate *unmanaged [Stdcall]<IGlobalInterfaceTable*,uint ,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> GetInterfaceFromGlobal_6;
}
public static void PopulateVTable(Vtbl* vtable)
{
vtable->RegisterInterfaceInGlobal_4 = &RegisterInterfaceInGlobal;
vtable->RevokeInterfaceFromGlobal_5 = &RevokeInterfaceFromGlobal;
vtable->GetInterfaceFromGlobal_6 = &GetInterfaceFromGlobal;
}
private void** lpVtbl;
/// <summary>The IID guid for this interface.</summary>
/// <value>{00000146-0000-0000-c000-000000000046}</value>
internal static readonly Guid IID_Guid = new Guid(0x00000146, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
static ref readonly Guid IComIID.Guid {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
0x46,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 };
return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
}
}
[Guid("00000146-0000-0000-C000-000000000046"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
[SupportedOSPlatform("windows5.0")]
internal interface Interface
{
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT RegisterInterfaceInGlobal(winmdroot.System.Com.IUnknown* pUnk, global::System.Guid* riid, uint* pdwCookie);
[PreserveSig()]
winmdroot.Foundation.HRESULT RevokeInterfaceFromGlobal(uint dwCookie);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT GetInterfaceFromGlobal(uint dwCookie, global::System.Guid* riid, void** ppv);
}
}
}
}
|