mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-04-05 17:37:51 +08:00
212 lines
6.9 KiB
C#
212 lines
6.9 KiB
C#
// <auto-generated>
|
|
// Code generated by COM Proxy Code Generator.
|
|
// Changes may cause incorrect behavior and will be lost if the code is
|
|
// regenerated.
|
|
// </auto-generated>
|
|
#nullable enable
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
using ComInterfaceDispatch = System.Runtime.InteropServices.ComWrappers.ComInterfaceDispatch;
|
|
using Marshal = System.Runtime.InteropServices.Marshal;
|
|
using System.Runtime.InteropServices.ComTypes;
|
|
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using System.IO;
|
|
|
|
namespace CPF.Windows.ComWrapper
|
|
{
|
|
internal unsafe static class IStreamVtbl
|
|
{
|
|
private const int S_OK = (int)HRESULT.S_OK;
|
|
public static IntPtr Create(IntPtr fpQueryInterface, IntPtr fpAddRef, IntPtr fpRelease)
|
|
{
|
|
IntPtr* vtblRaw = (IntPtr*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(IStreamVtbl), IntPtr.Size * 14);
|
|
vtblRaw[0] = fpQueryInterface;
|
|
vtblRaw[1] = fpAddRef;
|
|
vtblRaw[2] = fpRelease;
|
|
vtblRaw[3] = (IntPtr)(delegate* unmanaged<IntPtr, byte*, uint, uint*, int>)&Read;
|
|
vtblRaw[4] = (IntPtr)(delegate* unmanaged<IntPtr, byte*, uint, uint*, int>)&Write;
|
|
vtblRaw[5] = (IntPtr)(delegate* unmanaged<IntPtr, long, SeekOrigin, ulong*, int>)&Seek;
|
|
vtblRaw[6] = (IntPtr)(delegate* unmanaged<IntPtr, ulong, int>)&SetSize;
|
|
vtblRaw[7] = (IntPtr)(delegate* unmanaged<IntPtr, IntPtr, ulong, ulong*, ulong*, int>)&CopyTo;
|
|
vtblRaw[8] = (IntPtr)(delegate* unmanaged<IntPtr, uint, int>)&Commit;
|
|
vtblRaw[9] = (IntPtr)(delegate* unmanaged<IntPtr, int>)&Revert;
|
|
vtblRaw[10] = (IntPtr)(delegate* unmanaged<IntPtr, ulong, ulong, uint, int>)&LockRegion;
|
|
vtblRaw[11] = (IntPtr)(delegate* unmanaged<IntPtr, ulong, ulong, uint, int>)&UnlockRegion;
|
|
vtblRaw[12] = (IntPtr)(delegate* unmanaged<IntPtr, STATSTG*, STATFLAG, int>)&Stat;
|
|
vtblRaw[13] = (IntPtr)(delegate* unmanaged<IntPtr, IntPtr*, int>)&Clone;
|
|
|
|
return (IntPtr)vtblRaw;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int Read(IntPtr thisPtr, byte* pv, uint cb, uint* pcbRead)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
inst.Read(pv, cb, pcbRead);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int Write(IntPtr thisPtr, byte* pv, uint cb, uint* pcbWritten)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
inst.Write(pv, cb, pcbWritten);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int Seek(IntPtr thisPtr, long dlibMove, SeekOrigin dwOrigin, ulong* plibNewPosition)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
inst.Seek(dlibMove, dwOrigin, plibNewPosition);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int SetSize(IntPtr thisPtr, ulong libNewSize)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
inst.SetSize(libNewSize);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int CopyTo(IntPtr thisPtr, IntPtr pstm, ulong cb, ulong* pcbRead, ulong* pcbWritten)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
|
|
return (int)inst.CopyTo(pstm, cb, pcbRead, pcbWritten);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int Commit(IntPtr thisPtr, uint grfCommitFlags)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
inst.Commit(grfCommitFlags);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int Revert(IntPtr thisPtr)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
inst.Revert();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int LockRegion(IntPtr thisPtr, ulong libOffset, ulong cb, uint dwLockType)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
return (int)inst.LockRegion(libOffset, cb, dwLockType);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int UnlockRegion(IntPtr thisPtr, ulong libOffset, ulong cb, uint dwLockType)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
return (int)inst.UnlockRegion(libOffset, cb, dwLockType);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int Stat(IntPtr thisPtr, STATSTG* pstatstg, STATFLAG grfStatFlag)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
inst.Stat(pstatstg, grfStatFlag);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
[UnmanagedCallersOnly]
|
|
private static int Clone(IntPtr thisPtr, IntPtr* ppstm)
|
|
{
|
|
try
|
|
{
|
|
IStream inst = ComInterfaceDispatch.GetInstance<IStream>((ComInterfaceDispatch*)thisPtr);
|
|
|
|
return (int)inst.Clone(ppstm);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.HResult;
|
|
}
|
|
}
|
|
}
|
|
} |