Skip to content
⌘ NSIS Forum Archive

DropList install option with list of com ports

2 posts

pj_martins#

DropList install option with list of com ports

Is it possible to have an install option of type DropList with the ListItems being a list of com ports available on the target machine?
pj_martins#
Found a solution getting values from registry:


Function GetComPorts
StrCpy $0 0
getNextReg:
EnumRegValue $1 HKLM "HARDWARE\DEVICEMAP\SERIALCOMM" $0
StrCmp $1 "" gotRegs
ReadRegStr $2 HKLM "HARDWARE\DEVICEMAP\SERIALCOMM" $1
StrCmp $0 0 create
StrCpy $3 "$2|$3"
goto appended

create:
StrCpy $3 $2

appended:
IntOp $0 $0 + 1
goto getNextReg

gotRegs:
!insertmacro MUI_INSTALLOPTIONS_WRITE "ComSelectionPage.ini" "Field 1" "ListItems" $3
FunctionEnd
where Field 1 is a DropList