using System.Runtime.InteropServices.ComTypes; namespace Vanara.PInvoke; public static partial class Shell32 { /// /// Exposes a method that initializes a handler, such as a property handler, thumbnail handler, or preview handler, with a stream. /// // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nn-propsys-iinitializewithstream [PInvokeData("propsys.h", MSDNShortId = "9050845d-1e70-4e85-8d2f-c8bbb382abe5")] [ComImport, Guid("b824b49d-22ac-4161-ac8a-9916e8fa3f7f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IInitializeWithStream { /// /// Initializes a handler with a stream. /// /// /// Type: IStream* /// A pointer to an IStream interface that represents the stream source. /// /// /// Type: DWORD /// One of the following STGM values that indicates the access mode for . /// STGM_READ /// The stream indicated by is read-only. /// STGM_READWRITE /// The stream indicated by is read/write accessible. /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// /// /// This method is preferred to Initialize due to its ability to use streams that are not accessible through a Win32 path, such /// as the contents of a compressed file with a .zip file name extension. /// /// The stream pointed to by must remain open for the lifetime of the handler or until IPropertyStore::Commit is called. /// /// When first opened, the source stream reference points to the beginning of the stream. The handler can seek and read from the /// stream at any time. A handler can be implemented to read all properties from the stream during Initialize or it can /// wait until the calling process attempts to enumerate or read properties before fetching them from the stream. /// /// /// A handler instance should be initialized only once in its lifetime. Attempts by the caller to reinitialize the handler should /// result in the error . /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/propsys/nf-propsys-iinitializewithstream-initialize [PreserveSig] HRESULT Initialize([In] IStream pstream, STGM grfMode); } }