You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CleanFlashInstaller/CleanFlashCommon/RedirectionManager.cs

34 lines
970 B
C#

using System;
using System.Runtime.InteropServices;
namespace CleanFlashCommon {
public class RedirectionManager {
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
public static IntPtr DisableRedirection() {
IntPtr redirectionPtr = (IntPtr)(-1);
try {
Wow64DisableWow64FsRedirection(ref redirectionPtr);
} catch {
// No Wow64 redirection possible.
}
return redirectionPtr;
}
public static void EnableRedirection(IntPtr redirectionPtr) {
try {
Wow64RevertWow64FsRedirection(redirectionPtr);
} catch {
// No Wow64 redirection possible.
}
}
}
}