public unsafe void Stat(Interop.Ole32.STATSTG *pstatstg, Interop.Ole32.STATFLAG grfStatFlag) { if (pstatstg == null) { throw new ArgumentNullException(nameof(pstatstg)); } *pstatstg = new Interop.Ole32.STATSTG { cbSize = (ulong)_dataStream.Length, type = Interop.Ole32.STGTY.STGTY_STREAM, // Default read/write access is STGM_READ, which == 0 grfMode = _dataStream.CanWrite ? _dataStream.CanRead ? Interop.Ole32.STGM.STGM_READWRITE : Interop.Ole32.STGM.STGM_WRITE : Interop.Ole32.STGM.Default }; if (grfStatFlag == Interop.Ole32.STATFLAG.STATFLAG_DEFAULT) { // Caller wants a name pstatstg->AllocName(_dataStream is FileStream fs ? fs.Name : _dataStream.ToString()); } }
private static int Stat(IntPtr thisPtr, Interop.Ole32.STATSTG *pstatstg, Interop.Ole32.STATFLAG grfStatFlag) { try { Interop.Ole32.IStream instance = ComInterfaceDispatch.GetInstance <Interop.Ole32.IStream>((ComInterfaceDispatch *)thisPtr); instance.Stat(out *pstatstg, grfStatFlag); return(S_OK); } catch (Exception ex) { Debug.WriteLine(ex); return(ex.HResult); } }
private static int Stat(IntPtr thisPtr, Interop.Ole32.STATSTG *pstatstg, Interop.Ole32.STATFLAG grfStatFlag) { try { Interop.Ole32.IStream inst = ComInterfaceDispatch.GetInstance <Interop.Ole32.IStream>((ComInterfaceDispatch *)thisPtr); inst.Stat(pstatstg, grfStatFlag); } catch (Exception e) { return(e.HResult); } return(S_OK); }
public void Stat(out Interop.Ole32.STATSTG pstatstg, Interop.Ole32.STATFLAG grfStatFlag) { pstatstg = new Interop.Ole32.STATSTG { cbSize = (ulong)_dataStream.Length, type = Interop.Ole32.STGTY.STGTY_STREAM, // Default read/write access is STGM_READ, which == 0 grfMode = _dataStream.CanWrite ? _dataStream.CanRead ? Interop.Ole32.STGM.STGM_READWRITE : Interop.Ole32.STGM.STGM_WRITE : Interop.Ole32.STGM.Default }; if (grfStatFlag == Interop.Ole32.STATFLAG.STATFLAG_DEFAULT) { // Caller wants a name pstatstg.AllocName(_dataStream is FileStream fs ? fs.Name : _dataStream.ToString()); } }