简体   繁体   中英

How to call the GetNativeSystemInfo at Inno Setup iss file?

I want to call windows API: GetNativeSystemInfo at Inno Setup iss file, so I do not have to call an external DLL to detect ARM processor architecture .
But I don't know how to add it...

Could someone show me how to import and use that functionality in an Inno script???

Thank you!

The API declaration:

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';

And use:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM