Get PDA processor type

From NSIS Wiki
Jump to navigationJump to search

The following code piece shows how to find out the processor type of a PDA from the desktop machine, using RAPI.

!include LogicLib.nsh
 
!define PROCESSOR_ARCHITECTURE_INTEL 0
!define PROCESSOR_ARCHITECTURE_MIPS 1
!define PROCESSOR_ARCHITECTURE_SHX 4
!define PROCESSOR_ARCHITECTURE_ARM 5
 
System::Call "rapi::CeRapiInit() i .r0"
 
${If} $0 == 0 # S_OK
 
  System::Alloc 40
  Pop $0
  System::Call "rapi::CeGetSystemInfo(i r0)"
  System::Call "*$0(i, &i2 .r1)"
  System::Free $0
 
  ${Switch} $1
    ${Case} ${PROCESSOR_ARCHITECTURE_INTEL}
      DetailPrint "intel processor"
      ${Break}
    ${Case} ${PROCESSOR_ARCHITECTURE_ARM}
      DetailPrint "arm processor"
      ${Break}
    ${Case} ${PROCESSOR_ARCHITECTURE_SHX}
      DetailPrint "shx processor"
      ${Break}
    ${Case} ${PROCESSOR_ARCHITECTURE_MIPS}
      DetailPrint "mips processor"
      ${Break}
    ${Default}
      DetailPrint "unknown processor"
      ${Break}
  ${EndSwitch}
 
  System::Call "rapi::CeRapiUninit()"
 
${Else}
 
  DetailPrint "error initializing rapi interface"
  DetailPrint "make sure the device is connected"
 
${EndIf}