EAlan
EAlan

Reputation: 57

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 Setup script?

Upvotes: 0

Views: 583

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202474

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 '[email protected] stdcall';

And use:

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

Upvotes: 1

Related Questions