File: Windows.Win32.IEnumVARIANT.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.Ole
	{
		[Guid("00020404-0000-0000-C000-000000000046")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IEnumVARIANT
			:IVTable<IEnumVARIANT,IEnumVARIANT.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]<IEnumVARIANT*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IEnumVARIANT*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

			/// <inheritdoc cref="Next(uint, winmdroot.System.Variant.VARIANT*, uint*)"/>
			internal unsafe winmdroot.Foundation.HRESULT Next(Span<winmdroot.System.Variant.VARIANT> rgVar, out uint pCeltFetched)
			{
				fixed (uint* pCeltFetchedLocal = &pCeltFetched)
				{
					fixed (winmdroot.System.Variant.VARIANT* rgVarLocal = rgVar)
					{
						winmdroot.Foundation.HRESULT __result = this.Next((uint )rgVar.Length, rgVarLocal, pCeltFetchedLocal);
						return __result;
					}
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT Next(IEnumVARIANT* pThis, uint celt, winmdroot.System.Variant.VARIANT* rgVar, uint* pCeltFetched)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.Next(celt, rgVar, pCeltFetched);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves the specified items in the enumeration sequence.</summary>
			/// <param name="celt">The number of elements to be retrieved</param>
			/// <param name="rgVar">An array of at least size <i>celt</i> in which the elements are to be returned.</param>
			/// <param name="pCeltFetched">The number of elements returned in <i>rgVar</i>, or NULL.</param>
			/// <returns>
			/// <para>This method can return one of these values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>If fewer than the requested number of elements remain in the sequence, <b>Next</b> returns only the remaining elements. The actual number of elements is returned in <i>pCeltFetched</i>, unless it is null.</remarks>
			public unsafe winmdroot.Foundation.HRESULT Next(uint celt, winmdroot.System.Variant.VARIANT* rgVar, uint* pCeltFetched)
			{
				return ((delegate *unmanaged [Stdcall]<IEnumVARIANT*,uint ,winmdroot.System.Variant.VARIANT* ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IEnumVARIANT*)Unsafe.AsPointer(ref this), celt, rgVar, pCeltFetched);
			}

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

			/// <summary>Attempts to skip over the next celt elements in the enumeration sequence.</summary>
			/// <param name="celt">The number of elements to skip.</param>
			/// <returns>
			/// <para>This method can return one of these values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/oaidl/nf-oaidl-ienumvariant-skip">Learn more about this API from docs.microsoft.com</see>.</para>
			/// </remarks>
			public winmdroot.Foundation.HRESULT Skip(uint celt)
			{
				return ((delegate *unmanaged [Stdcall]<IEnumVARIANT*,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IEnumVARIANT*)Unsafe.AsPointer(ref this), celt);
			}

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

			/// <summary>Resets the enumeration sequence to the beginning. (IEnumVARIANT.Reset)</summary>
			/// <returns>
			/// <para>This method can return one of these values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>There is no guarantee that exactly the same set of variants will be enumerated the second time as was enumerated the first time. Although an exact duplicate is desirable, the outcome depends on the collection being enumerated. You may find that it is impractical for some collections to maintain this condition (for example, an enumeration of the files in a directory).</remarks>
			public winmdroot.Foundation.HRESULT Reset()
			{
				return ((delegate *unmanaged [Stdcall]<IEnumVARIANT*,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IEnumVARIANT*)Unsafe.AsPointer(ref this));
			}

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

			/// <summary>Creates a copy of the current state of enumeration.</summary>
			/// <param name="ppEnum">The clone enumerator.</param>
			/// <returns>
			/// <para>This method can return one of these values. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para>Using this function, a particular point in the enumeration sequence can be recorded, and then returned to at a later time. The returned enumerator is of the same actual interface as the one that is being cloned. There is no guarantee that exactly the same set of variants will be enumerated the second time as was enumerated the first. Although an exact duplicate is desirable, the outcome depends on the collection being enumerated. You may find that it is impractical for some collections to maintain this condition (for example, an enumeration of the files in a directory).</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/oaidl/nf-oaidl-ienumvariant-clone#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT Clone(winmdroot.System.Ole.IEnumVARIANT** ppEnum)
			{
				return ((delegate *unmanaged [Stdcall]<IEnumVARIANT*,winmdroot.System.Ole.IEnumVARIANT** ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IEnumVARIANT*)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]<IEnumVARIANT*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

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

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

				internal delegate *unmanaged [Stdcall]<IEnumVARIANT*,uint ,winmdroot.System.Variant.VARIANT* ,uint* ,winmdroot.Foundation.HRESULT> Next_4;

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

				internal delegate *unmanaged [Stdcall]<IEnumVARIANT*,winmdroot.Foundation.HRESULT> Reset_6;

				internal delegate *unmanaged [Stdcall]<IEnumVARIANT*,winmdroot.System.Ole.IEnumVARIANT** ,winmdroot.Foundation.HRESULT> Clone_7;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->Next_4 = &Next;
				vtable->Skip_5 = &Skip;
				vtable->Reset_6 = &Reset;
				vtable->Clone_7 = &Clone;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{00020404-0000-0000-c000-000000000046}</value>
			internal static readonly Guid IID_Guid = new Guid(0x00020404, 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[]					{
0x04,0x04,0x02,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("00020404-0000-0000-C000-000000000046"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT Next(uint celt, winmdroot.System.Variant.VARIANT* rgVar, uint* pCeltFetched);

								[PreserveSig()]
winmdroot.Foundation.HRESULT Skip(uint celt);

								[PreserveSig()]
winmdroot.Foundation.HRESULT Reset();

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT Clone(winmdroot.System.Ole.IEnumVARIANT** ppEnum);
			}
		}
	}
}