greenshot/Greenshot/tools/PortableApps.comInstaller/App/installer/PortableApps.comInstallerDumpLogToFile.nsh
2013-04-24 12:04:26 +00:00

62 lines
1.4 KiB
NSIS

;http://nsis.sourceforge.net/Docs/AppendixD.html#D.4
;Define added by John T. Haller of PortableApps.com
;NOTE - Not yet used. Added for future reference.
!ifndef DumpLogToFile
!define DumpLogToFile "!insertmacro DumpLogToFile"
!macro DumpLogToFile logfilename
Delete `${logfilename}`
push `${logfilename}`
call DumpLog
!macroend
!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x1073
Function DumpLog
Exch $5
Push $0
Push $1
Push $2
Push $3
Push $4
Push $6
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1016
StrCmp $0 0 error
FileOpen $5 $5 "w"
FileWriteWord $5 0xfeff ; Write the BOM
StrCmp $5 0 error
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
System::StrAlloc ${NSIS_MAX_STRLEN}
Pop $3
StrCpy $2 0
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
loop: StrCmp $2 $6 done
System::Call "User32::SendMessageW(i, i, i, i) i \
($0, ${LVM_GETITEMTEXT}, $2, r1)"
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
FileWriteUTF16LE $5 "$4$\r$\n"
IntOp $2 $2 + 1
Goto loop
done:
FileClose $5
System::Free $1
System::Free $3
Goto exit
error:
;MessageBox MB_OK error
exit:
Pop $6
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
Exch $5
FunctionEnd
!endif