public Stream12 method_12(string A_0, STGM A_1) { Interface40 interface2; int num = 11; if (A_0 == null) { throw new ArgumentNullException(BookmarkStart.b("䈰䜲娴䔶堸尺堼焾⁀⹂⁄", num)); } this.method_22(); int errorCode = this.interface40_0.imethod_3(A_0, IntPtr.Zero, A_1, IntPtr.Zero, 0, out interface2); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("爰刲嬴夶嘸伺ᴼ倾ㅀ♂⭄杆㩈㹊⽌潎≐❒㩔╖㡘㱚㡜煞䅠ၢၤզ䥨ᡪᥬnͰቲቴቶ奸ᕺᱼቾꎂ뎈ꮊ", num) + A_0, errorCode); } Stream12 stream = new Stream12 { interface40_0 = interface2, string_2 = A_0 }; stream.method_27(); stream.stgm_5 = A_1; return(stream); }
public Stream12 method_14(string A_0, STGM A_1) { Interface40 interface2; int num = 0x11; if (A_0 == null) { throw new ArgumentNullException(BookmarkStart.b("䐶䴸吺似帾♀♂ୄ♆⑈⹊", num)); } this.method_22(); int errorCode = this.interface40_0.imethod_2(A_0, A_1, 0, 0, out interface2); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("琶堸唺匼倾㕀捂⩄㝆ⱈ╊浌㱎ㅒ畔ⵘ㑚⽜㹞٠٢䭤䝦ᩨṪཬ佮ɰݲᩴնᡸᱺ彾ꦈﺌ떎놐", num) + A_0, errorCode); } Stream12 stream = new Stream12 { interface40_0 = interface2, string_2 = A_0 }; interface2 = null; stream.method_27(); stream.stgm_5 = A_1; this.list_1.Add(A_0); return(stream); }
public Stream12(Stream12 A_0, string A_1, STGM A_2, bool A_3) { int num = 0x13; this.long_0 = -1L; this.list_0 = new List <string>(); this.list_1 = new List <string>(); if (A_0 == null) { throw new ArgumentNullException(BookmarkStart.b("䨸伺刼䴾⁀⑂⁄", num)); } if (A_0.interface40_0 == null) { throw new ArgumentException(BookmarkStart.b("倸唺䴼䨾㕀捂㙄㍆♈㥊ⱌ⡎㑐獒㡔≖⩘⽚絜㵞Ѡ䍢ᝦ౨ժ୮", num)); } if (A_1 == null) { throw new ArgumentNullException(BookmarkStart.b("䨸伺似娾⁀⹂ୄ♆⑈⹊", num)); } IntPtr iUnknownForObject = Marshal.GetIUnknownForObject(A_0.interface40_0); this.interface40_0 = (Interface40)Marshal.GetObjectForIUnknown(iUnknownForObject); Marshal.Release(iUnknownForObject); this.stgm_5 = A_0.stgm_5; this.list_1.AddRange(A_0.list_1); this.list_0.AddRange(A_0.list_0); if (A_3) { this.method_16(A_1, A_2); } else { this.method_10(A_1, A_2); } }
static extern int StgOpenStorageOnILockBytes( ILockBytes plkbyt, IStorage pStgPriority, STGM grfMode, IntPtr snbEnclude, uint reserved, out IStorage ppstgOpen);
/// <summary> /// Opens the compound file storage. /// </summary> /// <param name="pwcsName">The path to the compound file to create</param> /// <param name="ppstg">(out) The IStorage representing this compound file</param> /// <returns>True indicates it opened successfully. False indicates that the file /// could not be found.</returns> public bool OpenStorage( string pwcsName, STGM flags, out IStorage ppstg) { if (!ValidateCompoundFileStorage(pwcsName)) { ppstg = null; return(false); } Ole32Storage.STGOPTIONS stgoptions = new Ole32Storage.STGOPTIONS(); stgoptions.usVersion = 1; stgoptions.ulSectorSize = 4096; Guid guidIStorage = typeof(IStorage).GUID; int result = Ole32Storage.StgOpenStorageEx( pwcsName, flags, STGFMT.STGFMT_DOCFILE, 0, ref stgoptions, IntPtr.Zero, ref guidIStorage, out ppstg); if (result != HRESULT.S_OK) { Marshal.ThrowExceptionForHR(result); } return(true); }
public Class491(string A_0, STGM A_1) { Interface40 interface2; int num = 4; if ((A_0 == null) || (A_0.Length == 0)) { throw new ArgumentOutOfRangeException(BookmarkStart.b("䰩䔫䈭唯簱唳嬵崷", num)); } if ((A_1 & STGM.STGM_CREATE) == STGM.STGM_DIRECT) { using (FileStream stream = new FileStream(A_0, FileMode.Open, FileAccess.Read, FileShare.Read)) { this.method_2(stream); return; } } Guid guid = new Guid(BookmarkStart.b("ᨩᰫḭ/ȱгص娷瀿牁楃癅硇穉籋捍ፏ扑摓晕畗橙汛湝偟剡呣噥塧婩屫婭䙯", num)); int errorCode = Class359.StgCreateStorageEx(A_0, A_1, STGFMT.STGFMT_DOCFILE, 0, IntPtr.Zero, IntPtr.Zero, ref guid, out interface2); switch (errorCode) { case -2147287007: case -2147287008: throw new Exception9(); default: if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("椩䴫䀭帯崱䀳ᘵ圷䨹夻倽怿ㅁぃ⥅㩇⭉⭋⭍繏牑ቓ㽕㑗㽙籛ၝşཡţ䙥ŧᥩ噫乭", num) + A_0, errorCode); } this.class1005_0 = new Class1005(interface2); break; } }
/// <summary> /// Opens an existing substorage. /// </summary> /// <param name="pwcsName">The name of the substorage to create</param> /// <param name="writable">Whether to open the storage as writable</param> /// <param name="ppstg">The IStorage that is created</param> public bool OpenStorage( string pwcsName, STGM flags, out IStorage ppstg) { // Note: The compound file implementation of structured // storage requires that all substorages and substreams be opened as share_exclusive (locking // is managed at the file level). try { this.storage.OpenStorage( pwcsName, IntPtr.Zero, flags, IntPtr.Zero, 0, out ppstg ); } catch (COMException e) { if (e.ErrorCode == STG_E.FILENOTFOUND) { ppstg = null; return(false); } throw; } return(true); }
public static extern int StgOpenStorage( [MarshalAs(UnmanagedType.LPTStr)] string pwcsName, IStorage pstgPriority, STGM grfMode, IntPtr snbExclude, // exclude not supported, pass null uint reserved, out IStorage ppstgOpen);
static extern int StgOpenStorage( [MarshalAs(UnmanagedType.LPWStr)] string pwcsName, IStorage pstgPriority, STGM grfMode, IntPtr snbExclude, uint reserved, out IStorage ppstgOpen);
public static extern int StgOpenStorage( [In, MarshalAs(UnmanagedType.LPWStr)] string pwcsName, [In] IStorage pstgPriority, [In] STGM grfMode, [In] IntPtr snbExclude, [In] int reserved, [Out] out IStorage ppstgOpen );
public IStorage OpenStorage(string storageName, STGM mode = STGM.STGM_SHARE_EXCLUSIVE) { IStorage storage; m_Storage.OpenStorage(storageName, null, (uint)mode, IntPtr.Zero, 0, out storage); return(storage); }
static extern void CoGetInstanceFromFile( COSERVERINFO pServerInfo, ref Guid pClsid, [MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, CLSCTX dwClsCtx, STGM grfMode, string pwszName, uint cmq, [In, Out] MULTI_QI[] rgmqResults);
private static extern int StgCreateStorageEx( [MarshalAs(UnmanagedType.LPWStr)] string name, STGM accessMode, STGFMT storageFileFormat, int fileBuffering, IntPtr options, IntPtr reserved, [In, MarshalAs(UnmanagedType.LPStruct)] System.Guid riid, [In, Out, MarshalAs(UnmanagedType.Interface)] ref myIStorage propertySetStorage);
public IStream OpenStream(string streamName, STGM mode = STGM.STGM_SHARE_EXCLUSIVE) { IStream stream = null; m_Storage.OpenStream(streamName, IntPtr.Zero, (uint)mode, 0, out stream); return(stream); }
public static extern int StgOpenStorageEx( [MarshalAs(UnmanagedType.LPTStr)] string pwcsName, STGM grfMode, STGFMT stgfmt, uint grfAttrs, ref STGOPTIONS pStgOptions, IntPtr reserved2, // must be zero ref Guid riid, out IStorage ppObjectOpen );
/// <summary>Wrapper for native <c>CreateBindCtx</c> and <c>SetBindOptions</c>.</summary> /// <param name="openMode"> /// Represents flags that should be used when opening the file that contains the object identified by the moniker. /// </param> /// <param name="timeout"> /// Indicates the amount of time (clock time in milliseconds) that the caller specified to complete the binding operation. /// </param> /// <param name="bindFlags">Flags that control aspects of moniker binding operations.</param> public static IBindCtx CreateBindCtx(STGM openMode = STGM.STGM_READWRITE, TimeSpan timeout = default, BIND_FLAGS bindFlags = 0) { Ole32.CreateBindCtx(0, out IBindCtx ctx).ThrowIfFailed(); if (openMode != STGM.STGM_READWRITE || timeout != TimeSpan.Zero || bindFlags != 0) { BIND_OPTS opts = new() { cbStruct = Marshal.SizeOf(typeof(BIND_OPTS)), grfMode = (int)openMode, dwTickCountDeadline = (int)timeout.TotalMilliseconds, grfFlags = (int)bindFlags }; ctx.SetBindOptions(ref opts); } return(ctx); }
private static IStream CreateStreamOnFile( string fileName, STGM mode, uint attributes, bool create, object cloudStreamHandler) { if (fileName == null) { throw new ArgumentNullException("fileName"); } try { if (IsValidCloudStreamUri(fileName) && cloudStreamHandler != null) { Type cloudStreamHandlerType = cloudStreamHandler.GetType(); MethodInfo getStreamMethod = cloudStreamHandlerType.GetMethod("GetStream"); // MethodInfo equal operator is not defined on TestNet, so we cast to object to do null check if ((object)getStreamMethod == null) { throw new MissingMethodException("The GetStream method cannot be found."); } object[] args = new object[] { fileName, (UInt32)mode, null }; getStreamMethod.Invoke(cloudStreamHandler, args); if (args[2] != null) { return((IStream)args[2]); } else { throw new FileNotFoundException("Failed to create cloud stream on input address.", fileName); } } else { return(SHCreateStreamOnFileEx(fileName, mode, attributes, create, null)); } } catch (FileNotFoundException e) { // Ensure that the exception has a file name attached. if (string.IsNullOrEmpty(e.FileName)) { throw new FileNotFoundException(e.Message, fileName, e.InnerException); } else { throw e; } } }
public int Initialize(string pszFilePath, STGM grfMode) { Log($"Intiailising a file based server for '{pszFilePath}' with mode '{grfMode}'."); // Store the path and mode. SelectedItemPath = pszFilePath; SelectedItemStorageMedium = grfMode; // Return success. return(WinError.S_OK); }
public int Initialize(IShellItem shellItem, STGM accessMode) { Log($"Intiailising a shell item server with mode '{accessMode}'."); // Store the item and mode. SelectedShellItem = shellItem; SelectedShellItemAccessMode = accessMode; // Return success. return(WinError.S_OK); }
/// <summary> /// Initializes a handler with a file path. /// </summary> /// <param name="pszFilePath">A pointer to a buffer that contains the file path as a null-terminated Unicode string.</param> /// <param name="grfMode">One of the following STGM values that indicates the access mode for pszFilePath. STGM_READ or STGM_READWRITE.</param> int IInitializeWithFile.Initialize(string pszFilePath, STGM grfMode) { // Log key events. Log("IObjectWithSite.GetSite called."); // Store the file path. SelectedFilePath = pszFilePath; // Return success. return(WinError.S_OK); }
public override int Initialize(IShellItem shellItem, STGM accessMode) { if (shellItem.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out string path) != WinError.S_OK) { return(WinError.E_UNEXPECTED); } // Show thumbnails only for files (Dont show thumbnails for directories) if (!File.Exists(path)) { return(WinError.E_UNEXPECTED); } filePath = path; return(base.Initialize(shellItem, accessMode)); }
public void method_16(string A_0, STGM A_1) { int num2 = 1; int errorCode = this.interface40_0.imethod_0(A_0, A_1, 0, 0, ref this.interface39_0); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("搦䠨䔪䌬䀮䔰ጲ嘴䔶尸娺䤼娾慀あㅄ㕆ⱈ⩊⁌慎", num2), errorCode); } this.string_1 = A_0; this.list_0.Add(A_0); this.long_1 = 0L; this.bool_2 = (A_1 & (STGM.STGM_READWRITE | STGM.STGM_WRITE)) > STGM.STGM_DIRECT; this.bool_3 = true; this.bool_1 = true; this.bool_4 = (A_1 & STGM.STGM_TRANSACTED) > STGM.STGM_DIRECT; this.method_27(); }
public void method_10(string A_0, STGM A_1) { int num = 3; this.method_22(); if (A_0 == null) { throw new ArgumentNullException(BookmarkStart.b("娨弪弬䨮倰帲笴嘶吸帺", num)); } bool flag = false; for (int i = 0; i < this.list_0.Count; i++) { string strA = this.list_0[i]; if (string.Compare(strA, A_0, true) == 0) { flag = true; A_0 = strA; break; } } if (!flag) { throw new ArgumentException(BookmarkStart.b("怨䔪ബ尮䔰尲䜴嘶常帺ᴼ尾⁀ⵂ⭄⡆㵈歊⽌⩎煐㕒㩔≖㝘㽚絜ⱞᕠᅢd٦Ѩ䭪ᩬٮհ᭲啴ѶॸṺṼᙾꦈꦒ떔", num) + A_0); } if (this.interface39_0 != null) { this.Close(); } int errorCode = this.interface40_0.imethod_1(A_0, 0, A_1, 0, out this.interface39_0); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("樨䨪䌬䄮帰䜲ᔴ堶䤸帺匼Ἶ㉀㝂㝄≆⡈♊捌", num), errorCode); } this.long_0 = this.method_24(); this.long_1 = 0L; this.bool_2 = (A_1 & (STGM.STGM_READWRITE | STGM.STGM_WRITE)) > STGM.STGM_DIRECT; this.bool_3 = true; this.bool_1 = true; this.bool_4 = (A_1 & STGM.STGM_TRANSACTED) > STGM.STGM_DIRECT; this.string_1 = A_0; this.stgm_6 = A_1; }
public Stream12(string A_0, STGM A_1) { int num2 = 4; this.long_0 = -1L; this.list_0 = new List <string>(); this.list_1 = new List <string>(); if (A_0 == null) { throw new ArgumentNullException(BookmarkStart.b("䰩䔫䈭唯簱唳嬵崷", num2)); } int errorCode = Class359.StgOpenStorage(A_0, IntPtr.Zero, A_1, IntPtr.Zero, 0, out this.interface40_0); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("椩䴫䀭帯崱䀳ᘵ圷䨹夻倽怿ㅁぃ⥅㩇⭉⭋⭍繏牑ቓ㽕㑗㽙籛ၝşཡţ䙥ŧᥩ噫乭", num2) + A_0, errorCode); } this.method_27(); this.string_0 = A_0; this.stgm_5 = A_1; }
public Stream12(Stream A_0, STGM A_1) { uint num3; int num4 = 7; this.long_0 = -1L; this.list_0 = new List <string>(); this.list_1 = new List <string>(); if (A_0 is Stream12) { throw new ArgumentException(BookmarkStart.b("搬嬮ᄰ娲䘴᜶樸伺娼氾㕀ㅂ⁄♆⑈歊ⱌ⍎⍐㙒㑔㍖⁘畚", num4)); } int errorCode = Class359.CreateILockBytesOnHGlobal(IntPtr.Zero, true, out this.interface65_0); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("測丮弰ᐲ䄴᜶娸䤺堼帾㕀♂敄♈⡊♌ൎ⡐❒ご睘", num4), errorCode); } int count = (int)(A_0.Length - A_0.Position); byte[] buffer = new byte[count]; A_0.Read(buffer, 0, count); errorCode = this.interface65_0.imethod_1(0L, buffer, (uint)buffer.Length, out num3); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("測丮弰ᐲ䄴᜶丸䤺吼䬾⑀捂ॄ⡆⩈⁊ཌ㙎═㙒♔祖", num4), errorCode); } errorCode = this.interface65_0.imethod_2(); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("測丮弰ᐲ䄴᜶弸场䠼䰾⥀捂ॄ⡆⩈⁊ཌ㙎═㙒♔祖", num4), errorCode); } errorCode = Class359.StgOpenStorageOnILockBytes(this.interface65_0, null, A_1, 0, 0, out this.interface40_0); if (errorCode != 0) { throw new ExternalException(BookmarkStart.b("測丮弰ᐲ䄴᜶嘸䬺堼儾慀あㅄ⡆㭈⩊⩌⩎煐㱒㭔睖ᕘ㑚㹜㑞⍠ᩢᅤɦᩨ䕪", num4), errorCode); } this.method_27(); this.stgm_5 = A_1; }
public void InitializeAppInfo(string installedLocation) { Location = installedLocation; var path = Path.Combine(installedLocation, "AppxManifest.xml"); var namespaces = XmlNamespaces(path); InitPackageVersion(namespaces); const uint noAttribute = 0x80; const STGM exclusiveRead = STGM.READ; var hResult = NativeMethods.SHCreateStreamOnFileEx(path, exclusiveRead, noAttribute, false, null, out IStream stream); if (hResult == HRESULT.S_OK) { Apps = AppxPackageHelper.GetAppsFromManifest(stream).Select(appInManifest => new UWPApplication(appInManifest, this)).Where(a => { var valid = !string.IsNullOrEmpty(a.UserModelId) && !string.IsNullOrEmpty(a.DisplayName) && a.AppListEntry != "none"; return(valid); }).ToList(); if (Marshal.ReleaseComObject(stream) > 0) { Log.Error("AppxManifest.xml was leaked", MethodBase.GetCurrentMethod().DeclaringType); } } else { var e = Marshal.GetExceptionForHR((int)hResult); ProgramLogger.Exception("Error caused while trying to get the details of the UWP program", e, GetType(), path); Apps = Array.Empty <UWPApplication>(); } }
public static extern int StgCreateDocfileOnILockBytes(ILockBytes plkbyt, STGM grfMode, uint reserved, out IStorage ppstgOpen);
/// <summary> /// Initializes a handler with a file path. /// </summary> /// <param name="pszFilePath">A pointer to a buffer that contains the file path as a null-terminated Unicode string.</param> /// <param name="grfMode">One of the following STGM values that indicates the access mode for pszFilePath. STGM_READ or STGM_READWRITE.</param> int IInitializeWithFile.Initialize(string pszFilePath, STGM grfMode) { // DebugLog key events. Log("IObjectWithSite.GetSite called."); // Store the file path. SelectedFilePath = pszFilePath; // Return success. return WinError.S_OK; }
public StreamWrapper OpenStream(string name, STGM mode) { return(new StreamWrapper(_stg.OpenStream(name, IntPtr.Zero, mode, 0))); }
public StorageWrapper OpenStorage(string name, STGM mode) { return(new StorageWrapper(_stg.OpenStorage(name, IntPtr.Zero, mode, IntPtr.Zero, 0))); }
static extern int StgCreateDocfileOnILockBytes(ILockBytes plkbyt, STGM grfMode, int reserved, out IStorage ppstgOpen);
static extern int StgCreateDocfile([MarshalAs(UnmanagedType.LPWStr)]string pwcsName, STGM grfMode, uint reserved, out IOleStorage ppstgOpen);
public static extern int StgOpenStorage([MarshalAs(UnmanagedType.LPWStr)] string pwcsName, IStorage pstgPriority, STGM grfMode, IntPtr snbExclude, int reserved, [MarshalAs(UnmanagedType.Interface)] ref IStorage storage);
public static extern IStorage StgOpenStorageOnILockBytes(ILockBytes iLockBytes, IStorage pStgPriority, STGM grfMode, IntPtr snbExclude, uint reserved);
public static extern void SHCreateStreamOnFile(string pszFile, STGM grfMode, out IntPtr ppStm);
static extern void SHCreateStreamOnFile( string pszFile, STGM grfMode, out IStream ppstm );
static extern void StgCreateDocfileOnILockBytes( IntPtr plkbyt, STGM grfMode, uint reserved, out IStorage ppstgOpen);
/// <summary> /// Opens an existing substorage. /// </summary> /// <param name="pwcsName">The name of the substorage to create</param> /// <param name="writable">Whether to open the storage as writable</param> /// <param name="ppstg">The IStorage that is created</param> public bool OpenStorage( string pwcsName, STGM flags, out IStorage ppstg) { // Note: The compound file implementation of structured // storage requires that all substorages and substreams be opened as share_exclusive (locking // is managed at the file level). try { this.storage.OpenStorage( pwcsName, IntPtr.Zero, flags, IntPtr.Zero, 0, out ppstg ); } catch (COMException e) { if (e.ErrorCode == STG_E.FILENOTFOUND) { ppstg = null; return false; } throw; } return true; }
/// <summary> /// Opens the compound file storage. /// </summary> /// <param name="pwcsName">The path to the compound file to create</param> /// <param name="ppstg">(out) The IStorage representing this compound file</param> /// <returns>True indicates it opened successfully. False indicates that the file /// could not be found.</returns> public bool OpenStorage( string pwcsName, STGM flags, out IStorage ppstg) { if (!ValidateCompoundFileStorage(pwcsName)) { ppstg = null; return false; } Ole32Storage.STGOPTIONS stgoptions = new Ole32Storage.STGOPTIONS(); stgoptions.usVersion = 1; stgoptions.ulSectorSize = 4096; Guid guidIStorage = typeof(IStorage).GUID; int result = Ole32Storage.StgOpenStorageEx( pwcsName, flags, STGFMT.STGFMT_DOCFILE, 0, ref stgoptions, IntPtr.Zero, ref guidIStorage, out ppstg); if (result != HRESULT.S_OK) Marshal.ThrowExceptionForHR(result); return true; }