SHCreateStreamOnFile

[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
public static extern int SHCreateStreamOnFile(
   [MarshalAs(UnmanagedType.LPWStr)] string pszFile,
   STGM dwMode,
   out IStream ppstm
);

Microsoft documentation: Link

Last updated