打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
delphi 判断是64位系统还是32为操作系统

delphi 判断是64位系统还是32为操作系统

分类: delphi 800人阅读 评论(0) 收藏 举报

需要注意是GetNativeSystemInfo 函数从Windows XP 开始才有, 而 IsWow64Process 函数从 Windows XP with SP2 以及 Windows Server 2003 with SP1 开始才有。 所以使用该函数的时候最好用GetProcAddress 。
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; 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
C#如何判断操作系统位数是32位还是64位
判断程序是否跑在Wow64下
NSIS脚本源码分析: 如何判断CPU平台类型
利用python管理windows进程
一条你必须知道的Winxp指令
Windows核心编程:DLL注入和API拦截
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服