File: Windows.Win32.ComHelpers.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
{
	internal static unsafe partial class ComHelpers
	{
		private static readonly winmdroot.Foundation.HRESULT COR_E_OBJECTDISPOSED = (winmdroot.Foundation.HRESULT)unchecked((int)0x80131622);

		private static readonly winmdroot.Foundation.HRESULT S_OK = (winmdroot.Foundation.HRESULT)0;


		internal static winmdroot.Foundation.HRESULT UnwrapCCW<TThis, TInterface>(TThis* @this, out TInterface @object)
where TThis : unmanaged
where TInterface : class

		{
			@object = ComWrappers.ComInterfaceDispatch.GetInstance<TInterface>((ComWrappers.ComInterfaceDispatch*)@this);
			return @object is null ? COR_E_OBJECTDISPOSED : S_OK;
		}


		internal static void PopulateIUnknown<TComInterface>(System.Com.IUnknown.Vtbl* vtable)
where TComInterface : unmanaged

		{
			PopulateIUnknownImpl<TComInterface>(vtable);
			if (vtable->QueryInterface_1 is null)

			{
				throw new NotImplementedException("v-tables cannot be accessed unless the Windows.Win32.ComHelpers.PopulateIUnknownImpl partial method is implemented.");
			}
		}


		static partial void PopulateIUnknownImpl<TComInterface>(System.Com.IUnknown.Vtbl* vtable)
where TComInterface : unmanaged;
	}
}