无法从系统卷信息中获取文件 [英] Can't get files from system volume information

查看:74
本文介绍了无法从系统卷信息中获取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







很抱歉尊敬的先生/妈妈因为我现在绝对错误地把我的最后一个问题放到了我要去的地方提一些细节



i为我的反病毒文件搜索编写以下代码,并在扫描系统卷信息文件夹时给出异常

请帮我编辑这段代码,它还给我系统卷信息文件夹中所有文件的列表



代码是:



我使用的是c#语言

************************** *********************************************

Hi,


Sorry to respectable sir/mam because i put my last question absolutely in wrong manner now i am going to mention some details

i write the following code for the file searching in my anti virus and it give exception when it scan "system volume information " folder
please help me by editing this code that it also give me the list of all files in "system volume information" folder

code is:

I am using c# language
***********************************************************************

//get the drive names on the target computer
            DriveInfo[] drives = DriveInfo.GetDrives();
            foreach (DriveInfo drive in drives)
            {
                //Console.WriteLine("Drive: {0} {1}", drive.Name, drive.DriveType);
                comboBox2.Items.Add(drive.Name);
                if (drive.DriveType.ToString() == "Fixed")
                {
                    try
                    {
                        //Search for the folder in each drive
                        string[] dirs = //Directory.GetDirectories(drive.Name, "MySql", SearchOption.AllDirectories);
                        Directory.GetDirectories(drive.Name,"*.*",SearchOption.AllDirectories);
                        comboBox1.Items.Add(dirs.Length);
                        foreach (string dir in dirs)
                        {
                            comboBox1.Items.Add(dir);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }











************************************** *********************************我得到的例外是我刚才提到的同事:



System.UnauthorizedAccessException:访问路径'c:\System Volume Information'被拒绝.at system.IO .__ Error.winIoeRROR(Int32 errorCode,string maybeFullpath)

at system.IO.InternalGetFileDirectioryName(字符串路径,字符串userpathoriginal,字符串searchpattern,booleanincludeFiles,boolean includeDirs,Searchopyion searchoption)

at system.IO.Directiory.GetDirectories(string path,字符串searchpattern,searchoption searchoption)

在Antivirius.Form1.Form1_load)对象发件人,EventArgs e)在D:\Documents and Settings \Shafiq Ur Rehman \ My Documents \ Visual Studio 2008 \\ projects \ Antivirius \ Antivirius \Form1.cs:line34






*********************************************************************** The exception i am getting is as fellow i just mention below:

"System.UnauthorizedAccessException:Access to the path 'c:\System Volume Information'is denied.at system.IO.__Error.winIoeRROR(Int32 errorCode,string maybeFullpath)
at system.IO.InternalGetFileDirectioryName(string path,string userpathoriginal,string searchpattern,booleanincludeFiles,boolean includeDirs,Searchopyion searchoption)
at system.IO.Directiory.GetDirectories(string path,string searchpattern,searchoption searchoption)
at Antivirius.Form1.Form1_load)object Sender,EventArgs e)in D:\Documents and Settings\Shafiq Ur Rehman\My Documents\Visual Studio 2008\projects\Antivirius\Antivirius\Form1.cs:line34 "

推荐答案

默认情况下,系统卷信息访问被阻止。通常只有系统可以访问它。您可以自己访问,但这通常不是一个好主意。你不应该搞乱那里的东西(例如影子副本)。

请注意,如果你正在编写一些防病毒软件,那么你就是以错误的方式解决这个问题。获取DDK的副本,并将扫描软件实现为过滤器驱动程序。 (过滤器驱动程序是系统的一部分,他们可以访问所有文件。虽然不允许C#:-))/ b $ b第二个想法,不要:如果你无法弄清楚UnauthorizedAccessException意味着你没有访问权限,你可能会在下载DDK后半小时内破坏你的系统。
System Volume information access is blocked by default. Normally only the system can access this. You could give yourself access, but it's generally not a good idea. You should not mess around with what's in there (shadow copies, for instance).
Note that if you're writing some anti-virus software, you're tackling this the wrong way. Get yourself a copy of the DDK, and implement your scanning software as a filter driver. (filter drivers are part of the system, and they can access all files. No C# allowed though :-) )
On second thoughts, don't: If you can't figure out UnauthorizedAccessException means you don't have access, you'll probably destroy your system within half an hour of downloading the DDK.


你必须告诉我们你得到了什么例外。我们不能只从您发布的代码中获取此信息。
You have to tell us what exception you're getting. We can't just divine this info from the code you posted.


ssp_shafiq写道:
ssp_shafiq wrote:

我在等为您的回复



不要两次问同一个问题,请:)


Don't ask the same question twice, please :)


这篇关于无法从系统卷信息中获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆