Hello, I'm doing software that can scan certain Windows files, where I leave certain types of extensions in it, but when I put it to scan the following access denied message in certain folders.
The code would be as follows:
DirectoryInfo dir_Local = new DirectoryInfo(tb_UnidadeHD.Text);
string[] extensao = new string[] { "*.WsF", "*.lnk", "*.vbs", "*.vbe", "*.js", "*.com" };
string[] dir_Info = Directory.GetFiles(tb_UnidadeHD.Text, extensao.ToString(), SearchOption.AllDirectories); ;
try
{
foreach (string procura in dir_Info)
{
lb_Arquivos.Text = string.Format("Escaneando: {0}", procura);
string result = ScanForVirus(procura);
if (!dir_Local.Exists)
MessageBox.Show(string.Format("Diretório de origem não existe ou não pôde ser encontrado: {0}", dir_Local), "AlegoTools", MessageBoxButtons.OK, MessageBoxIcon.Error);
else
{
if (result != string.Empty)
listBox_Files.Items.Add(result);
else
MessageBox.Show(string.Format("Não foi encontrado nenhum vírus em {0}", dir_Local), "AlegoTools", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
catch { }
If you can give me a light, because I tried other means but without success, it simply can not scan certain parts of the windows, even if it is admin, it shows as if it is not accessed by the program, and it is configured to run as administrator