之前我开发的32位应用程序将文件拷贝到System32中,拷贝成功了却在System32中见不到拷贝的文件
后来费了好大的时间终于查到了问题的原因,32位程序C:\Windows\System32\ 该路径默认会指向C:\Windows\SysWOW64
而64位系统是正常的
希望大家在看到这篇文章之后能够带大家避免弯路
最后还有就是64位系统中重定向文件拷贝到SysWOW64下的方法
IntPtr Wow64value = IntPtr.Zero;
Wow64DisableWow64FsRedirection(ref Wow64value);
File.Copy(pLocalFilePath, pSaveFilePath, true);
Wow64RevertWow64FsRedirection(Wow64value);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);