summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Toso <toso@posteo.net>2018-12-21 10:34:10 +0000
committerVictor Toso <toso@posteo.net>2018-12-21 10:34:10 +0000
commit0e3b3c2f5c8657a05d591a27969b97a40a030dac (patch)
treea8c3bec7b6dd5f7316ff8ef12f247d7bae43553e
parent2d2cdca61be562b5751beacdc9e7189cc4d168d8 (diff)
parent170662a47c23d48122f1553d7ae9a710fc41fed5 (diff)
Merge branch 'logging' into 'master'
packaging: save install log See merge request spice/win32/spice-nsis!5
-rw-r--r--DumpLog.nsh41
-rw-r--r--win-guest-tools.nsis7
2 files changed, 48 insertions, 0 deletions
diff --git a/DumpLog.nsh b/DumpLog.nsh
new file mode 100644
index 0000000..1cbcda0
--- /dev/null
+++ b/DumpLog.nsh
@@ -0,0 +1,41 @@
+Function DumpLog
+# For reference: http://nsis.sourceforge.net/Dump_log_to_file
+ 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 exit
+ FileOpen $5 $5 "w"
+ StrCmp $5 "" exit
+ SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
+ System::Alloc ${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::SendMessageA(i, i, i, i) i \
+ ($0, ${LVM_GETITEMTEXT}, $2, r1)"
+ System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
+ FileWrite $5 "$4$\r$\n"
+ IntOp $2 $2 + 1
+ Goto loop
+ done:
+ FileClose $5
+ System::Free $1
+ System::Free $3
+ exit:
+ Pop $6
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $5
+FunctionEnd
diff --git a/win-guest-tools.nsis b/win-guest-tools.nsis
index 174ee53..a425aab 100644
--- a/win-guest-tools.nsis
+++ b/win-guest-tools.nsis
@@ -87,6 +87,8 @@ ShowInstDetails nevershow
!insertmacro MUI_LANGUAGE "English"
+!include "DumpLog.nsh"
+
XPStyle on
RequestExecutionLevel admin
@@ -263,6 +265,11 @@ SectionEnd
Section -post
WriteUninstaller "$INSTDIR\Uninstall ${FILENAME}.exe"
+ # for reference: https://stackoverflow.com/questions/2407509/writing-current-date-time-as-file-name-using-nsis
+ !define /date MyTIMESTAMP "%Y-%m-%d-%H-%M-%S"
+ StrCpy $0 "$INSTDIR\install-${MyTIMESTAMP}.log"
+ Push $0
+ Call DumpLog
SectionEnd
Function .onInit