The system cannot find the path specified

前端 未结 4 1421
轮回少年
轮回少年 2020-12-19 17:24

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

F         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 18:14

    If I understand your problem correctly then you need to look at 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.

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

提交回复
热议问题