X86 시스템인지 X64 시스템인지 확인
                                            
 2007 단어  계통
                    
function IsWin64: Boolean;  
var 
  Kernel32Handle: THandle;  
  IsWow64Process: function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall;  
  GetNativeSystemInfo: procedure(var lpSystemInfo: TSystemInfo); stdcall;  
  isWoW64: Bool;  
  SystemInfo: TSystemInfo;  
const 
  PROCESSOR_ARCHITECTURE_AMD64 = 9;  
  PROCESSOR_ARCHITECTURE_IA64 = 6;  
begin 
  Kernel32Handle := GetModuleHandle('KERNEL32.DLL');  
  if Kernel32Handle = 0 then 
    Kernel32Handle := LoadLibrary('KERNEL32.DLL');  
  if Kernel32Handle <> 0 then 
  begin 
    IsWOW64Process := GetProcAddress(Kernel32Handle,'IsWow64Process');  
    GetNativeSystemInfo := GetProcAddress(Kernel32Handle,'GetNativeSystemInfo');  
    if Assigned(IsWow64Process) then 
    begin 
      IsWow64Process(GetCurrentProcess,isWoW64);  
      Result := isWoW64 and Assigned(GetNativeSystemInfo);  
      if Result then 
      begin 
        GetNativeSystemInfo(SystemInfo);  
        Result := (SystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) or 
          (SystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64);  
      end;  
    end 
    else Result := False;  
  end 
  else Result := False;  
end;  
  * WINXP/2003 이전 시스템인지 스스로 판단해야 함
function IsWOW64: BOOL;
  begin
    Result := False;
    if GetProcAddress(GetModuleHandle(kernel32), 'IsWow64Process') <> nil then
      IsWow64Process(GetCurrentProcess, Result);
  end;
  이것은 XE 이후의 코드입니다. 당신의 EXE는 32비트이고 환경은 64비트입니다.만약 당신의 EXE가 64비트라면 판단할 필요가 없습니다. 32비트 시스템은 실행할 수 없습니다.
Get Native System Info 함수는 Windows XP부터, Is Wow 64 Process 함수는 Windows XP with SP2 및 Windows Server 2003 with SP1부터입니다.따라서 이 함수를 사용할 때는 GetProcAddress를 사용하는 것이 좋습니다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
실례를 통해 Nodejs 모듈 시스템 및 require 메커니즘 이해Nodejs에는 간단한 모듈 로딩 시스템이 있습니다.Nodejs에서 파일과 모듈은 하나의 독립된 모듈로 간주됩니다. 이 파일은 JavaScript 코드, JSON 또는 컴파일된 C/C++ 확장자일 수 있습니다. 2....
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.