Error trying to read signatures from a program. (This program can not be run in DOS mode)

0

I was trying to make a program to read signatures, basically, what the anti-virus does. But the error that I come across is this:

  

This program can not be run in DOS mode.

Not even try-catch solves this ...

My code:

string pasta;
Process[] localAll = Process.GetProcesses();
foreach (Process p in localAll)
{
    try
    {
        pasta = p.MainModule.FileName;
        Console.WriteLine("Lendo... " + p.ToString());

        using (StreamReader sr = new StreamReader(pasta))
        {
            string Code = sr.ReadLine();
            if (Code.Contains("ure"))
            {
                Console.WriteLine("Detect.");
                break;
            }
        }
    }
    catch
    {
        Console.WriteLine("Não foi possivel ler... " + p);
    }
}
Console.ReadKey();

What can it be? How to make the program work correctly?

Note: The error is written to the console.

    
asked by anonymous 17.05.2017 / 02:10

0 answers