!include LogicLib.nsh
!include nsDialogs.nsh
!include MUI2.nsh
OutFile Test.exe
ShowInstDetails show

!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE English

Function DetailUpdate
  Exch $R0
  Push $R1
  Push $R2
  Push $R3
  Push $R4

  FindWindow $R2 `#32770` `` $HWNDPARENT
  GetDlgItem $R1 $R2 1006
  SendMessage $R1 ${WM_SETTEXT} 0 `STR:$R0`
  GetDlgItem $R1 $R2 1016

  System::Call *(&t${NSIS_MAX_STRLEN}R0)i.R2
  System::Call *(i0,i0,i0,i0,i0,iR2,i${NSIS_MAX_STRLEN},i0,i0)i.R3

  !define LVM_GETITEMCOUNT 0x1004
  !define LVM_SETITEMTEXT 0x102E
  SendMessage $R1 ${LVM_GETITEMCOUNT} 0 0 $R4
  IntOp $R4 $R4 - 1
  System::Call user32::SendMessage(iR1,i${LVM_SETITEMTEXT},iR4,iR3)

  System::Free $R3
  System::Free $R2

  Pop $R4
  Pop $R3
  Pop $R2
  Pop $R1
  Pop $R0
FunctionEnd
!macro DetailUpdate Text
  Push `${Text}`
  Call DetailUpdate
!macroend
!define DetailUpdate `!insertmacro DetailUpdate`

Section

  DetailPrint `Processing: 0% done...`
  ${For} $R0 1 5
    Sleep 2000
    IntOp $R1 $R0 * 20
    ${DetailUpdate} `Processing: $R1% done...`
  ${Next}
  ${DetailUpdate} `Processing complete!`

SectionEnd