拒绝访问路径"C:\ Documents and Settings \".

编程入门 行业动态 更新时间:2024-10-28 04:24:51
本文介绍了拒绝访问路径"C:\ Documents and Settings \".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在程序中使用了get file方法,但需要调整程序访问权限,以便能够扫描整个根目录. 这是提供给我的代码

导入 System.IO 公共 类 Form1 私有 Sub btnScan_Click( ByVal 发​​件人 As 系统.对象, ByVal e As System.EventArgs)句柄 btnscan.Click btnscan.Enabled = 错误 Dim searchForTheseFiles() As 字符串 = txtFileList .Text.ToUpper.Split(Environment.NewLine) Dim 文件列表 As 新建列表( Of 字符串)(searchForTheseFiles) Dim myDir As 新建 DirectoryInfo(cboDriveList.文本) 对于 每个 foundFile As FileInfo 在 myDir.GetFiles(" *.*" , SearchOption.AllDirectories) 如果 fileList.Contains(foundFile.Name.ToUpper)然后 MsgBox(" AAAAAHHHHH !!!!病毒发现!!!" ) textbox1.Text& = Environment.NewLine& foundFile.FullName 尝试 foundFile.Delete() 捕获,例如 As 异常 MsgBox(" 无法删除受感染的文件!" ) textbox1.Text& = Environment.NewLine& " 无法删除受感染的文件:" & foundFile.FullName 结束 尝试 结束 如果 下一步 foundFile btnscan.Enabled = 真实 结束 子 私有 功能 foundFile() As 对象 抛出 新建 NotImplementedException 结束 功能 私人 子 Form1_Load( ByVal 发​​件人 As 系统.对象, ByVal e As System.EventArgs)句柄 MyBase .Load cboDriveList.Items.AddRange(System.IO.Directory.GetLogicalDrives) 结束 子 结束 类

请对此做任何更正或建议 我有一个组合框来选择根目录,一个开始扫描按钮,一个具有给定名称的文本文件以进行搜索.它可能会强制其自身为只读,请使用System.Security.Permissions.FileIOPermission将其更改为读/写,然后尝试删除该 如果失败,则可以尝试将文件移动到另一个目录并重命名,以便所有引用文件都找不到它,也可以尝试删除整个目录,这可能会起作用. 祝您好运,并拥有这款抗病毒软件.我讨厌该死的东西.

I have used a get file method in my program but need to adjust my program access to be able to have the privileges to scan the entire root directory Here is the code provided to me

Imports System.IO Public Class Form1 Private Sub btnScan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnscan.Click btnscan.Enabled = False Dim searchForTheseFiles() As String = txtFileList.Text.ToUpper.Split(Environment.NewLine) Dim fileList As New List(Of String)(searchForTheseFiles) Dim myDir As New DirectoryInfo(cboDriveList.Text) For Each foundFile As FileInfo In myDir.GetFiles("*.*", SearchOption.AllDirectories) If fileList.Contains(foundFile.Name.ToUpper) Then MsgBox("AAAAAHHHHH!!!! VIRUS FOUND!!!") textbox1.Text &= Environment.NewLine & foundFile.FullName Try foundFile.Delete() Catch ex As Exception MsgBox("Couldn't delete infected file!") textbox1.Text &= Environment.NewLine & "Couldn't delete infected file: " & foundFile.FullName End Try End If Next foundFile btnscan.Enabled = True End Sub Private Function foundFile() As Object Throw New NotImplementedException End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cboDriveList.Items.AddRange(System.IO.Directory.GetLogicalDrives) End Sub End Class

please make any corrections or suggestions to this I have a combobox to select the root dir, a start scan button, a text file with the given names to search for.

解决方案

If its a virus theres a chance it might be forcing itself to be readonly, use System.Security.Permissions.FileIOPermission to change it to read/write and try deleting that If this fails, you can try moving the file to another directory and renaming it so any referencing files cant find it you can also try deleting the whole directery, might work.. Best of luck with this anti virus. i hate the damn things.

更多推荐

拒绝访问路径"C:\ Documents and Settings \".

本文发布于:2023-11-08 02:28:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568078.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   quot   Settings   Documents

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!