1. 程式人生 > >windows64位作業系統重定向問題

windows64位作業系統重定向問題

64位作業系統執行32程式時,作業系統會啟用重定向功能.

系統會把system32資料夾重定向到Syswow64等等。

WOW64 (Windows-on-Windows 64-bit)是一個Windows作業系統的子系統, 它為現有的 32 位應用程式提供了 32 位的模擬,可以使大多數 32 位應用程式在無需修改的情況下執行在 Windows 64 位版本上。

 

這人功能是可以關閉的.微軟提供:

Wow64EnableWow64FsRedirection
Wow64DisableWow64FsRedirection
Wow64RevertWow64FsRedirection

例:

PVOID OldValue = NULL;
if( Wow64DisableWow64FsRedirection(&OldValue) ) 
{
    //  Any function calls in this block of code should be as concise
	//  and as simple as possible to avoid unintended results.

	CopyFile(_T(".\\npf.sys"),_T("C:\\Windows\\System32\\drivers\\npf.sys"),false); 
	//CopyFile(_T(".\\npf.sys"),_T("D:\\npf.sys"),false); 
	//  Immediately re-enable redirection. Note that any resources
	//  associated with OldValue are cleaned up by this call.
	if ( FALSE == Wow64RevertWow64FsRedirection(OldValue) )
	{
		//  Failure to re-enable redirection should be considered
		//  a criticial failure and execution aborted.
		;
	}
}