;-------------------------------- ; License Test ; Written by Takhir Bedertdinov ;-------------------------------- ; Base names definition !define LIC_NAME "License.txt" !define APP_NAME "License Test" ;-------------------------------- ; General Attributes Name "${APP_NAME}" OutFile "${APP_NAME}.exe" ;-------------------------------- ; Interface !include "MUI.nsh" !insertmacro MUI_PAGE_WELCOME !define MUI_PAGE_CUSTOMFUNCTION_SHOW addLicense !insertmacro MUI_PAGE_LICENSE Dummy.txt !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ; Installer Sections Section "Dummy Section" SecDummy SectionEnd ;-------------------------------- ; Installer Functions !define stSTAT '(i,&i2,&i2,&i2,&i2,&i2,&i2,i,i,i,i,i) i' Function fileSize System::Call '*${stSTAT} .r0' ; allocates memory for STAT struct and writes address to $0 System::Call 'msvcrt.dll::_stat(t "$EXEDIR\${LIC_NAME}", i r0) i .r1' IntCmp $1 -1 exit System::Call "*$0${stSTAT}(,,,,,,,,.r1,,,)" exit: System::Free $0 ; free allocated memory FunctionEnd Function addLicense Call fileSize IntOp $1 $1 + 1 ; for terminating zero System::Call 'msvcrt.dll::calloc(i r1, i 1) i .r0' ; System plug-in not allocates variable size FindWindow $2 "#32770" "" $HWNDPARENT GetDlgItem $2 $2 1000 System::Call 'msvcrt.dll::_open(t "$EXEDIR\${LIC_NAME}", i 0x8000) i .r3' System::Call 'msvcrt.dll::_read(i r3, i r0, i r1) i .r4' SendMessage $2 ${WM_SETTEXT} 0 $0 $4 System::Call 'msvcrt.dll::_close(i r3)' System::Free $0 FunctionEnd