File: Windows.Win32.IServiceProvider.g.cs
Project: src\src\System.Private.Windows.Core\src\System.Private.Windows.Core.csproj (System.Private.Windows.Core)
// ------------------------------------------------------------------------------
// <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("6D5140C1-7436-11CE-8034-00AA006009FA")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IServiceProvider
			:IVTable<IServiceProvider,IServiceProvider.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]<IServiceProvider*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IServiceProvider*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

			/// <inheritdoc cref="QueryService(global::System.Guid*, global::System.Guid*, void**)"/>
			internal unsafe winmdroot.Foundation.HRESULT QueryService(in global::System.Guid guidService, in global::System.Guid riid, out void* ppvObject)
			{
				fixed (void** ppvObjectLocal = &ppvObject)
				{
					fixed (global::System.Guid* riidLocal = &riid)
					{
						fixed (global::System.Guid* guidServiceLocal = &guidService)
						{
							winmdroot.Foundation.HRESULT __result = this.QueryService(guidServiceLocal, riidLocal, ppvObjectLocal);
							return __result;
						}
					}
				}
			}

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

			/// <summary>Acts as the factory method for any services exposed through an implementation of IServiceProvider. Accepts a CLSID parameter.</summary>
			/// <param name="guidService">The unique identifier of the service (an SID).</param>
			/// <param name="riid">The unique identifier of the interface that the caller wants to receive for the service.</param>
			/// <param name="ppvObject">The address of the caller-allocated variable to receive the interface pointer of the service on successful return from this function. The caller becomes responsible for calling [Release](../unknwn/nf-unknwn-iunknown-release.md) through this interface pointer when the service is no longer required.</param>
			/// <returns>S_OK on success.</returns>
			/// <remarks>**QueryService** creates or accesses the implementation of the service identified with guidService. In ppv, it returns the address of the interface that is specified by riid.</remarks>
			public unsafe winmdroot.Foundation.HRESULT QueryService(global::System.Guid* guidService, global::System.Guid* riid, void** ppvObject)
			{
				return ((delegate *unmanaged [Stdcall]<IServiceProvider*,global::System.Guid* ,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IServiceProvider*)Unsafe.AsPointer(ref this), guidService, riid, ppvObject);
			}

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

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

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

				internal delegate *unmanaged [Stdcall]<IServiceProvider*,global::System.Guid* ,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryService_4;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->QueryService_4 = &QueryService;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{6d5140c1-7436-11ce-8034-00aa006009fa}</value>
			internal static readonly Guid IID_Guid = new Guid(0x6D5140C1, 0x7436, 0x11CE, 0x80, 0x34, 0x00, 0xAA, 0x00, 0x60, 0x09, 0xFA);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0xC1,0x40,0x51,0x6D,0x36,0x74,0xCE,0x11,0x80,0x34,0x00,0xAA,0x00,0x60,0x09,0xFA					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("6D5140C1-7436-11CE-8034-00AA006009FA"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT QueryService(global::System.Guid* guidService, global::System.Guid* riid, void** ppvObject);
			}
		}
	}
}