public void FilterProcess(Process process, FilterAction action)
        {
            var errorCode = AddFilter(Handle, null, UniqueProcess.FromProcess(process), null, action);

            if (errorCode != 0)
            {
                throw new Win32Exception(errorCode);
            }
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TrackedProcess"/> class from
 /// the specified process information.
 /// </summary>
 /// <param name="process">
 /// The process being tracked.
 /// </param>
 /// <param name="procDumpProcess">
 /// The procdump process attached to <paramref name="process"/>, and responsible
 /// for producing a memory dump if that process should fail.
 /// </param>
 /// <param name="description">
 /// A string that describes the process, of the form "processName-processId".
 /// </param>
 private TrackedProcess(UniqueProcess process, UniqueProcess procDumpProcess, string description)
 {
     Process = process;
     ProcDumpProcess = procDumpProcess;
     Description = description;
 }
 // ReSharper disable once TooManyArguments
 private static extern int AddFilter(
     IntPtr sessionHandle,
     string fileName,
     UniqueProcess application,
     string serviceName,
     FilterAction filterAction);