Ejemplo n.º 1
0
        private void CallBack(object data)
        {
            NamedPipeServerStream namedPipeServer = null;

            while (true)
            {
                try
                {
                    namedPipeServer = new NamedPipeServerStream(this.myCallBackPipe, PipeDirection.InOut, 254);

                    namedPipeServer.WaitForConnection(); // wait

                    var stream = new PipeStreamSimple(namedPipeServer);

                    List <Tuple <string, object> > list;
                    if (stream.TryRead(out list))
                    {
                        var results = new ClousotAnalysisResults(list);

                        UpdateResults(results);
                    }
                }
                catch
                {
                    // do nothing
                }
                finally
                {
                    if (namedPipeServer != null)
                    {
                        namedPipeServer.Disconnect();
                    }
                }
            }
        }
    private void MainProcess(object data)
    {
#if DEBUG && DEBUG_PRINT
      Console.WriteLine("[DEBUG] Pulse Clousot at named channel {0}", CommonNames.GetPipeNameForCCCheckPulse());
#endif
      
      while (true)
      {
        try
        {
          this.namedPipeServer.WaitForConnection(); // wait for connection

          var stream = new PipeStreamSimple(namedPipeServer);
          
          string obj;

          if (stream.TryRead(out obj))
          {

            if (obj == "shutdown")
            {
              goto done;
            }

            this.callbackNames.AddIfNotNull(obj);
          }
          // Write what Clousot is doing now 
          stream.WriteIfConnected(GetClousotCurrentAnalysisState().ToList());

          this.namedPipeServer.Disconnect();
        }
        catch
        {
          // just swallow the error
        }
      }

    done:
      ;
    }
        private void MainProcess(object data)
        {
#if DEBUG && DEBUG_PRINT
            Console.WriteLine("[DEBUG] Pulse Clousot at named channel {0}", CommonNames.GetPipeNameForCCCheckPulse());
#endif

            while (true)
            {
                try
                {
                    this.namedPipeServer.WaitForConnection(); // wait for connection

                    var stream = new PipeStreamSimple(namedPipeServer);

                    string obj;

                    if (stream.TryRead(out obj))
                    {
                        if (obj == "shutdown")
                        {
                            goto done;
                        }

                        this.callbackNames.AddIfNotNull(obj);
                    }
                    // Write what Clousot is doing now
                    stream.WriteIfConnected(GetClousotCurrentAnalysisState().ToList());

                    this.namedPipeServer.Disconnect();
                }
                catch
                {
                    // just swallow the error
                }
            }

done:
            ;
        }
Ejemplo n.º 4
0
        private void UpdateGrids()
        {
            // Clear the pulse grid
            this.clousotPulseGrid.Rows.Clear();

            var ClousotProcesses = Process.GetProcessesByName("Clousot").Union(Process.GetProcessesByName("cccheck"));

            foreach (var proc in ClousotProcesses)
            {
                var pipeName        = CommonNames.GetPipeNameForCCCheckPulse(proc.Id);
                var namedPipeClient = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut);
                try
                {
                    InsertOrUpdateRowToProcessesGrid(proc);

                    namedPipeClient.Connect(20);
                    var stream = new PipeStreamSimple(namedPipeClient);

                    stream.WriteIfConnected(this.myCallBackPipe);

                    List <Tuple <string, object> > result;
                    if (stream.TryRead(out result))
                    {
                        var obj = new ClousotAnalysisState(result);
                        AddRowToPulseGrid(proc.Id, obj);
                    }
                    else
                    {
                        Trace.TraceWarning("failed to get a meaningfull answer from proc id {0}", proc.Id);
                    }
                }
                catch
                {
                    // does nothing
                }
                namedPipeClient.Close();
            }
        }
Ejemplo n.º 5
0
    private void CallBack(object data)
    {
      NamedPipeServerStream namedPipeServer = null;

      while (true)
      {
        try
        {
          namedPipeServer = new NamedPipeServerStream(this.myCallBackPipe, PipeDirection.InOut, 254);

          namedPipeServer.WaitForConnection(); // wait

          var stream = new PipeStreamSimple(namedPipeServer);

          List<Tuple<string, object>> list;
          if (stream.TryRead(out list))
          {
            var results = new ClousotAnalysisResults(list);

            UpdateResults(results);
          }
        }
        catch
        {
          // do nothing
        }
        finally
        {
          if (namedPipeServer != null)
            namedPipeServer.Disconnect();
        }
      }
    }
Ejemplo n.º 6
0
    private void UpdateGrids()
    {
      // Clear the pulse grid
      this.clousotPulseGrid.Rows.Clear();

      var ClousotProcesses = Process.GetProcessesByName("Clousot").Union(Process.GetProcessesByName("cccheck"));

      foreach (var proc in ClousotProcesses)
      {
        var pipeName = CommonNames.GetPipeNameForCCCheckPulse(proc.Id);
        var namedPipeClient = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut);
        try
        {
           InsertOrUpdateRowToProcessesGrid(proc);

          namedPipeClient.Connect(20);
          var stream = new PipeStreamSimple(namedPipeClient);

          stream.WriteIfConnected(this.myCallBackPipe);

          List<Tuple<string, object>> result;
          if (stream.TryRead(out result))
          {
            var obj = new ClousotAnalysisState(result);
            AddRowToPulseGrid(proc.Id, obj);
          }
          else
          {
            Trace.TraceWarning("failed to get a meaningfull answer from proc id {0}", proc.Id);
          }
        }
        catch
        {
          // does nothing
        }
        namedPipeClient.Close();
      }
    }