如何在Inno Setup iss文件中调用GetNativeSystemInfo?

时间:2017-08-24 03:27:10

标签: winapi installer inno-setup pascalscript

我想在Inno Setup iss文件中调用windows API:GetNativeSystemInfo,所以我没有call an external DLL to detect ARM processor architecture
但我不知道如何添加它......

有人可以告诉我如何在Inno脚本中导入和使用该功能吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

API声明:

type
  TSystemInfo = record
    wProcessorArchitecture: Word;
    wReserved: Word;
    dwPageSize: DWORD;
    lpMinimumApplicationAddress: Cardinal;
    lpMaximumApplicationAddress: Cardinal;
    dwActiveProcessorMask: DWORD_PTR;
    dwNumberOfProcessors: DWORD;
    dwProcessorType: DWORD;
    dwAllocationGranularity: DWORD;
    wProcessorLevel: Word;
    wProcessorRevision: Word;
  end;

const
  PROCESSOR_ARCHITECTURE_INTEL            = 0;
  PROCESSOR_ARCHITECTURE_MIPS             = 1;
  PROCESSOR_ARCHITECTURE_ALPHA            = 2;
  PROCESSOR_ARCHITECTURE_PPC              = 3;
  PROCESSOR_ARCHITECTURE_SHX              = 4;
  PROCESSOR_ARCHITECTURE_ARM              = 5;
  PROCESSOR_ARCHITECTURE_IA64             = 6;
  PROCESSOR_ARCHITECTURE_ALPHA64          = 7;
  PROCESSOR_ARCHITECTURE_MSIL             = 8;
  PROCESSOR_ARCHITECTURE_AMD64            = 9;
  PROCESSOR_ARCHITECTURE_IA32_ON_WIN64    = 10;

procedure GetNativeSystemInfo(var lpSystemInformation: TSystemInfo);
  external 'GetNativeSystemInfo@Kernel32.dll stdcall';

并使用:

var
  SystemInfo: TSystemInfo;
begin
  GetNativeSystemInfo(SystemInfo);
  if SystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_ARM then
  begin
    { ... }
  end;
end;