问题描述
我正在尝试使用 C# 计算位置 %system%\drivers\ 中某些文件的 sha1 哈希值.我知道文件在确切的位置,但是当我使用
I am trying to calculate sha1 hash for some of the files from location %system%\drivers\ using C#. I know files are at the exact location but when i use
FILE.Exists("c:\\Windows\\System32\\Drivers\\1394ohci.sys")
它总是返回 false.
it always retuns false.
C:\Users\administrator>dir c:\Windows\System32\drivers\1394ohci.sys
Volume in drive C has no label.
Volume Serial Number is 5A4F-1E60
Directory of c:\Windows\System32\drivers
11/21/2010 08:53 AM 229,888 1394ohci.sys
1 File(s) 229,888 bytes
0 Dir(s) 19,521,245,184 bytes free
C:\Users\administrator>fciv -sha1 c:\Windows\system32\drivers\1394ohci.sys
//
// File Checksum Integrity Verifier version 2.05.
//
c:\windows\system32\drivers\1394ohci.sys\*
Error msg : The system cannot find the path specified.
Error code : 3
我什至在文件上尝试了 fciv.exe,它也生成了相同的输出.我尝试以管理员身份运行该命令,但没有帮助.
I even tried fciv.exe on the file and it also generate the same output. I tried running the command as administratror but it did not help.
我进行了大量网络搜索,但没有任何效果.请帮助并告诉我如何解决此问题.
I did lot of web search but nothing worked. Please help and let me know how to fix this issue.
感谢您的帮助.谢谢,
推荐答案
如果我正确理解您的问题,那么您需要查看 文件系统重定向器
If I understand your problem correctly then you need to look at File System Redirector
%windir%\System32 目录是 reserved
用于 64 位应用程序.大多数 DLL 文件名在 64 位版本的 DLL 时未更改已创建,因此 32 位版本的 DLL 存储在不同的目录.WOW64
使用文件隐藏了这种差异系统重定向器.
在大多数情况下,每当 32 位应用程序尝试访问%windir%\System32,访问被重定向到 %windir%\SysWOW64.对 %windir%\lastgood\system32 的访问被重定向到%windir%\lastgood\SysWOW64.对 %windir%\regedit.exe 的访问是重定向到 %windir%\SysWOW64\regedit.exe.
In most cases, whenever a 32-bit application attempts to access %windir%\System32, the access is redirected to %windir%\SysWOW64. Access to %windir%\lastgood\system32 is redirected to %windir%\lastgood\SysWOW64. Access to %windir%\regedit.exe is redirected to %windir%\SysWOW64\regedit.exe.
如果你可以尝试一下,页面底部还有一个小样本
Also there is small sample at the bottom of page if you can try that one
string system32Directory = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "system32");
if(Environment.Is64BitOperatingSystem && !Environment.Is64BitProcess)
{
// For 32-bit processes on 64-bit systems, %windir%\system32 folder
// can only be accessed by specifying %windir%\sysnative folder.
system32Directory = Path.Combine(Environment.ExpandEnvironmentVariables("%windir%"), "sysnative");
}
这篇关于该系统找不到指定的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!