JohnnyBlazer
July 29th, 2009, 07:56 AM
Hello guys,
Does someone know how I can get a checksum (in C#) of a running process and probably locked, like svchost or a program in use, like FireFox? I get access denied when trying to open it using this method:
protected string GetMD5HashFromFile(string fileName)
{
FileStream file = new FileStream(fileName, FileMode.Open);
MD5 md5 = new MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(file);
file.Close();
ASCIIEncoding enc = new ASCIIEncoding();
return enc.GetString(retVal);
}
Source: http://sharpertutorials.com/calculate-md5-checksum-file/
AntiVirus programs compare file hashes to check the files legitimacy, so it must be possible.
Thanks in advance.
Regards,
John
Does someone know how I can get a checksum (in C#) of a running process and probably locked, like svchost or a program in use, like FireFox? I get access denied when trying to open it using this method:
protected string GetMD5HashFromFile(string fileName)
{
FileStream file = new FileStream(fileName, FileMode.Open);
MD5 md5 = new MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(file);
file.Close();
ASCIIEncoding enc = new ASCIIEncoding();
return enc.GetString(retVal);
}
Source: http://sharpertutorials.com/calculate-md5-checksum-file/
AntiVirus programs compare file hashes to check the files legitimacy, so it must be possible.
Thanks in advance.
Regards,
John