什么是为您在.NET(C#)重分析点的最佳方式是什么? [英] What is the best way to check for reparse point in .net (c#)?

查看:148
本文介绍了什么是为您在.NET(C#)重分析点的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的功能是pretty的多标准搜索功能......我已经把它包含如下。

在功能我有1号线的code负责淘汰鲁县NTFS分。

 如果(attributes.ToString()的IndexOf(ReparsePoint)== -1)
 

现在的问题是,我得到一个错误 访问路径C:\系统卷信息。被拒绝

我调试的code和运行时,此目录的唯一属性是:

  System.IO.FileAttributes.Hidden
| System.IO.FileAttributes.System
| System.IO.FileAttributes.Directory
 

我是Windows 2008 Server计算机上执行此code,任何想法我能做些什么来治愈这种失败?

 公共无效DirSearch(字符串SDIR)
{
    的foreach(字符串d。在Directory.GetDirectories(SDIR))
    {
        DirectoryInfo的DINFO =新的DirectoryInfo(D);
        FileAttributes属性= dInfo.Attributes;
        如果(attributes.ToString()的IndexOf(ReparsePoint)== -1)
        {
            的foreach(在Directory.GetFiles字符串型F(D,searchString))
            {
                //lstFilesFound.Items.Add(f);
                ListViewItem的LVI;
                ListViewItem.ListViewSubItem铝丝;
                LVI =新的ListViewItem();
                lvi.Text = F;
                lvi.ImageIndex = 1;
                lvi.Tag =标签;
                吕四=新ListViewItem.ListViewSubItem();
                lvsi.Text =子开溜;
                lvi.SubItems.Add(铝丝);

                吕四=新ListViewItem.ListViewSubItem();
                lvsi.Text = d;//"C:\\Users\\Administrator\\Downloads\\MediaMonkey.GOLD.EDITION.v.3.0.2.1134.[Darkside].[Demonoid].[Grim.Reaper]";
                lvi.SubItems.Add(铝丝);

                listView1.Items.Add(LVI);
            }
            DirSearch(四);
        }
    }
}
 

解决方案

任何人都没有权限访问的System Volume Information除SYSTEM帐户。因此,无论更改该目录的权限。或者好得多捕获异常,并继续下去。

My function is pretty much a standard search function... I've included it below.

In the function I have 1 line of code responsible for weeding out Repart NTFS points.

if (attributes.ToString().IndexOf("ReparsePoint") == -1)

The problem is now I am getting an error Access to the path 'c:\System Volume Information' is denied.

I debugged the code and the only attributes at run time for this directory are :

  System.IO.FileAttributes.Hidden 
| System.IO.FileAttributes.System 
| System.IO.FileAttributes.Directory

I'm executing this code on a windows 2008 server machine, any ideas what I can do to cure this failing?

public void DirSearch(string sDir)
{
    foreach (string d in Directory.GetDirectories(sDir))
    {
        DirectoryInfo dInfo = new DirectoryInfo(d);
        FileAttributes  attributes = dInfo.Attributes;
        if (attributes.ToString().IndexOf("ReparsePoint") == -1)
        {
            foreach (string f in Directory.GetFiles(d, searchString))
            {
                //lstFilesFound.Items.Add(f);
                ListViewItem lvi;
                ListViewItem.ListViewSubItem lvsi;
                lvi = new ListViewItem();
                lvi.Text = f;
                lvi.ImageIndex = 1;
                lvi.Tag = "tag";
                lvsi = new ListViewItem.ListViewSubItem();
                lvsi.Text = "sub bugger";
                lvi.SubItems.Add(lvsi);

                lvsi = new ListViewItem.ListViewSubItem();
                lvsi.Text = d;//"C:\\Users\\Administrator\\Downloads\\MediaMonkey.GOLD.EDITION.v.3.0.2.1134.[Darkside].[Demonoid].[Grim.Reaper]";
                lvi.SubItems.Add(lvsi);

                listView1.Items.Add(lvi);
            }
            DirSearch(d);
        }
    }
}

解决方案

Nobody has permission to access System Volume Information except the SYSTEM account. So either change the permissions on the directory. Or much, much better catch the exception and go on.

这篇关于什么是为您在.NET(C#)重分析点的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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