首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

64bit下封锁启用文件重定向功能,支持多线程,简单易用

2013-10-25 
64bit下关闭启用文件重定向功能,支持多线程,简单易用BOOL DisableWow64FsRedirection(BOOL disable){typed

64bit下关闭启用文件重定向功能,支持多线程,简单易用

BOOL DisableWow64FsRedirection(BOOL disable){typedef BOOL (__stdcall *FuncIsWow64Process)(HANDLE, PBOOL);typedef BOOL (__stdcall *FuncWow64DisableWow64FsRedirection)(PVOID*);typedef BOOL (__stdcall *FuncWow64RevertWow64FsRedirection)(PVOID);static FuncIsWow64Process xIsWow64Process = NULL;static FuncWow64DisableWow64FsRedirection xDisableFsRedirection = NULL;static FuncWow64RevertWow64FsRedirection xRevertFsRedirection = NULL;static BOOL iswow64 = 0;if(!xIsWow64Process){xIsWow64Process = (FuncIsWow64Process)::GetProcAddress(::GetModuleHandleA("kernel32.dll"), "IsWow64Process");if(!xIsWow64Process)return TRUE;if(!xIsWow64Process(GetCurrentProcess(), &iswow64))return FALSE;}if(!iswow64)return TRUE;if(!xDisableFsRedirection){xDisableFsRedirection = (FuncWow64DisableWow64FsRedirection)::GetProcAddress(::GetModuleHandleA("kernel32.dll"), "Wow64DisableWow64FsRedirection");if(!xDisableFsRedirection)return FALSE;}if(!xRevertFsRedirection){xRevertFsRedirection = (FuncWow64RevertWow64FsRedirection)::GetProcAddress(::GetModuleHandleA("kernel32.dll"), "Wow64RevertWow64FsRedirection");if(!xRevertFsRedirection)return FALSE;}static __declspec(thread) void* old_value = NULL;static __declspec(thread) BOOL disabled = FALSE;if(disable){if(disabled)return TRUE;if(xDisableFsRedirection(&old_value)){disabled = TRUE;return TRUE;}elsereturn FALSE;}else{if(!disabled)return TRUE;if(xRevertFsRedirection(old_value)){disabled = FALSE;return TRUE;}elsereturn FALSE;}}

热点排行