File: Windows.Win32.IPropertyBag.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.StructuredStorage
	{
		[Guid("55272A00-42CB-11CE-8135-00AA004BB851")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IPropertyBag
			:IVTable<IPropertyBag,IPropertyBag.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]<IPropertyBag*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IPropertyBag*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

			/// <inheritdoc cref="Read(winmdroot.Foundation.PCWSTR, winmdroot.System.Variant.VARIANT*, winmdroot.System.Com.IErrorLog*)"/>
			internal unsafe winmdroot.Foundation.HRESULT Read(string pszPropName, ref winmdroot.System.Variant.VARIANT pVar, winmdroot.System.Com.IErrorLog* pErrorLog)
			{
				fixed (winmdroot.System.Variant.VARIANT* pVarLocal = &pVar)
				{
					fixed (char* pszPropNameLocal = pszPropName)
					{
						winmdroot.Foundation.HRESULT __result = this.Read(pszPropNameLocal, pVarLocal, pErrorLog);
						return __result;
					}
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT Read(IPropertyBag* pThis, winmdroot.Foundation.PCWSTR pszPropName, winmdroot.System.Variant.VARIANT* pVar, winmdroot.System.Com.IErrorLog* pErrorLog)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.Read(pszPropName, pVar, pErrorLog);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Reads the named property into a caller-initialized VARIANT.</summary>
			/// <param name="pszPropName">The address of the name of the property to read. This cannot be NULL.</param>
			/// <param name="pVar">The address of the caller-initialized VARIANT that receives the property value on output. The function sets the type field and the value field in the VARIANT before it returns. If the caller initialized the `pVar->vt` field on entry, the property bag attempts to change its corresponding value to this type. If the caller sets `pVar->vt` to VT_EMPTY, the property bag can use whatever type is convenient.</param>
			/// <param name="pErrorLog">The address of the caller's error log in which the property bag stores any errors that occur during reads. This can be NULL; in which case, the caller does not receive errors.</param>
			/// <returns>An HRESULT</returns>
			/// <remarks>
			/// <para>The **Read** method tells the property bag to read the property named in *pszPropName* to the caller-initialized VARIANT in *pVar*. Errors are logged in the error log that is pointed to by *pErrorLog*. When `pVar->vt` specifies another object pointer (VT_UNKNOWN), the property bag is responsible for creating and initializing the object described by *pszPropName*. E_NOTIMPL is not a valid return code, because any object that implements this interface must support the entire functionality of the interface.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/oaidl/nf-oaidl-ipropertybag-read#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT Read(winmdroot.Foundation.PCWSTR pszPropName, winmdroot.System.Variant.VARIANT* pVar, winmdroot.System.Com.IErrorLog* pErrorLog)
			{
				return ((delegate *unmanaged [Stdcall]<IPropertyBag*,winmdroot.Foundation.PCWSTR ,winmdroot.System.Variant.VARIANT* ,winmdroot.System.Com.IErrorLog* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IPropertyBag*)Unsafe.AsPointer(ref this), pszPropName, pVar, pErrorLog);
			}

			/// <inheritdoc cref="Write(winmdroot.Foundation.PCWSTR, winmdroot.System.Variant.VARIANT*)"/>
			internal unsafe void Write(string pszPropName, in winmdroot.System.Variant.VARIANT pVar)
			{
				fixed (winmdroot.System.Variant.VARIANT* pVarLocal = &pVar)
				{
					fixed (char* pszPropNameLocal = pszPropName)
					{
						this.Write(pszPropNameLocal, pVarLocal);
					}
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT Write(IPropertyBag* pThis, winmdroot.Foundation.PCWSTR pszPropName, winmdroot.System.Variant.VARIANT* pVar)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.Write(pszPropName, pVar);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Save the named property in a caller-initialized VARIANT.</summary>
			/// <param name="pszPropName">The address of a string containing the name of the property to write. This cannot be NULL.</param>
			/// <param name="pVar">The address of the caller-initialized VARIANT that holds the property value to save. The caller owns this VARIANT, and is responsible for all of its allocations. That is, the property bag does not attempt to free data in the VARIANT.</param>
			/// <returns></returns>
			/// <remarks>
			/// <para>The **Write** method tells the property bag to save the property named with *pszPropName* by using the type and value in the caller-initialized VARIANT in *pVar*. In some cases, the caller might be telling the property bag to save another object, for example, when `pVar->vt` is VT_UNKNOWN. In such cases, the property bag queries this object pointer for a persistence interface, such as IPersistStream or IPersistPropertyBag, and has that object save its data as well. Usually this results in the property bag having some byte array for this object, which can be saved as encoded text, such as hexadecimal string, MIME, and so on. When the property bag is later used to reinitialize a control, the client that owns the property bag must re-create the object when the caller asks for it, initializing that object with the previously saved bits. This allows efficient persistence operations for Binary Large Object (BLOB) properties, such as a picture, where the owner of the property bag tells the picture object (which is managed as a property in the control that is saved) to save to a specific location. This avoids potential extra copy operations that might be involved with other property-based persistence mechanisms. E_NOTIMPL is not a valid return code, because any object that implements this interface must support the entire functionality of the interface.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/oaidl/nf-oaidl-ipropertybag-write#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe void Write(winmdroot.Foundation.PCWSTR pszPropName, winmdroot.System.Variant.VARIANT* pVar)
			{
				((delegate *unmanaged [Stdcall]<IPropertyBag*,winmdroot.Foundation.PCWSTR ,winmdroot.System.Variant.VARIANT* ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IPropertyBag*)Unsafe.AsPointer(ref this), pszPropName, pVar).ThrowOnFailure();
			}

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

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

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

				internal delegate *unmanaged [Stdcall]<IPropertyBag*,winmdroot.Foundation.PCWSTR ,winmdroot.System.Variant.VARIANT* ,winmdroot.System.Com.IErrorLog* ,winmdroot.Foundation.HRESULT> Read_4;

				internal delegate *unmanaged [Stdcall]<IPropertyBag*,winmdroot.Foundation.PCWSTR ,winmdroot.System.Variant.VARIANT* ,winmdroot.Foundation.HRESULT> Write_5;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->Read_4 = &Read;
				vtable->Write_5 = &Write;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{55272a00-42cb-11ce-8135-00aa004bb851}</value>
			internal static readonly Guid IID_Guid = new Guid(0x55272A00, 0x42CB, 0x11CE, 0x81, 0x35, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x00,0x2A,0x27,0x55,0xCB,0x42,0xCE,0x11,0x81,0x35,0x00,0xAA,0x00,0x4B,0xB8,0x51					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("55272A00-42CB-11CE-8135-00AA004BB851"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT Read(winmdroot.Foundation.PCWSTR pszPropName, winmdroot.System.Variant.VARIANT* pVar, winmdroot.System.Com.IErrorLog* pErrorLog);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT Write(winmdroot.Foundation.PCWSTR pszPropName, winmdroot.System.Variant.VARIANT* pVar);
			}
		}
	}
}