In the X64 system, a few special directories and special registry keys are divided into 2 separate sections. For file systems,
The%systemroot%\system32 directory is reserved for use with 64-bit files, and 32-bit files are redirected to the%SYSTEMROOT%\SYSWOW64 directory.
In other words, all 32-bit programs typically only appear in the%systemroot%\syswow64 directory.
Any attempt by any 32-bit program to access the%SystemRoot%\System32 directory will be redirected to the%SYSTEMROOT%\SYSWOW64 directory.
This is a default behavior unless the thread of the program explicitly named requires that the redirection mechanism be turned off.
Under the Win7 64-bit system, call the CopyFile function to copy the function, if you want to copy the file to the System32 directory,
You need to consider whether the program is also 64-bit, otherwise, the program will be redirected to the SYSWOW64 directory,
To prevent the file from being redirected, you need to call the function wow64disablewow64fsredirection to cancel the redirection of the file.
The Wow64revertwow64fsredirection function is called to recover after the specified function has been completed.
Create a new item under HKEY_LOCAL_MACHINE\Software, and then use the 64-bit Registry Editor to view
You will see that this item will only appear under the Hkey_local_machine\software\wow6432node key and not
Now the HKEY_LOCAL_MACHINE\Software key, because the HKEY_LOCAL_MACHINE\SOFTWARE key is specifically
The gate is used to store the registry data used by the 64-bit program, while the Hkey_local_machine\software\wow6432node
Keys are specifically used to store the registry data used by 32-bit programs.
var Oldwow64redirectionvalue:longbool;
Function Disablewowredirection:boolean;
Type twow64disablewow64fsredirection = function (var wow64fsenableredirection:longbool): Longbool;
stdcall;
Var hhandle:thandle;
Wow64disablewow64fsredirection:twow64disablewow64fsredirection;
Begin Result: = true;
Try Hhandle: = GetModuleHandle (' kernel32.dll ');
@Wow64DisableWow64FsRedirection: = GetProcAddress (Hhandle, ' wow64disablewow64fsredirection ') );
if ((hhandle <> 0) and (@Wow64DisableWow64FsRedirection <> nil) Then Wow64disablewow64fsredirection (Oldwow64redirectionvalue);
except Result: = False;
END;
End;
function Revertwowredirection:boolean;
Type twow64revertwow64fsredirection = function (var wow64revertwow64fsredirection:longbool): Longbool;
stdcall;
var Hhandle:thandle;
Wow64revertwow64fsredirection:twow64revertwow64fsredirection;
Begin Result: = true;
Try Hhandle: = GetModuleHandle (' kernel32.dll ');
@Wow64RevertWow64FsRedirection: = GetProcAddress (Hhandle, ' wow64revertwow64fsredirection ');
if ((hhandle <> 0) and (@Wow64RevertWow64FsRedirection <> nil) then Wow64revertwow64fsredirection ( Oldwow64redirectionvalue);
Except Result: = False;
End
End
http://blog.csdn.net/gj333/article/details/8268379
Delphi disables the x64-bit System file redirection feature