// ------------------------------------------------------------------------------ // <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,SYSLIB1092,CS3021,CS3019 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 UI.Shell.PropertiesSystem { [Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99")] [CLSCompliant(false)] [global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.287+85e3fa26dd.RR")] internal unsafe partial struct IPropertyStore :winmdroot.IVTable<IPropertyStore,IPropertyStore.Vtbl>,IComIID { /// <inheritdoc cref="QueryInterface(global::System.Guid*, void**)"/> [OverloadResolutionPriority(1)] 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]<IPropertyStore*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IPropertyStore*)Unsafe.AsPointer(ref this), riid, ppvObject); } public uint AddRef() { return ((delegate *unmanaged [Stdcall]<IPropertyStore*,uint>)lpVtbl[1])((IPropertyStore*)Unsafe.AsPointer(ref this)); } public uint Release() { return ((delegate *unmanaged [Stdcall]<IPropertyStore*,uint>)lpVtbl[2])((IPropertyStore*)Unsafe.AsPointer(ref this)); } /// <inheritdoc cref="GetCount(uint*)"/> [OverloadResolutionPriority(1)] internal unsafe void GetCount(out uint cProps) { fixed (uint* cPropsLocal = &cProps) { this.GetCount(cPropsLocal); } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT GetCount(IPropertyStore* pThis, uint* cProps) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.GetCount(cProps); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>This method returns a count of the number of properties that are attached to the file.</summary> /// <param name="cProps">A pointer to a value that indicates the property count.</param> /// <returns>The <c>IpropertyStore::GetCount</c> method returns a value of S_OK when the call is successful, even if the file has no properties attached. Any other code returned is an error code.</returns> /// <remarks> /// <para><b>IPropertyStore</b> provides an abstraction over an array of property keys via the <c>IPropertyStore::GetCount</c> and <a href="https://docs.microsoft.com/windows/desktop/api/propsys/nf-propsys-ipropertystore-getat">IPropertyStore::GetAt</a> methods. The property keys in this array represent the properties that are currently stored by the <b>IPropertyStore</b>. When <c>GetCount</c> succeeds, the value pointed to by cProps is a count of property keys in the array. The caller can expect calls to <b>IPropertyStore::GetAt</b> to succeed for values of iProp less than cProps. In the case of failures such as E_OUTOFMEMORY, you should set cProps to zero. It is preferable that errors are discovered during creation or initialization of the property store.</para> /// <para><see href="https://learn.microsoft.com/windows/win32/api/propsys/nf-propsys-ipropertystore-getcount#">Read more on learn.microsoft.com</see>.</para> /// </remarks> public unsafe void GetCount(uint* cProps) { ((delegate *unmanaged [Stdcall]<IPropertyStore*,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IPropertyStore*)Unsafe.AsPointer(ref this), cProps).ThrowOnFailure(); } /// <inheritdoc cref="GetAt(uint, winmdroot.Foundation.PROPERTYKEY*)"/> [OverloadResolutionPriority(1)] internal unsafe void GetAt(uint iProp, out winmdroot.Foundation.PROPERTYKEY pkey) { fixed (winmdroot.Foundation.PROPERTYKEY* pkeyLocal = &pkey) { this.GetAt(iProp, pkeyLocal); } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT GetAt(IPropertyStore* pThis, uint iProp, winmdroot.Foundation.PROPERTYKEY* pkey) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.GetAt(iProp, pkey); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>Gets a property key from the property array of an item.</summary> /// <param name="iProp">The index of the property key in the array of PROPERTYKEY structures. This is a zero-based index.</param> /// <param name="pkey">TBD</param> /// <returns>The <c>IPropertyStore::GetAt</c> method returns a value of S_OK if successful. Otherwise, any other code it returns must be considered to be an error code.</returns> /// <remarks>None</remarks> public unsafe void GetAt(uint iProp, winmdroot.Foundation.PROPERTYKEY* pkey) { ((delegate *unmanaged [Stdcall]<IPropertyStore*,uint ,winmdroot.Foundation.PROPERTYKEY* ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IPropertyStore*)Unsafe.AsPointer(ref this), iProp, pkey).ThrowOnFailure(); } /// <inheritdoc cref="GetValue(winmdroot.Foundation.PROPERTYKEY*, winmdroot.System.Com.StructuredStorage.PROPVARIANT*)"/> [OverloadResolutionPriority(1)] internal unsafe void GetValue(in winmdroot.Foundation.PROPERTYKEY key, out winmdroot.System.Com.StructuredStorage.PROPVARIANT pv) { fixed (winmdroot.System.Com.StructuredStorage.PROPVARIANT* pvLocal = &pv) { fixed (winmdroot.Foundation.PROPERTYKEY* keyLocal = &key) { this.GetValue(keyLocal, pvLocal); } } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT GetValue(IPropertyStore* pThis, winmdroot.Foundation.PROPERTYKEY* key, winmdroot.System.Com.StructuredStorage.PROPVARIANT* pv) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.GetValue(key, pv); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>This method retrieves the data for a specific property.</summary> /// <param name="key">TBD</param> /// <param name="pv">After the <c>IPropertyStore::GetValue</c> method returns successfully, this parameter points to a <a href="https://docs.microsoft.com/previous-versions/aa912007(v=msdn.10)">PROPVARIANT </a> structure that contains data about the property.</param> /// <returns> /// <para>Returns S_OK or INPLACE_S_TRUNCATED if successful, or an error value otherwise. INPLACE_S_TRUNCATED is returned to indicate that the returned PROPVARIANT was converted into a more canonical form. For example, this would be done to trim leading or trailing spaces from a string value. You must use the SUCCEEDED macro to check the return value, which treats INPLACE_S_TRUNCATED as a success code. The SUCCEEDED macro is defined in the Winerror.h file.</para> /// </returns> /// <remarks>If the PROPERTYKEY referenced in key is not present in the property store, this method returns S_OK and the <a href="https://docs.microsoft.com/previous-versions/aa912007(v=msdn.10)">vt </a> member of the structure that is pointed to by pv is set to VT_EMPTY.</remarks> public unsafe void GetValue(winmdroot.Foundation.PROPERTYKEY* key, winmdroot.System.Com.StructuredStorage.PROPVARIANT* pv) { ((delegate *unmanaged [Stdcall]<IPropertyStore*,winmdroot.Foundation.PROPERTYKEY* ,winmdroot.System.Com.StructuredStorage.PROPVARIANT* ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IPropertyStore*)Unsafe.AsPointer(ref this), key, pv).ThrowOnFailure(); } /// <inheritdoc cref="SetValue(winmdroot.Foundation.PROPERTYKEY*, winmdroot.System.Com.StructuredStorage.PROPVARIANT*)"/> [OverloadResolutionPriority(1)] internal unsafe void SetValue(in winmdroot.Foundation.PROPERTYKEY key, in winmdroot.System.Com.StructuredStorage.PROPVARIANT propvar) { fixed (winmdroot.System.Com.StructuredStorage.PROPVARIANT* propvarLocal = &propvar) { fixed (winmdroot.Foundation.PROPERTYKEY* keyLocal = &key) { this.SetValue(keyLocal, propvarLocal); } } } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT SetValue(IPropertyStore* pThis, winmdroot.Foundation.PROPERTYKEY* key, winmdroot.System.Com.StructuredStorage.PROPVARIANT* propvar) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.SetValue(key, propvar); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>This method sets a property value or replaces or removes an existing value.</summary> /// <param name="key">TBD</param> /// <param name="propvar">TBD</param> /// <returns> /// <para>The <c>IPropertyStore::SetValue</c> method can return any one of the following: </para> /// <para>This doc was truncated.</para> /// </returns> /// <remarks> /// <para><c>IPropertyStore::SetValue</code> affects the current property store instance only. A property handler implements <code>IPropertyStore::SetValue</c> by accumulating property changes in an in-memory data structure. Property changes are written to the stream only when <a href="https://docs.microsoft.com/windows/desktop/api/propsys/nf-propsys-ipropertystore-commit">IPropertyStore::Commit</a> is called. If <b>IPropertyStore::Commit</b> is called on a read-only property store, the property handler determines this and returns STG_E_ACCESSDENIED. If a value was added or removed as a result of <c>SetValue</code>, subsequent enumerations by <a href="https://docs.microsoft.com/windows/desktop/api/propsys/nf-propsys-ipropertystore-getcount">IPropertyStore::GetCount</a> and <a href="https://docs.microsoft.com/windows/desktop/api/propsys/nf-propsys-ipropertystore-getat">IPropertyStore::GetAt</a> reflect that change and subsequent calls to <code>IPropertyStore::SetValue</c> reflect the changed value. <b>Adding a New Property</b> If the property value that was pointed to by key does not exist in the store, <c>IPropertyStore::SetValue</c> adds the value to the store. <b>Replacing an Existing Property Value</b> If the property value that was pointed to by key already exists in the store, the stored value is replaced. <b>Removing an Existing Property</b> To remove a value from the property store, set the vt member of the structure that is pointed to by pv to VT_EMPTY. If that value is not present, do nothing and the method returns S_OK.</para> /// <para><see href="https://learn.microsoft.com/windows/win32/api/propsys/nf-propsys-ipropertystore-setvalue#">Read more on learn.microsoft.com</see>.</para> /// </remarks> public unsafe void SetValue(winmdroot.Foundation.PROPERTYKEY* key, winmdroot.System.Com.StructuredStorage.PROPVARIANT* propvar) { ((delegate *unmanaged [Stdcall]<IPropertyStore*,winmdroot.Foundation.PROPERTYKEY* ,winmdroot.System.Com.StructuredStorage.PROPVARIANT* ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IPropertyStore*)Unsafe.AsPointer(ref this), key, propvar).ThrowOnFailure(); } [UnmanagedCallersOnly(CallConvs = new []{ typeof(CallConvStdcall)} )] private static winmdroot.Foundation.HRESULT Commit(IPropertyStore* pThis) { try { winmdroot.Foundation.HRESULT __hr = winmdroot.ComHelpers.UnwrapCCW(pThis, out Interface __object); if (__hr.Failed) { return __hr; } return __object.Commit(); } catch (Exception ex) { return (winmdroot.Foundation.HRESULT)ex.HResult; } } /// <summary>After a change has been made, this method saves the changes.</summary> /// <returns> /// <para>The <c>IPropertyStore::Commit</c> method returns any one of the following: </para> /// <para>This doc was truncated.</para> /// </returns> /// <remarks> /// <para>Before the <c>Commit</code> method returns, it releases the file stream or path that was initialized to be used by the method. Therefore, no <b>IPropertyStore</b> methods succeed after <code>Commit</c> returns. At that point, they return E_FAIL. Property handlers must ensure that property changes result in a valid destination file, even if the <c>Commit</c> process terminates abnormally, or encounters any errors.</para> /// <para><see href="https://learn.microsoft.com/windows/win32/api/propsys/nf-propsys-ipropertystore-commit#">Read more on learn.microsoft.com</see>.</para> /// </remarks> public void Commit() { ((delegate *unmanaged [Stdcall]<IPropertyStore*,winmdroot.Foundation.HRESULT>)lpVtbl[7])((IPropertyStore*)Unsafe.AsPointer(ref this)).ThrowOnFailure(); } internal unsafe global::Windows.Win32.Foundation.HRESULT QueryInterface<T>(out T* ppv) where T : unmanaged { Guid guid = typeof(T).GUID; void* pv; var hr = this.QueryInterface(&guid, &pv); if (hr.Succeeded) { ppv = (T*)pv; } else { ppv = null; } return hr; } internal struct Vtbl { internal delegate *unmanaged [Stdcall]<IPropertyStore*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1; internal delegate *unmanaged [Stdcall]<IPropertyStore*,uint> AddRef_2; internal delegate *unmanaged [Stdcall]<IPropertyStore*,uint> Release_3; internal delegate *unmanaged [Stdcall]<IPropertyStore*,uint* ,winmdroot.Foundation.HRESULT> GetCount_4; internal delegate *unmanaged [Stdcall]<IPropertyStore*,uint ,winmdroot.Foundation.PROPERTYKEY* ,winmdroot.Foundation.HRESULT> GetAt_5; internal delegate *unmanaged [Stdcall]<IPropertyStore*,winmdroot.Foundation.PROPERTYKEY* ,winmdroot.System.Com.StructuredStorage.PROPVARIANT* ,winmdroot.Foundation.HRESULT> GetValue_6; internal delegate *unmanaged [Stdcall]<IPropertyStore*,winmdroot.Foundation.PROPERTYKEY* ,winmdroot.System.Com.StructuredStorage.PROPVARIANT* ,winmdroot.Foundation.HRESULT> SetValue_7; internal delegate *unmanaged [Stdcall]<IPropertyStore*,winmdroot.Foundation.HRESULT> Commit_8; } public static void PopulateVTable(Vtbl* vtable) { vtable->GetCount_4 = &GetCount; vtable->GetAt_5 = &GetAt; vtable->GetValue_6 = &GetValue; vtable->SetValue_7 = &SetValue; vtable->Commit_8 = &Commit; } private void** lpVtbl; /// <summary>The IID guid for this interface.</summary> /// <value>{886d8eeb-8cf2-4446-8d02-cdba1dbdcf99}</value> internal static readonly Guid IID_Guid = new Guid(0x886D8EEB, 0x8CF2, 0x4446, 0x8D, 0x02, 0xCD, 0xBA, 0x1D, 0xBD, 0xCF, 0x99); static ref readonly Guid IComIID.Guid { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { ReadOnlySpan<byte> data = new byte[] { 0xEB,0x8E,0x6D,0x88,0xF2,0x8C,0x46,0x44,0x8D,0x02,0xCD,0xBA,0x1D,0xBD,0xCF,0x99 }; return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data)); } } [Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()] internal interface Interface { [PreserveSig()] unsafe winmdroot.Foundation.HRESULT GetCount(uint* cProps); [PreserveSig()] unsafe winmdroot.Foundation.HRESULT GetAt(uint iProp, winmdroot.Foundation.PROPERTYKEY* pkey); [PreserveSig()] unsafe winmdroot.Foundation.HRESULT GetValue(winmdroot.Foundation.PROPERTYKEY* key, winmdroot.System.Com.StructuredStorage.PROPVARIANT* pv); [PreserveSig()] unsafe winmdroot.Foundation.HRESULT SetValue(winmdroot.Foundation.PROPERTYKEY* key, winmdroot.System.Com.StructuredStorage.PROPVARIANT* propvar); [PreserveSig()] winmdroot.Foundation.HRESULT Commit(); } } } }