public WerStore(REPORT_STORE_TYPES type) { hStore = IntPtr.Zero; if (WerStoreOpen(type, ref hStore) != 0 || hStore == IntPtr.Zero) { throw new InvalidOperationException(); } isDisposed = false; }
/// <summary> /// Opens a wer report store and allows you to enumerate the reports it contains. /// If called on an earlier operating system where the relevant APIs do not exist, /// it will return an empty enumerable. /// </summary> /// <param name="type"></param> /// <returns></returns> public static IWerStore GetStore(REPORT_STORE_TYPES type) { if (IsStoreInterfacePresent) { try { return(new WerStore(type)); } catch (InvalidOperationException) { return(new EmptyStore()); } } return(new EmptyStore()); }
private static extern int WerStoreOpen(REPORT_STORE_TYPES storeType, ref IntPtr hResportStore);