STGMEDIUM
struct STGMEDIUM
using System.CodeDom.Compiler;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using Windows.Win32.Foundation;
using Windows.Win32.Graphics.Gdi;
using Windows.Win32.System.Com.StructuredStorage;
namespace Windows.Win32.System.Com
{
[GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal struct STGMEDIUM
{
[StructLayout(LayoutKind.Explicit)]
[GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal struct _u_e__Union
{
[FieldOffset(0)]
internal HBITMAP hBitmap;
[FieldOffset(0)]
internal unsafe void* hMetaFilePict;
[FieldOffset(0)]
internal HENHMETAFILE hEnhMetaFile;
[FieldOffset(0)]
internal HGLOBAL hGlobal;
[FieldOffset(0)]
internal PWSTR lpszFileName;
[FieldOffset(0)]
internal unsafe IStream* pstm;
[FieldOffset(0)]
internal unsafe IStorage* pstg;
}
private uint _tymed;
internal _u_e__Union u;
internal unsafe IUnknown* pUnkForRelease;
[UnscopedRef]
public ref HGLOBAL hGlobal {
get {
return ref u.hGlobal;
}
}
internal TYMED tymed {
get {
return (TYMED)_tymed;
}
set {
_tymed = (uint)value;
}
}
public unsafe static explicit operator STGMEDIUM(global::System.Runtime.InteropServices.ComTypes.STGMEDIUM comTypeStg)
{
HRESULT result;
IUnknown* ptr = ComHelpers.TryGetComPointer<IUnknown>(comTypeStg.pUnkForRelease, out result);
STGMEDIUM result2 = default(STGMEDIUM);
result2.pUnkForRelease = ptr;
result2.tymed = (TYMED)comTypeStg.tymed;
result2.u = new _u_e__Union {
hGlobal = (HGLOBAL)comTypeStg.unionmember
};
return result2;
}
public unsafe static explicit operator global::System.Runtime.InteropServices.ComTypes.STGMEDIUM(STGMEDIUM stg)
{
global::System.Runtime.InteropServices.ComTypes.STGMEDIUM result = default(global::System.Runtime.InteropServices.ComTypes.STGMEDIUM);
result.pUnkForRelease = ((stg.pUnkForRelease == null) ? null : ComHelpers.GetObjectForIUnknown(stg.pUnkForRelease));
result.tymed = (global::System.Runtime.InteropServices.ComTypes.TYMED)stg.tymed;
result.unionmember = stg.u.hGlobal;
return result;
}
public unsafe void ReleaseUnknown()
{
if (pUnkForRelease != null)
pUnkForRelease->Release();
}
}
}