IPersistStream
using System;
using System.CodeDom.Compiler;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Windows.Win32.Foundation;
namespace Windows.Win32.System.Com
{
[Guid("00000109-0000-0000-C000-000000000046")]
[SupportedOSPlatform("windows5.0")]
[GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal struct IPersistStream : IVTable<IPersistStream, IPersistStream.Vtbl>, IVTable, IComIID
{
internal struct Vtbl
{
internal IntPtr QueryInterface_1;
internal IntPtr AddRef_2;
internal IntPtr Release_3;
internal IntPtr GetClassID_4;
internal IntPtr IsDirty_5;
internal IntPtr Load_6;
internal IntPtr Save_7;
internal IntPtr GetSizeMax_8;
}
[ComImport]
[Guid("00000109-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[SupportedOSPlatform("windows5.0")]
internal interface Interface : IPersist.Interface
{
[PreserveSig]
new unsafe HRESULT GetClassID(Guid* pClassID);
[PreserveSig]
HRESULT IsDirty();
[PreserveSig]
unsafe HRESULT Load(IStream* pStm);
[PreserveSig]
unsafe HRESULT Save(IStream* pStm, BOOL fClearDirty);
[PreserveSig]
unsafe HRESULT GetSizeMax(ulong* pcbSize);
}
private unsafe void** lpVtbl;
internal static readonly Guid IID_Guid = new Guid(265, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70);
[IsReadOnly]
static unsafe ref Guid IComIID.Guid {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[return: IsReadOnly]
get {
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(new ReadOnlySpan<byte>(&global::<PrivateImplementationDetails>.125F8161CD25417D005F11CF3AD4A63E0B74EDCD8A59DDBE38E201653A0ADFC9, 16)));
}
}
internal unsafe HRESULT QueryInterface([In] [IsReadOnly] ref Guid riid, out void* ppvObject)
{
fixed (void** ppvObject2 = &ppvObject) {
fixed (Guid* riid2 = &riid) {
return QueryInterface(riid2, ppvObject2);
}
}
}
public unsafe HRESULT QueryInterface(Guid* riid, void** ppvObject)
{
IntPtr intPtr = (IntPtr)(*lpVtbl);
return (HRESULT);
}
public unsafe uint AddRef()
{
IntPtr intPtr = (IntPtr)lpVtbl[1];
return (uint);
}
public unsafe uint Release()
{
IntPtr intPtr = (IntPtr)lpVtbl[2];
return (uint);
}
internal unsafe HRESULT GetClassID(out Guid pClassID)
{
fixed (Guid* pClassID2 = &pClassID) {
return GetClassID(pClassID2);
}
}
[UnmanagedCallersOnly(CallConvs = new Type[] {
typeof(CallConvStdcall)
})]
private unsafe static HRESULT GetClassID(IPersistStream* pThis, Guid* pClassID)
{
try {
Interface object;
HRESULT result = ComHelpers.UnwrapCCW<IPersistStream, Interface>(pThis, out object);
if (!result.Failed)
return object.GetClassID(pClassID);
return result;
} catch (Exception ex) {
return (HRESULT)ex.HResult;
}
}
public unsafe HRESULT GetClassID(Guid* pClassID)
{
IntPtr intPtr = (IntPtr)lpVtbl[3];
return (HRESULT);
}
[UnmanagedCallersOnly(CallConvs = new Type[] {
typeof(CallConvStdcall)
})]
private unsafe static HRESULT IsDirty(IPersistStream* pThis)
{
try {
Interface object;
HRESULT result = ComHelpers.UnwrapCCW<IPersistStream, Interface>(pThis, out object);
if (!result.Failed)
return object.IsDirty();
return result;
} catch (Exception ex) {
return (HRESULT)ex.HResult;
}
}
public unsafe HRESULT IsDirty()
{
IntPtr intPtr = (IntPtr)lpVtbl[4];
return (HRESULT);
}
[UnmanagedCallersOnly(CallConvs = new Type[] {
typeof(CallConvStdcall)
})]
private unsafe static HRESULT Load(IPersistStream* pThis, IStream* pStm)
{
try {
Interface object;
HRESULT result = ComHelpers.UnwrapCCW<IPersistStream, Interface>(pThis, out object);
if (!result.Failed)
return object.Load(pStm);
return result;
} catch (Exception ex) {
return (HRESULT)ex.HResult;
}
}
public unsafe HRESULT Load(IStream* pStm)
{
IntPtr intPtr = (IntPtr)lpVtbl[5];
return (HRESULT);
}
[UnmanagedCallersOnly(CallConvs = new Type[] {
typeof(CallConvStdcall)
})]
private unsafe static HRESULT Save(IPersistStream* pThis, IStream* pStm, BOOL fClearDirty)
{
try {
Interface object;
HRESULT result = ComHelpers.UnwrapCCW<IPersistStream, Interface>(pThis, out object);
if (!result.Failed)
return object.Save(pStm, fClearDirty);
return result;
} catch (Exception ex) {
return (HRESULT)ex.HResult;
}
}
public unsafe HRESULT Save(IStream* pStm, BOOL fClearDirty)
{
IntPtr intPtr = (IntPtr)lpVtbl[6];
return (HRESULT);
}
internal unsafe HRESULT GetSizeMax(out ulong pcbSize)
{
fixed (ulong* pcbSize2 = &pcbSize) {
return GetSizeMax(pcbSize2);
}
}
[UnmanagedCallersOnly(CallConvs = new Type[] {
typeof(CallConvStdcall)
})]
private unsafe static HRESULT GetSizeMax(IPersistStream* pThis, ulong* pcbSize)
{
try {
Interface object;
HRESULT result = ComHelpers.UnwrapCCW<IPersistStream, Interface>(pThis, out object);
if (!result.Failed)
return object.GetSizeMax(pcbSize);
return result;
} catch (Exception ex) {
return (HRESULT)ex.HResult;
}
}
public unsafe HRESULT GetSizeMax(ulong* pcbSize)
{
IntPtr intPtr = (IntPtr)lpVtbl[7];
return (HRESULT);
}
internal unsafe HRESULT QueryInterface<[IsUnmanaged] T>(out T* ppv) where T : struct
{
Guid riid = typeof(T).GUID;
void* ppvObject;
HRESULT result = QueryInterface(ref riid, out ppvObject);
if (result.Succeeded)
ppv = (T*)ppvObject;
else
ppv = null;
return result;
}
public unsafe static void PopulateVTable(Vtbl* vtable)
{
vtable->GetClassID_4 = (IntPtr)(void*);
vtable->IsDirty_5 = (IntPtr)(void*);
vtable->Load_6 = (IntPtr)(void*);
vtable->Save_7 = (IntPtr)(void*);
vtable->GetSizeMax_8 = (IntPtr)(void*);
}
unsafe void IVTable<IPersistStream, Vtbl>.PopulateVTable(Vtbl* vtable)
{
this.PopulateVTable(vtable);
}
}
}