functionIswin64:boolean;varKernel32handle:thandle; Iswow64process:function(Handle:Windows.THandle;varRes:Windows.BOOL): Windows.bool;stdcall; Getnativesysteminfo:procedure(varLpsysteminfo:tsysteminfo);stdcall; Iswow64:bool; Systeminfo:tsysteminfo;ConstProcessor_architecture_amd64=9; Processor_architecture_ia64=6;beginKernel32handle:= GetModuleHandle ('KERNEL32. DLL'); ifKernel32handle =0 ThenKernel32handle:= LoadLibrary ('KERNEL32. DLL'); ifKernel32handle <>0 Then beginiswow64process:= GetProcAddress (Kernel32handle,'iswow64process'); Getnativesysteminfo:= GetProcAddress (Kernel32handle,'Getnativesysteminfo'); ifAssigned (iswow64process) Then beginiswow64process (GETCURRENTPROCESS,ISWOW64); Result:= isWoW64 andAssigned (Getnativesysteminfo); ifResult Then beginGetnativesysteminfo (SystemInfo); Result:= (Systeminfo.wprocessorarchitecture = processor_architecture_amd64)or(Systeminfo.wprocessorarchitecture=processor_architecture_ia64); End; End ElseResult: =False; End ElseResult: =False;End;
http://blog.csdn.net/suiyunonghen/article/details/4870219
There are many such codes and discussions on the web, especially the use of iswow64process functions.
Suddenly think: Only 32-bit EXE at runtime to determine whether the OS is 32 or 64bit?
If the exe itself is 64bit, then the runtime does not have to judge at all, the OS must be 64-bit, otherwise it can not run at all.
So, I feel that many discussions on the internet is a bit superfluous?
Determine whether the Windows operating system is 32-bit or 64-bit