How can disable redirection on win64

后端 未结 1 626
灰色年华
灰色年华 2020-12-10 18:23

I want to copy c:\\Windows\\regedit.exe to same directory with regedit2.exe name But when I try to copy it,I take an error which say regedit.

相关标签:
1条回答
  • 2020-12-10 18:38

    There are Win32 functions available that can disable and enable redirection.

    [DllImport("kernel32.dll", SetLastError = true)]
    static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
    
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
    

    Example:

    IntPtr wow64Value = IntPtr.Zero;
    
    // Disable redirection.
    Wow64DisableWow64FsRedirection(ref wow64Value);
    
    // Do whatever you need
    // .....................
    
    // Re-enable redirection.
    Wow64RevertWow64FsRedirection(wow64Value);
    
    0 讨论(0)
提交回复
热议问题