缺少目录和文件信息

缺少目录和文件信息

本文介绍了缺少目录和文件信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下内容未返回文件和目录的完整列表:

The following is not returning a full list of files and directories:

IEnumerable<FileSystemInfo> files = new DirectoryInfo("C:\\Windows\\System32\\drivers").EnumerateFileSystemInfos("*", SearchOption.AllDirectories);

该应用程序以管理员身份运行.没有其他文件过滤器驱动程序.

The application is run as a administrator. There are no additional file filter drivers in place.

例如,如果我跑步:

foreach (FileSystemInfo file in files)
{
    Console.WriteLine(file.Name);
}

我得到:

en-US
gm.dls
gmreadme.txt
UMDF
wimmount.sys
bfe.dll.mui
ndiscap.sys.mui
pacer.sys.mui
qwavedrv.sys.mui
scfilter.sys.mui
tcpip.sys.mui

我茫然为什么不输出所有目录和文件.

I'm at a loss why it wouldn't be outputting all the directories and files.

推荐答案

在64位计算机上,文件系统(和注册表)的某些部分已虚拟化.在我看来,您正在64位计算机上运行,​​并且您的目标版本是x86(或具有首选32位"设置的AnyCPU).在64位计算机上的32位进程中,C:\Windows\System32被重定向到C:\Windows\SysWOW64.如果查看您的C:\Windows\SysWOW64\drivers文件夹,您将在输出中看到的正是文件.

On 64-bit machines, some portions of the file system (and registry) are virtualized. It appears to me that you're running on a 64-bit machine and you are targeting x86 (or AnyCPU with the "Prefer 32-bit" setting) in your build. In 32-bit processes on 64-bit machines, C:\Windows\System32 is redirected to C:\Windows\SysWOW64. If you look at your C:\Windows\SysWOW64\drivers folder, you'll see exactly the files you are seeing in your output.

这篇关于缺少目录和文件信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 09:52