|
// ------------------------------------------------------------------------------
// <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("0000000A-0000-0000-C000-000000000046")]
[SupportedOSPlatform("windows5.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal unsafe partial struct ILockBytes
:IVTable<ILockBytes,ILockBytes.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]<ILockBytes*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((ILockBytes*)Unsafe.AsPointer(ref this), riid, ppvObject);
}
public uint AddRef()
{
return ((delegate *unmanaged [Stdcall]<ILockBytes*,uint>)lpVtbl[1])((ILockBytes*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return ((delegate *unmanaged [Stdcall]<ILockBytes*,uint>)lpVtbl[2])((ILockBytes*)Unsafe.AsPointer(ref this));
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT ReadAt(ILockBytes* pThis, ulong ulOffset, void* pv, uint cb, [Optional] uint* pcbRead)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.ReadAt(ulOffset, pv, cb, pcbRead);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The ReadAt method reads a specified number of bytes starting at a specified offset from the beginning of the byte array object.</summary>
/// <param name="ulOffset">Specifies the starting point from the beginning of the byte array for reading data.</param>
/// <param name="pv">Pointer to the buffer into which the byte array is read. The size of this buffer is contained in <i>cb</i>.</param>
/// <param name="cb">Specifies the number of bytes of data to attempt to read from the byte array.</param>
/// <param name="pcbRead">Pointer to a <b>ULONG</b> where this method writes the actual number of bytes read from the byte array. You can set this pointer to <b>NULL</b> to indicate that you are not interested in this value. In this case, this method does not provide the actual number of bytes that were read.</param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | Indicates that the specified number of bytes were read, or the maximum number of bytes were read to the end of the byte array.| |E_FAIL | Data could not be read from the byte array.| |E_PENDING | Asynchronous Storage only: Part or all of the data to be read is currently unavailable. | |STG_E_ACCESSDENIED | The caller does not have permission to access the byte array.| |STG_E_READFAULT | The number of bytes to be read does not equal the number of bytes that were actually read.|</para>
/// </returns>
/// <remarks>
/// <para><b>ILockBytes::ReadAt</b> reads bytes from the byte array object. It reports the number of bytes that were actually read. This value may be less than the number of bytes requested if an error occurs or if the end of the byte array is reached during the read. It is not an error to read less than the specified number of bytes if the operation encounters the end of the byte array. Note that this is the same end-of-file behavior as found in MS-DOS file allocation table (FAT) file system files.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-readat#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void ReadAt(ulong ulOffset, void* pv, uint cb, [Optional] uint* pcbRead)
{
((delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((ILockBytes*)Unsafe.AsPointer(ref this), ulOffset, pv, cb, pcbRead).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT WriteAt(ILockBytes* pThis, ulong ulOffset, void* pv, uint cb, [Optional] uint* pcbWritten)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.WriteAt(ulOffset, pv, cb, pcbWritten);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The WriteAt method writes the specified number of bytes starting at a specified offset from the beginning of the byte array.</summary>
/// <param name="ulOffset">Specifies the starting point from the beginning of the byte array for the data to be written.</param>
/// <param name="pv">Pointer to the buffer containing the data to be written.</param>
/// <param name="cb">Specifies the number of bytes of data to attempt to write into the byte array.</param>
/// <param name="pcbWritten">Pointer to a location where this method specifies the actual number of bytes written to the byte array. You can set this pointer to <b>NULL</b> to indicate that you are not interested in this value. In this case, this method does not provide the actual number of bytes written.</param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | Indicates that the specified number of bytes were written.| |E_FAIL | A general failure occurred during the write operation.| |E_PENDING | Asynchronous Storage only: Part or all of the data to be written is currently unavailable.| |STG_E_ACCESSDENIED | The caller does not have enough permissions for writing this byte array.| |STG_E_WRITEFAULT | The number of bytes to be written does not equal the number of bytes that were actually written.| |STG_E_MEDIUMFULL | The write operation was not completed because there is no space left on the storage device. The actual number of bytes written is still returned in *pcbWritten*.|</para>
/// </returns>
/// <remarks>
/// <para><b>ILockBytes::WriteAt</b> writes the specified data at the specified location in the byte array. The number of bytes actually written must always be returned in <i>pcbWritten</i>, even if an error is returned. If the byte count is zero bytes, the write operation has no effect. If <i>ulOffset</i> is past the end of the byte array and <i>cb</i> is greater than zero, <b>ILockBytes::WriteAt</b> increases the size of the byte array. The fill bytes written to the byte array are not initialized to any particular value.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-writeat#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void WriteAt(ulong ulOffset, void* pv, uint cb, [Optional] uint* pcbWritten)
{
((delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((ILockBytes*)Unsafe.AsPointer(ref this), ulOffset, pv, cb, pcbWritten).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Flush(ILockBytes* pThis)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Flush();
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The Flush method ensures that any internal buffers maintained by the ILockBytes implementation are written out to the underlying physical storage.</summary>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The flush operation was successful.| |STG_E_ACCESSDENIED | The caller does not have permission to access the byte array.| |STG_E_MEDIUMFULL | The flush operation is not completed because there is no space left on the storage device.| |E_FAIL | General failure writing data.| |STG_E_TOOMANYFILESOPEN | Under certain circumstances, the **Flush** method executes a download-and-closeto flush, which can lead to a return value of STG_E_TOOMANYFILESOPEN if no file handles are available.| |STG_E_INVALIDHANDLE | An underlying file has been prematurely closed, or the correct floppy disk has been replaced by an invalid one.|</para>
/// </returns>
/// <remarks>
/// <para><b>ILockBytes::Flush</b> flushes internal buffers to the underlying storage device. The COM-provided implementation of compound files calls this method during a transacted commit operation to provide a two-phase commit process that protects against loss of data.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-flush#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public void Flush()
{
((delegate *unmanaged [Stdcall]<ILockBytes*,winmdroot.Foundation.HRESULT>)lpVtbl[5])((ILockBytes*)Unsafe.AsPointer(ref this)).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetSize(ILockBytes* pThis, ulong cb)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetSize(cb);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The SetSize method changes the size of the byte array.</summary>
/// <param name="cb">Specifies the new size of the byte array as a number of bytes.</param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The size of the byte array was successfully changed.| |STG_E_ACCESSDENIED | The caller does not have permission to access the byte array.| |STG_E_MEDIUMFULL | The byte array size is not changed because there is no space left on the storage device.|</para>
/// </returns>
/// <remarks>
/// <para><b>ILockBytes::SetSize</b> changes the size of the byte array. If the <i>cb</i> parameter is larger than the current byte array, the byte array is extended to the indicated size by filling the intervening space with bytes of undefined value, as does <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-ilockbytes-writeat">ILockBytes::WriteAt</a>, if the seek pointer is past the current end-of-stream. If the <i>cb</i> parameter is smaller than the current byte array, the byte array is truncated to the indicated size. <h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> Callers cannot rely on STG_E_MEDIUMFULL being returned at the appropriate time because of cache buffering in the operating system or network. However, callers must be able to deal with this return code because some <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-ilockbytes">ILockBytes</a> implementations might support it.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-setsize#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public void SetSize(ulong cb)
{
((delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((ILockBytes*)Unsafe.AsPointer(ref this), cb).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT LockRegion(ILockBytes* pThis, ulong libOffset, ulong cb, uint dwLockType)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.LockRegion(libOffset, cb, dwLockType);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The LockRegion method restricts access to a specified range of bytes in the byte array.</summary>
/// <param name="libOffset">Specifies the byte offset for the beginning of the range.</param>
/// <param name="cb">Specifies, in bytes, the length of the range to be restricted.</param>
/// <param name="dwLockType">
/// <para>Specifies the type of restrictions being requested on accessing the range. This parameter uses one of the values from the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ne-objidl-locktype">LOCKTYPE</a> enumeration.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-lockregion#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The specified range of bytes was locked.| |STG_E_INVALIDFUNCTION | Locking is not supported at all or the specific type of lock requested is not supported.| |STG_E_ACCESSDENIED | Access denied because the caller has insufficient permission, or another caller has the file open and locked.| |STG_E_LOCKVIOLATION | Access denied because another caller has the file open and locked.| |STG_E_INVALIDHANDLE | An underlying file has been prematurely closed, or the correct floppy disk has been replaced by an invalid one.|</para>
/// </returns>
/// <remarks>
/// <para><b>ILockBytes::LockRegion</b> restricts access to the specified range of bytes. Once a region is locked, attempts by others to gain access to the restricted range must fail with the STG_E_ACCESSDENIED error. The byte range can extend past the current end of the byte array. Locking beyond the end of an array is useful as a method of communication between different instances of the byte array object without changing data that is actually part of the byte array. For example, an implementation of <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-ilockbytes">ILockBytes</a> for compound files could rely on locking past the current end of the array as a means of access control, using specific locked regions to indicate permissions currently granted. The <i>dwLockType</i> parameter specifies one of three types of locking, using values from the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ne-objidl-locktype">LOCKTYPE</a> enumeration. The types are as follows: locking to exclude other writers, locking to exclude other readers or writers, and locking that allows only one requester to obtain a lock on the given range. This third type of locking is usually an alias for one of the other two lock types, and permits an Implementer to add other behavior as well. A given byte array might support either of the first two types, or both. To determine the lock types supported by a particular <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-ilockbytes">ILockBytes</a> implementation, you can examine the <b>grfLocksSupported</b> member of the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ns-objidl-statstg">STATSTG</a> structure returned by a call to <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-ilockbytes-stat">ILockBytes::Stat</a>. Any region locked with <b>ILockBytes::LockRegion</b> must later be explicitly unlocked by calling <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-ilockbytes-unlockregion">ILockBytes::UnlockRegion</a> with exactly the same values for the <i>libOffset</i>, <i>cb</i>, and <i>dwLockType</i> parameters. The region must be unlocked before the stream is released. Two adjacent regions cannot be locked separately and then unlocked with a single unlock call. <h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> Since the type of locking supported is optional and can vary in different implementations of <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-ilockbytes">ILockBytes</a>, you must provide code to deal with the STG_E_INVALIDFUNCTION error. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> Support for this method depends on how the storage object built on top of the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-ilockbytes">ILockBytes</a> implementation is used. If you know that only one storage object at any given time can be opened on the storage device that underlies the byte array, then your <b>ILockBytes</b> implementation does not need to support locking. However, if multiple simultaneous openings of a storage object are possible, then region locking is needed to coordinate them. A <b>LockRegion</b> implementation can choose to support all, some, or none of the lock types. For unsupported lock types, the implementation should return STG_E_INVALIDFUNCTION.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-lockregion#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public void LockRegion(ulong libOffset, ulong cb, uint dwLockType)
{
((delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((ILockBytes*)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType).ThrowOnFailure();
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT UnlockRegion(ILockBytes* pThis, ulong libOffset, ulong cb, uint dwLockType)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.UnlockRegion(libOffset, cb, dwLockType);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The UnlockRegion method removes the access restriction on a previously locked range of bytes.</summary>
/// <param name="libOffset">Specifies the byte offset for the beginning of the range.</param>
/// <param name="cb">Specifies, in bytes, the length of the range that is restricted.</param>
/// <param name="dwLockType">
/// <para>Specifies the type of access restrictions previously placed on the range. This parameter uses a value from the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ne-objidl-locktype">LOCKTYPE</a> enumeration.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-unlockregion#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The byte range was unlocked.| |STG_E_INVALIDFUNCTION | Locking is not supported at all or the specific type of lock requested is not supported.| |STG_E_LOCKVIOLATION | The requested unlock cannot be granted.|</para>
/// </returns>
/// <remarks>
/// <para><b>ILockBytes::UnlockRegion</b> unlocks a region previously locked with a call to <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-ilockbytes-lockregion">ILockBytes::LockRegion</a>. Each region locked must be explicitly unlocked, using the same values for the <i>libOffset</i>, <i>cb</i>, and <i>dwLockType</i> parameters as in the matching calls to <b>ILockBytes::LockRegion</b>. Two adjacent regions cannot be locked separately and then unlocked with a single unlock call.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-unlockregion#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public void UnlockRegion(ulong libOffset, ulong cb, uint dwLockType)
{
((delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[8])((ILockBytes*)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType).ThrowOnFailure();
}
/// <inheritdoc cref="Stat(winmdroot.System.Com.STATSTG*, uint)"/>
internal unsafe void Stat(out winmdroot.System.Com.STATSTG pstatstg, uint grfStatFlag)
{
fixed (winmdroot.System.Com.STATSTG* pstatstgLocal = &pstatstg)
{
this.Stat(pstatstgLocal, grfStatFlag);
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Stat(ILockBytes* pThis, winmdroot.System.Com.STATSTG* pstatstg, uint grfStatFlag)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Stat(pstatstg, grfStatFlag);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The Stat method retrieves a STATSTG structure containing information for this byte array object.</summary>
/// <param name="pstatstg">
/// <para>Pointer to a <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ns-objidl-statstg">STATSTG</a> structure in which this method places information about this byte array object. The pointer is <b>NULL</b> if an error occurs.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-stat#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="grfStatFlag">
/// <para>Specifies whether this method should supply the <b>pwcsName</b> member of the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ns-objidl-statstg">STATSTG</a> structure through values taken from the <a href="https://docs.microsoft.com/windows/desktop/api/wtypes/ne-wtypes-statflag">STATFLAG</a> enumeration. If the STATFLAG_NONAME is specified, the <b>pwcsName</b> member of <b>STATSTG</b> is not supplied, thus saving a memory-allocation operation. The other possible value, STATFLAG_DEFAULT, indicates that all members of the <b>STATSTG</b> structure be supplied.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-stat#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The STATSTG structure was successfully returned at the specified location.| |E_OUTOFMEMORY| The STATSTG structure was not returned due to a lack of memory for the name member in the structure.| |STG_E_ACCESSDENIED | The STATSTG structure was not returned because the caller did not have access to the byte array.| |STG_E_INSUFFICIENTMEMORY | The STATSTG structure was not returned, due to insufficient memory.| |STG_E_INVALIDFLAG | The value for the grfStateFlag parameter is not valid.| |STG_E_INVALIDPOINTER | The value for the pStatStg parameter is not valid.|</para>
/// </returns>
/// <remarks>
/// <para><b>ILockBytes::Stat</b> should supply information about the byte array object in a <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ns-objidl-statstg">STATSTG</a> structure.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-ilockbytes-stat#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe void Stat(winmdroot.System.Com.STATSTG* pstatstg, uint grfStatFlag)
{
((delegate *unmanaged [Stdcall]<ILockBytes*,winmdroot.System.Com.STATSTG* ,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[9])((ILockBytes*)Unsafe.AsPointer(ref this), pstatstg, grfStatFlag).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]<ILockBytes*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;
internal delegate *unmanaged [Stdcall]<ILockBytes*,uint> AddRef_2;
internal delegate *unmanaged [Stdcall]<ILockBytes*,uint> Release_3;
internal delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT> ReadAt_4;
internal delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT> WriteAt_5;
internal delegate *unmanaged [Stdcall]<ILockBytes*,winmdroot.Foundation.HRESULT> Flush_6;
internal delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,winmdroot.Foundation.HRESULT> SetSize_7;
internal delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT> LockRegion_8;
internal delegate *unmanaged [Stdcall]<ILockBytes*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT> UnlockRegion_9;
internal delegate *unmanaged [Stdcall]<ILockBytes*,winmdroot.System.Com.STATSTG* ,uint ,winmdroot.Foundation.HRESULT> Stat_10;
}
public static void PopulateVTable(Vtbl* vtable)
{
vtable->ReadAt_4 = &ReadAt;
vtable->WriteAt_5 = &WriteAt;
vtable->Flush_6 = &Flush;
vtable->SetSize_7 = &SetSize;
vtable->LockRegion_8 = &LockRegion;
vtable->UnlockRegion_9 = &UnlockRegion;
vtable->Stat_10 = &Stat;
}
private void** lpVtbl;
/// <summary>The IID guid for this interface.</summary>
/// <value>{0000000a-0000-0000-c000-000000000046}</value>
internal static readonly Guid IID_Guid = new Guid(0x0000000A, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
static ref readonly Guid IComIID.Guid {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 };
return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
}
}
[Guid("0000000A-0000-0000-C000-000000000046"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
[SupportedOSPlatform("windows5.0")]
internal interface Interface
{
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT ReadAt(ulong ulOffset, void* pv, uint cb, [Optional] uint* pcbRead);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT WriteAt(ulong ulOffset, void* pv, uint cb, [Optional] uint* pcbWritten);
[PreserveSig()]
winmdroot.Foundation.HRESULT Flush();
[PreserveSig()]
winmdroot.Foundation.HRESULT SetSize(ulong cb);
[PreserveSig()]
winmdroot.Foundation.HRESULT LockRegion(ulong libOffset, ulong cb, uint dwLockType);
[PreserveSig()]
winmdroot.Foundation.HRESULT UnlockRegion(ulong libOffset, ulong cb, uint dwLockType);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT Stat(winmdroot.System.Com.STATSTG* pstatstg, uint grfStatFlag);
}
}
}
}
|