File: Windows.Win32.IConnectionPoint.g.cs
Project: src\src\System.Windows.Forms.Primitives\src\System.Windows.Forms.Primitives.csproj (System.Windows.Forms.Primitives)
// ------------------------------------------------------------------------------
// <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("B196B286-BAB4-101A-B69C-00AA00341D07")]
		[SupportedOSPlatform("windows5.0")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IConnectionPoint
			:IVTable<IConnectionPoint,IConnectionPoint.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]<IConnectionPoint*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IConnectionPoint*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

			public uint AddRef()
			{
				return ((delegate *unmanaged [Stdcall]<IConnectionPoint*,uint>)lpVtbl[1])((IConnectionPoint*)Unsafe.AsPointer(ref this));
			}

			public uint Release()
			{
				return ((delegate *unmanaged [Stdcall]<IConnectionPoint*,uint>)lpVtbl[2])((IConnectionPoint*)Unsafe.AsPointer(ref this));
			}

			/// <inheritdoc cref="GetConnectionInterface(global::System.Guid*)"/>
			internal unsafe winmdroot.Foundation.HRESULT GetConnectionInterface(out global::System.Guid pIID)
			{
				fixed (global::System.Guid* pIIDLocal = &pIID)
				{
					winmdroot.Foundation.HRESULT __result = this.GetConnectionInterface(pIIDLocal);
					return __result;
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT GetConnectionInterface(IConnectionPoint* pThis, global::System.Guid* pIID)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.GetConnectionInterface(pIID);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves the IID of the outgoing interface managed by this connection point.</summary>
			/// <param name="pIID">A pointer to the identifier of the outgoing interface managed by this connection point.</param>
			/// <returns>
			/// <para>This method can return the standard return value E_UNEXPECTED, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para>Using the <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nn-ocidl-ienumconnectionpoints">IEnumConnectionPoints</a> interface, a client can obtain a pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nn-ocidl-iconnectionpoint">IConnectionPoint</a> interface. Using that pointer and the <b>GetConnectionInterface</b> method, the client can determine the IID of each connection point enumerated. The IID returned from this method must enable the caller to access this same connection point through <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iconnectionpointcontainer-findconnectionpoint">IConnectionPointContainer::FindConnectionPoint</a>. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> This method must be implemented in any connection point; E_NOTIMPL is not an acceptable return value.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iconnectionpoint-getconnectioninterface#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT GetConnectionInterface(global::System.Guid* pIID)
			{
				return ((delegate *unmanaged [Stdcall]<IConnectionPoint*,global::System.Guid* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IConnectionPoint*)Unsafe.AsPointer(ref this), pIID);
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT GetConnectionPointContainer(IConnectionPoint* pThis, winmdroot.System.Com.IConnectionPointContainer** ppCPC)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.GetConnectionPointContainer(ppCPC);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves the IConnectionPointContainer interface pointer for the parent connectable object.</summary>
			/// <param name="ppCPC">A pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nn-ocidl-iconnectionpointcontainer">IConnectionPointContainer</a> interface pointer.</param>
			/// <returns>
			/// <para>This method can return the standard return value E_UNEXPECTED, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para><h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> This method calls <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-addref">AddRef</a>. The caller is responsible for calling <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-release">Release</a> to release this pointer when done. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> This method must call <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-addref">AddRef</a> before returning. This method must be implemented in any connection point; E_NOTIMPL is not an acceptable return value.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iconnectionpoint-getconnectionpointcontainer#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT GetConnectionPointContainer(winmdroot.System.Com.IConnectionPointContainer** ppCPC)
			{
				return ((delegate *unmanaged [Stdcall]<IConnectionPoint*,winmdroot.System.Com.IConnectionPointContainer** ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IConnectionPoint*)Unsafe.AsPointer(ref this), ppCPC);
			}

			/// <inheritdoc cref="Advise(winmdroot.System.Com.IUnknown*, uint*)"/>
			internal unsafe winmdroot.Foundation.HRESULT Advise(winmdroot.System.Com.IUnknown* pUnkSink, out uint pdwCookie)
			{
				fixed (uint* pdwCookieLocal = &pdwCookie)
				{
					winmdroot.Foundation.HRESULT __result = this.Advise(pUnkSink, pdwCookieLocal);
					return __result;
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT Advise(IConnectionPoint* pThis, winmdroot.System.Com.IUnknown* pUnkSink, uint* pdwCookie)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.Advise(pUnkSink, pdwCookie);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Establishes a connection between a connection point object and the client's sink.</summary>
			/// <param name="pUnkSink">A pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nn-unknwn-iunknown">IUnknown</a> interface on the client's advise sink. The client's sink receives outgoing calls from the connection point.</param>
			/// <param name="pdwCookie">A pointer to a returned token that uniquely identifies this connection. The caller uses this token later to delete the connection by passing it to the <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iconnectionpoint-unadvise">IConnectionPoint::Unadvise</a> method. If the connection was not successfully established, this value is zero.</param>
			/// <returns>
			/// <para>This method can return the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para><b>Advise</b> establishes a connection between the connection point and the caller's sink identified with <i>pUnkSink</i>. The connection point must call <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-queryinterface(q)">QueryInterface</a> to obtain the correct outgoing interface pointer to call when events occur, with the IID for the outgoing interface managed by the connection point. When the IID is passed to the <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iconnectionpointcontainer-findconnectionpoint">IConnectionPointContainer::FindConnectionPoint</a> method, an interface pointer to this same connection point is returned. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> The connection point must query the <i>pUnkSink</i> pointer for the correct outgoing interface. If this query fails, this method must return CONNECT_E_CANNOTCONNECT. The <i>pdwCookie</i> value must be unique for each connection to any given instance of a connection point.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/ocidl/nf-ocidl-iconnectionpoint-advise#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT Advise(winmdroot.System.Com.IUnknown* pUnkSink, uint* pdwCookie)
			{
				return ((delegate *unmanaged [Stdcall]<IConnectionPoint*,winmdroot.System.Com.IUnknown* ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IConnectionPoint*)Unsafe.AsPointer(ref this), pUnkSink, pdwCookie);
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT Unadvise(IConnectionPoint* pThis, uint dwCookie)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.Unadvise(dwCookie);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Terminates an advisory connection previously established between a connection point object and a client's sink.</summary>
			/// <param name="dwCookie">A connection token previously returned from <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iconnectionpoint-advise">IConnectionPoint::Advise</a>.</param>
			/// <returns>
			/// <para>This method can return the standard return values E_UNEXPECTED, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>When an advisory connection is terminated, the connection point calls the <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-release">Release</a> method on the pointer that was saved for the connection during the <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nf-ocidl-iconnectionpoint-advise">IConnectionPoint::Advise</a> method. This <b>Release</b> reverses the <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-addref">AddRef</a> that was performed during the <b>Advise</b> when the connection point calls the advisory sink's <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-queryinterface(q)">QueryInterface</a>.</remarks>
			public winmdroot.Foundation.HRESULT Unadvise(uint dwCookie)
			{
				return ((delegate *unmanaged [Stdcall]<IConnectionPoint*,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IConnectionPoint*)Unsafe.AsPointer(ref this), dwCookie);
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT EnumConnections(IConnectionPoint* pThis, winmdroot.System.Com.IEnumConnections** ppEnum)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.EnumConnections(ppEnum);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Creates an enumerator object to iterate through the current connections for this connection point.</summary>
			/// <param name="ppEnum">A pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/ocidl/nn-ocidl-ienumconnections">IEnumConnections</a> interface pointer that receives the newly created enumerator.</param>
			/// <returns>
			/// <para>This method can return the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>The caller is responsible for calling <a href="https://docs.microsoft.com/windows/desktop/api/unknwn/nf-unknwn-iunknown-release">Release</a> when the enumerator is no longer needed.</remarks>
			public unsafe winmdroot.Foundation.HRESULT EnumConnections(winmdroot.System.Com.IEnumConnections** ppEnum)
			{
				return ((delegate *unmanaged [Stdcall]<IConnectionPoint*,winmdroot.System.Com.IEnumConnections** ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((IConnectionPoint*)Unsafe.AsPointer(ref this), ppEnum);
			}

			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]<IConnectionPoint*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

				internal delegate *unmanaged [Stdcall]<IConnectionPoint*,uint> AddRef_2;

				internal delegate *unmanaged [Stdcall]<IConnectionPoint*,uint> Release_3;

				internal delegate *unmanaged [Stdcall]<IConnectionPoint*,global::System.Guid* ,winmdroot.Foundation.HRESULT> GetConnectionInterface_4;

				internal delegate *unmanaged [Stdcall]<IConnectionPoint*,winmdroot.System.Com.IConnectionPointContainer** ,winmdroot.Foundation.HRESULT> GetConnectionPointContainer_5;

				internal delegate *unmanaged [Stdcall]<IConnectionPoint*,winmdroot.System.Com.IUnknown* ,uint* ,winmdroot.Foundation.HRESULT> Advise_6;

				internal delegate *unmanaged [Stdcall]<IConnectionPoint*,uint ,winmdroot.Foundation.HRESULT> Unadvise_7;

				internal delegate *unmanaged [Stdcall]<IConnectionPoint*,winmdroot.System.Com.IEnumConnections** ,winmdroot.Foundation.HRESULT> EnumConnections_8;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->GetConnectionInterface_4 = &GetConnectionInterface;
				vtable->GetConnectionPointContainer_5 = &GetConnectionPointContainer;
				vtable->Advise_6 = &Advise;
				vtable->Unadvise_7 = &Unadvise;
				vtable->EnumConnections_8 = &EnumConnections;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{b196b286-bab4-101a-b69c-00aa00341d07}</value>
			internal static readonly Guid IID_Guid = new Guid(0xB196B286, 0xBAB4, 0x101A, 0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x86,0xB2,0x96,0xB1,0xB4,0xBA,0x1A,0x10,0xB6,0x9C,0x00,0xAA,0x00,0x34,0x1D,0x07					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("B196B286-BAB4-101A-B69C-00AA00341D07"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows5.0")]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT GetConnectionInterface(global::System.Guid* pIID);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT GetConnectionPointContainer(winmdroot.System.Com.IConnectionPointContainer** ppCPC);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT Advise(winmdroot.System.Com.IUnknown* pUnkSink, uint* pdwCookie);

								[PreserveSig()]
winmdroot.Foundation.HRESULT Unadvise(uint dwCookie);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT EnumConnections(winmdroot.System.Com.IEnumConnections** ppEnum);
			}
		}
	}
}