Пример #1
0
 internal static extern int StartTrace(
     [Out]
     out ulong sessionHandle,
     [In, MarshalAs(UnmanagedType.LPWStr)]
     string sessionName,
     [In, Out]
     ref EventTraceProperties eventTraceProperties);
Пример #2
0
 protected override bool ReleaseHandle()
 {
     EventTraceProperties properties = new EventTraceProperties(true /*initialize*/);
     return NativeMethods.StopTrace(this.sessionHandle, this.loggerName, out properties /*as statistics*/) != 0;
 }
Пример #3
0
 private bool LoadExistingEventTraceProperties()
 {
     const int ERROR_WMI_INSTANCE_NOT_FOUND = 4201;
     this.eventTraceProperties = new EventTraceProperties(true);
     int status = NativeMethods.QueryTrace(0, this.loggerName, ref this.eventTraceProperties);
     if (status == 0) {
         return true;
     }
     else if (status == ERROR_WMI_INSTANCE_NOT_FOUND) {
         // The instance name passed was not recognized as valid by a WMI data provider.
         return false;
     }
     throw new System.ComponentModel.Win32Exception(status);
 }