gpt4 book ai didi

c# - 该系统找不到指定的路径

转载 作者:可可西里 更新时间:2023-11-01 14:15:08 25 4
gpt4 key购买 nike

我正在尝试使用 C# 为位置 %system%\drivers\中的某些文件计算 sha1 哈希值。我知道文件位于确切位置但是当我使用

FILE.Exists("c:\\Windows\\System32\\Drivers\\1394ohci.sys") 

它总是返回 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,它也生成了相同的输出。我尝试以管理员身份运行该命令,但没有帮助。

我做了很多网络搜索,但没有任何效果。请帮助并让我知道如何解决此问题。

感谢您的帮助。谢谢,

最佳答案

如果我正确理解您的问题,那么您需要查看 File System Redirector

The %windir%\System32 directory is reserved for 64-bit applications. Most DLL file names were not changed when 64-bit versions of the DLLs were created, so 32-bit versions of the DLLs are stored in a different directory. WOW64 hides this difference using a file system redirector.

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.

如果你可以尝试的话,页面底部也有小样本

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");
}

关于c# - 该系统找不到指定的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8775841/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com