hey guyz please help me. i am planning to create a software to delete a cartain file from a removable drive(autorun.inf) its normally created by a virus you know, what i want is to make a program using c#
1) which can identify removable drive
2)read autorun.inf file
3)find the "open=??????" tag from autorun.inf
4)delete autorun & the file mentioned in "open" tag.
can u help me please???????????
my e-mail id:[email protected]
please dont neglet this message
Loading
Master BillaPosted Aug 12, 2009, 11:56 PM
I have write core method do this operation, you can customize what ever you wanna.
private void ReadRemoveDiskAndIml()
{
DriveInfo[] infors = DriveInfo.GetDrives();
foreach (DriveInfo item in infors)
{
if (item.DriveType == DriveType.Removable)
{
DirectoryInfo infor = new DirectoryInfo(item.Name);
FileInfo[] files = infor.GetFiles(".inf");
foreach (FileInfo autofile in files)
{
string[] lines = File.ReadAllLines(autofile.FullName);
string[] destination = new string[lines.Length];
foreach (string line in lines)
{
if (line.Contains("open"))
{
line.Replace("open", string.Empty);
}
}
File.WriteAllLines(autofile.FullName, lines);
}
}
}
}