|
// ------------------------------------------------------------------------------
// <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
{
[Guid("0000000C-0000-0000-C000-000000000046")]
[SupportedOSPlatform("windows5.0")]
[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
internal unsafe partial struct IStream
:IVTable<IStream,IStream.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]<IStream*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IStream*)Unsafe.AsPointer(ref this), riid, ppvObject);
}
public uint AddRef()
{
return ((delegate *unmanaged [Stdcall]<IStream*,uint>)lpVtbl[1])((IStream*)Unsafe.AsPointer(ref this));
}
public uint Release()
{
return ((delegate *unmanaged [Stdcall]<IStream*,uint>)lpVtbl[2])((IStream*)Unsafe.AsPointer(ref this));
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Read(IStream* pThis, 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.Read(pv, cb, pcbRead);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
public unsafe winmdroot.Foundation.HRESULT Read(void* pv, uint cb, [Optional] uint* pcbRead)
{
return ((delegate *unmanaged [Stdcall]<IStream*,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IStream*)Unsafe.AsPointer(ref this), pv, cb, pcbRead);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Write(IStream* pThis, 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.Write(pv, cb, pcbWritten);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
public unsafe winmdroot.Foundation.HRESULT Write(void* pv, uint cb, [Optional] uint* pcbWritten)
{
return ((delegate *unmanaged [Stdcall]<IStream*,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IStream*)Unsafe.AsPointer(ref this), pv, cb, pcbWritten);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Seek(IStream* pThis, long dlibMove, global::System.IO.SeekOrigin dwOrigin, [Optional] ulong* plibNewPosition)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Seek(dlibMove, dwOrigin, plibNewPosition);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Changes the seek pointer to a new location. The new location is relative to either the beginning of the stream, the end of the stream, or the current seek pointer.</summary>
/// <param name="dlibMove">The displacement to be added to the location indicated by the <i>dwOrigin</i> parameter. If <i>dwOrigin</i> is <b>STREAM_SEEK_SET</b>, this is interpreted as an unsigned value rather than a signed value.</param>
/// <param name="dwOrigin">The origin for the displacement specified in <i>dlibMove</i>. The origin can be the beginning of the file (<b>STREAM_SEEK_SET</b>), the current seek pointer (<b>STREAM_SEEK_CUR</b>), or the end of the file (<b>STREAM_SEEK_END</b>). For more information about values, see the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ne-objidl-stream_seek">STREAM_SEEK</a> enumeration.</param>
/// <param name="plibNewPosition">
/// <para>A pointer to the location where this method writes the value of the new seek pointer from the beginning of the stream. You can set this pointer to <b>NULL</b>. In this case, this method does not provide the new seek pointer.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-seek#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 seek pointer was successfully adjusted.| |E_PENDING | Asynchronous Storage only: Part or all of the stream data is currently unavailable. | |STG_E_INVALIDPOINTER | Indicates that *plibNewPosition* points to invalid memory, because *plibNewPosition* is not read.| |STG_E_INVALIDFUNCTION | The *dwOrigin* parameter contains an invalid value, or the *dlibMove* parameter contains a bad offset value. For example, the result of the seek pointer is a negative offset value.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para><b>IStream::Seek</b> changes the seek pointer so that subsequent read and write operations can be performed at a different location in the stream object. It is an error to seek before the beginning of the stream. It is not, however, an error to seek past the end of the stream. Seeking past the end of the stream is useful for subsequent write operations, as the stream byte range will be extended to the new seek position immediately before the write is complete. You can also use this method to obtain the current value of the seek pointer by calling this method with the <i>dwOrigin</i> parameter set to <b>STREAM_SEEK_CUR</b> and the <i>dlibMove</i> parameter set to 0 so that the seek pointer is not changed. The current seek pointer is returned in the <i>plibNewPosition</i> parameter.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-seek#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe winmdroot.Foundation.HRESULT Seek(long dlibMove, global::System.IO.SeekOrigin dwOrigin, [Optional] ulong* plibNewPosition)
{
return ((delegate *unmanaged [Stdcall]<IStream*,long ,global::System.IO.SeekOrigin ,ulong* ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((IStream*)Unsafe.AsPointer(ref this), dlibMove, dwOrigin, plibNewPosition);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT SetSize(IStream* pThis, ulong libNewSize)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.SetSize(libNewSize);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Changes the size of the stream object.</summary>
/// <param name="libNewSize">Specifies the new size, in bytes, of the stream.</param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The size of the stream object was successfully changed.| |E_PENDING | Asynchronous Storage only: Part or all of the stream's data is currently unavailable.| |STG_E_MEDIUMFULL | The stream size is not changed because there is no space left on the storage device.| |STG_E_INVALIDFUNCTION | The value of the *libNewSize* parameter is not supported by the implementation. Not all streams support greater than 232 bytes. If a stream does not support more than 232 bytes, the high DWORD data type of *libNewSize* must be zero. If it is nonzero, the implementation may return STG_E_INVALIDFUNCTION. In general, COM-based implementations of the IStream interface do not support streams larger than 232 bytes.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para><b>IStream::SetSize</b> changes the size of the stream object. Call this method to preallocate space for the stream. If the <i>libNewSize</i> parameter is larger than the current stream size, the stream is extended to the indicated size by filling the intervening space with bytes of undefined value. This operation is similar to the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-isequentialstream-write">ISequentialStream::Write</a> method if the seek pointer is past the current end of the stream. If the <i>libNewSize</i> parameter is smaller than the current stream, the stream is truncated to the indicated size. The seek pointer is not affected by the change in stream size. Calling <b>IStream::SetSize</b> can be an effective way to obtain a large chunk of contiguous space.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-setsize#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public winmdroot.Foundation.HRESULT SetSize(ulong libNewSize)
{
return ((delegate *unmanaged [Stdcall]<IStream*,ulong ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((IStream*)Unsafe.AsPointer(ref this), libNewSize);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT CopyTo(IStream* pThis, winmdroot.System.Com.IStream* pstm, ulong cb, [Optional] ulong* pcbRead, [Optional] ulong* pcbWritten)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.CopyTo(pstm, cb, pcbRead, pcbWritten);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>Copies a specified number of bytes from the current seek pointer in the stream to the current seek pointer in another stream.</summary>
/// <param name="pstm">A pointer to the destination stream. The stream pointed to by <i>pstm</i> can be a new stream or a clone of the source stream.</param>
/// <param name="cb">The number of bytes to copy from the source stream.</param>
/// <param name="pcbRead">A pointer to the location where this method writes the actual number of bytes read from the source. You can set this pointer to <b>NULL</b>. In this case, this method does not provide the actual number of bytes read.</param>
/// <param name="pcbWritten">A pointer to the location where this method writes the actual number of bytes written to the destination. You can set this pointer to <b>NULL</b>. 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 | The stream object was successfully copied.| |E_PENDING | Asynchronous Storage only: Part or all of the data to be copied is currently unavailable. | |STG_E_INVALIDPOINTER | The value of one of the pointer parameters is invalid.| |STG_E_MEDIUMFULL | The stream is not copied because there is no space left on the storage device.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para>The <b>CopyTo</b> method copies the specified bytes from one stream to another. It can also be used to copy a stream to itself. The seek pointer in each stream instance is adjusted for the number of bytes read or written. This method is equivalent to reading <i>cb</i> bytes into memory using <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-isequentialstream-read">ISequentialStream::Read</a> and then immediately writing them to the destination stream using <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-isequentialstream-write">ISequentialStream::Write</a>, although <b>IStream::CopyTo</b> will be more efficient. The destination stream can be a clone of the source stream created by calling the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-istream-clone">IStream::Clone</a> method. If <b>IStream::CopyTo</b> returns an error, you cannot assume that the seek pointers are valid for either the source or destination. Additionally, the values of <i>pcbRead</i> and <i>pcbWritten</i> are not meaningful even though they are returned. If <b>IStream::CopyTo</b> returns successfully, the actual number of bytes read and written are the same. To copy the remainder of the source from the current seek pointer, specify the maximum large integer value for the <i>cb</i> parameter. If the seek pointer is the beginning of the stream, this operation copies the entire stream.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-copyto#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe winmdroot.Foundation.HRESULT CopyTo(winmdroot.System.Com.IStream* pstm, ulong cb, [Optional] ulong* pcbRead, [Optional] ulong* pcbWritten)
{
return ((delegate *unmanaged [Stdcall]<IStream*,winmdroot.System.Com.IStream* ,ulong ,ulong* ,ulong* ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((IStream*)Unsafe.AsPointer(ref this), pstm, cb, pcbRead, pcbWritten);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Commit(IStream* pThis, uint grfCommitFlags)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Commit(grfCommitFlags);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The Commit method ensures that any changes made to a stream object open in transacted mode are reflected in the parent storage.</summary>
/// <param name="grfCommitFlags">
/// <para>Controls how the changes for the stream object are committed. See the <a href="https://docs.microsoft.com/windows/desktop/api/wtypes/ne-wtypes-stgc">STGC</a> enumeration for a definition of these values.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-commit#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 | Changes to the stream object were successfully committed to the parent level.| |E_PENDING | Asynchronous Storage only: Part or all of the stream's data is currently unavailable. | |STG_E_MEDIUMFULL | The commit operation failed due to lack of space on the storage device.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para>The <b>Commit</b> method ensures that changes to a stream object opened in transacted mode are reflected in the parent storage. Changes that have been made to the stream since it was opened or last committed are reflected to the parent storage object. If the parent is opened in transacted mode, the parent may revert at a later time, rolling back the changes to this stream object. The compound file implementation does not support the opening of streams in transacted mode, so this method has very little effect other than to flush memory buffers. For more information, see <a href="https://docs.microsoft.com/windows/desktop/Stg/istream-compound-file-implementation">IStream - Compound File Implementation</a>. If the stream is open in direct mode, this method ensures that any memory buffers have been flushed out to the underlying storage object. This is much like a flush in traditional file systems. The <b>IStream::Commit</b> method is useful on a direct mode stream when the implementation of the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-istream">IStream</a> interface is a wrapper for underlying file system APIs. In this case, <b>IStream::Commit</b> would be connected to the file system's flush call.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-commit#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public winmdroot.Foundation.HRESULT Commit(uint grfCommitFlags)
{
return ((delegate *unmanaged [Stdcall]<IStream*,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[8])((IStream*)Unsafe.AsPointer(ref this), grfCommitFlags);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Revert(IStream* pThis)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Revert();
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The Revert method discards all changes that have been made to a transacted stream since the last IStream::Commit call. On streams open in direct mode and streams using the COM compound file implementation of IStream::Revert, this method has no effect.</summary>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The stream was successfully reverted to its previous version.| |E_PENDING | Asynchronous Storage only: Part or all of the stream's data is currently unavailable. |</para>
/// </returns>
/// <remarks>The <b>Revert</b> method discards changes made to a transacted stream since the last commit operation.</remarks>
public winmdroot.Foundation.HRESULT Revert()
{
return ((delegate *unmanaged [Stdcall]<IStream*,winmdroot.Foundation.HRESULT>)lpVtbl[9])((IStream*)Unsafe.AsPointer(ref this));
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT LockRegion(IStream* 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 stream.</summary>
/// <param name="libOffset">Integer that specifies the byte offset for the beginning of the range.</param>
/// <param name="cb">Integer that specifies the length of the range, in bytes, to be restricted.</param>
/// <param name="dwLockType">Specifies the restrictions being requested on accessing the range.</param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The specified range of bytes was locked.| |E_PENDING | Asynchronous Storage only: Part or all of the stream's data is currently unavailable. | |STG_E_INVALIDFUNCTION | Locking is not supported at all or the specific type of lock requested is not supported.| |STG_E_LOCKVIOLATION | Requested lock is supported, but cannot be granted because of an existing lock.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para>The byte range of the stream can be extended. Locking an extended range for the stream is useful as a method of communication between different instances of the stream without changing data that is actually part of the stream. Three types of locking can be supported: 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, which is usually an alias for one of the other two lock types. A given stream instance might support either of the first two types, or both. The lock type is specified by <i>dwLockType</i>, using a value from the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ne-objidl-locktype">LOCKTYPE</a> enumeration. Any region locked with <b>IStream::LockRegion</b> must later be explicitly unlocked by calling <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-istream-unlockregion">IStream::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-istream">IStream</a>, you must provide code to deal with the STG_E_INVALIDFUNCTION error. The <b>LockRegion</b> method has no effect in the compound file implementation, because the implementation does not support range locking. <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 is optional for implementations of stream objects since it may not be supported by the underlying file system. The type of locking supported is also optional. The STG_E_INVALIDFUNCTION error is returned if the requested type of locking is not supported.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-lockregion#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public winmdroot.Foundation.HRESULT LockRegion(ulong libOffset, ulong cb, uint dwLockType)
{
return ((delegate *unmanaged [Stdcall]<IStream*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[10])((IStream*)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT UnlockRegion(IStream* 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 range of bytes previously restricted with IStream::LockRegion.</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">Specifies the access restrictions previously placed on the range.</param>
/// <returns>
/// <para>This method can return one of these values. | Return code | Description | |----------------|---------------| |S_OK | The byte range was unlocked.| |E_PENDING | Asynchronous Storage only: Part or all of the stream's data is currently unavailable.| |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 operation cannot be granted.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para><b>IStream::UnlockRegion</b> unlocks a region previously locked with the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-istream-lockregion">IStream::LockRegion</a> method. Locked regions must later be explicitly unlocked by calling <b>IStream::UnlockRegion</b> 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.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-unlockregion#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public winmdroot.Foundation.HRESULT UnlockRegion(ulong libOffset, ulong cb, uint dwLockType)
{
return ((delegate *unmanaged [Stdcall]<IStream*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[11])((IStream*)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType);
}
/// <inheritdoc cref="Stat(winmdroot.System.Com.STATSTG*, uint)"/>
internal unsafe winmdroot.Foundation.HRESULT Stat(out winmdroot.System.Com.STATSTG pstatstg, uint grfStatFlag)
{
fixed (winmdroot.System.Com.STATSTG* pstatstgLocal = &pstatstg)
{
winmdroot.Foundation.HRESULT __result = this.Stat(pstatstgLocal, grfStatFlag);
return __result;
}
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Stat(IStream* 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 the STATSTG structure for this stream.</summary>
/// <param name="pstatstg">
/// <para>Pointer to a <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ns-objidl-statstg">STATSTG</a> structure where this method places information about this stream object.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-stat#parameters">Read more on docs.microsoft.com</see>.</para>
/// </param>
/// <param name="grfStatFlag">
/// <para>Specifies that this method does not return some of the members in the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ns-objidl-statstg">STATSTG</a> structure, thus saving a memory allocation operation. Values are taken from the <a href="https://docs.microsoft.com/windows/desktop/api/wtypes/ne-wtypes-statflag">STATFLAG</a> enumeration.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-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_PENDING | Asynchronous Storage only: Part or all of the stream's data is currently unavailable. | |STG_E_ACCESSDENIED | The caller does not have enough permissions for accessing statistics for this storage object.| |STG_E_INSUFFICIENTMEMORY | The STATSTG structure was not returned due to a lack of memory.| |STG_E_INVALIDFLAG | The value for the *grfStateFlag* parameter is not valid.| |STG_E_INVALIDPOINTER | The *pStatStg* pointer is not valid.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para><b>IStream::Stat</b> retrieves a pointer to the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/ns-objidl-statstg">STATSTG</a> structure that contains information about this open stream. When this stream is within a structured storage and <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nf-objidl-istorage-enumelements">IStorage::EnumElements</a> is called, it creates an enumerator object with the <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-ienumstatstg">IEnumSTATSTG</a> interface on it, which can be called to enumerate the storages and streams through the <b>STATSTG</b> structures associated with each of them.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-stat#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe winmdroot.Foundation.HRESULT Stat(winmdroot.System.Com.STATSTG* pstatstg, uint grfStatFlag)
{
return ((delegate *unmanaged [Stdcall]<IStream*,winmdroot.System.Com.STATSTG* ,uint ,winmdroot.Foundation.HRESULT>)lpVtbl[12])((IStream*)Unsafe.AsPointer(ref this), pstatstg, grfStatFlag);
}
[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
private static winmdroot.Foundation.HRESULT Clone(IStream* pThis, winmdroot.System.Com.IStream** ppstm)
{
try
{
winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
if (__hr.Failed)
{
return __hr;
}
return __object.Clone(ppstm);
}
catch (Exception ex)
{
return (winmdroot.Foundation.HRESULT)ex.HResult;
}
}
/// <summary>The Clone method creates a new stream object with its own seek pointer that references the same bytes as the original stream.</summary>
/// <param name="ppstm">
/// <para>When successful, pointer to the location of an <a href="https://docs.microsoft.com/windows/desktop/api/objidl/nn-objidl-istream">IStream</a> pointer to the new stream object. If an error occurs, this parameter is <b>NULL</b>.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-clone#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 stream was successfully cloned.| |E_PENDING | Asynchronous Storage only: Part or all of the stream's data is currently unavailable. | |STG_E_INSUFFICIENTMEMORY | The stream was not cloned due to a lack of memory.| |STG_E_INVALIDPOINTER | The ppStm pointer is not valid.| |STG_E_REVERTED | The object has been invalidated by a revert operation above it in the transaction tree.|</para>
/// </returns>
/// <remarks>
/// <para>The <b>Clone</b> method creates a new stream object for accessing the same bytes but using a separate seek pointer. The new stream object sees the same data as the source-stream object. Changes written to one object are immediately visible in the other. Range locking is shared between the stream objects. The initial setting of the seek pointer in the cloned stream instance is the same as the current setting of the seek pointer in the original stream at the time of the clone operation.</para>
/// <para><see href="https://learn.microsoft.com/windows/win32/api/objidl/nf-objidl-istream-clone#">Read more on docs.microsoft.com</see>.</para>
/// </remarks>
public unsafe winmdroot.Foundation.HRESULT Clone(winmdroot.System.Com.IStream** ppstm)
{
return ((delegate *unmanaged [Stdcall]<IStream*,winmdroot.System.Com.IStream** ,winmdroot.Foundation.HRESULT>)lpVtbl[13])((IStream*)Unsafe.AsPointer(ref this), ppstm);
}
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]<IStream*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;
internal delegate *unmanaged [Stdcall]<IStream*,uint> AddRef_2;
internal delegate *unmanaged [Stdcall]<IStream*,uint> Release_3;
internal delegate *unmanaged [Stdcall]<IStream*,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT> Read_4;
internal delegate *unmanaged [Stdcall]<IStream*,void* ,uint ,uint* ,winmdroot.Foundation.HRESULT> Write_5;
internal delegate *unmanaged [Stdcall]<IStream*,long ,global::System.IO.SeekOrigin ,ulong* ,winmdroot.Foundation.HRESULT> Seek_6;
internal delegate *unmanaged [Stdcall]<IStream*,ulong ,winmdroot.Foundation.HRESULT> SetSize_7;
internal delegate *unmanaged [Stdcall]<IStream*,winmdroot.System.Com.IStream* ,ulong ,ulong* ,ulong* ,winmdroot.Foundation.HRESULT> CopyTo_8;
internal delegate *unmanaged [Stdcall]<IStream*,uint ,winmdroot.Foundation.HRESULT> Commit_9;
internal delegate *unmanaged [Stdcall]<IStream*,winmdroot.Foundation.HRESULT> Revert_10;
internal delegate *unmanaged [Stdcall]<IStream*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT> LockRegion_11;
internal delegate *unmanaged [Stdcall]<IStream*,ulong ,ulong ,uint ,winmdroot.Foundation.HRESULT> UnlockRegion_12;
internal delegate *unmanaged [Stdcall]<IStream*,winmdroot.System.Com.STATSTG* ,uint ,winmdroot.Foundation.HRESULT> Stat_13;
internal delegate *unmanaged [Stdcall]<IStream*,winmdroot.System.Com.IStream** ,winmdroot.Foundation.HRESULT> Clone_14;
}
public static void PopulateVTable(Vtbl* vtable)
{
vtable->Read_4 = &Read;
vtable->Write_5 = &Write;
vtable->Seek_6 = &Seek;
vtable->SetSize_7 = &SetSize;
vtable->CopyTo_8 = &CopyTo;
vtable->Commit_9 = &Commit;
vtable->Revert_10 = &Revert;
vtable->LockRegion_11 = &LockRegion;
vtable->UnlockRegion_12 = &UnlockRegion;
vtable->Stat_13 = &Stat;
vtable->Clone_14 = &Clone;
}
private void** lpVtbl;
/// <summary>The IID guid for this interface.</summary>
/// <value>{0000000c-0000-0000-c000-000000000046}</value>
internal static readonly Guid IID_Guid = new Guid(0x0000000C, 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[] {
0x0C,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("0000000C-0000-0000-C000-000000000046"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
[SupportedOSPlatform("windows5.0")]
internal interface Interface
:winmdroot.System.Com.ISequentialStream.Interface {
[PreserveSig()]
unsafe new winmdroot.Foundation.HRESULT Read(void* pv, uint cb, [Optional] uint* pcbRead);
[PreserveSig()]
unsafe new winmdroot.Foundation.HRESULT Write(void* pv, uint cb, [Optional] uint* pcbWritten);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT Seek(long dlibMove, global::System.IO.SeekOrigin dwOrigin, [Optional] ulong* plibNewPosition);
[PreserveSig()]
winmdroot.Foundation.HRESULT SetSize(ulong libNewSize);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT CopyTo(winmdroot.System.Com.IStream* pstm, ulong cb, [Optional] ulong* pcbRead, [Optional] ulong* pcbWritten);
[PreserveSig()]
winmdroot.Foundation.HRESULT Commit(uint grfCommitFlags);
[PreserveSig()]
winmdroot.Foundation.HRESULT Revert();
[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);
[PreserveSig()]
unsafe winmdroot.Foundation.HRESULT Clone(winmdroot.System.Com.IStream** ppstm);
}
}
}
}
|