!include LogicLib.nsh\r
!insertmacro GetParameters\r
!insertmacro GetOptions\r
-!define /date MYTIMESTAMP "%Y%m%d%H%M%S"\r
+\r
+### TimeStamp\r
+!ifndef TimeStamp\r
+ !define TimeStamp "!insertmacro _TimeStamp" \r
+ !macro _TimeStamp FormatedString\r
+ !ifdef __UNINSTALL__\r
+ Call un.__TimeStamp\r
+ !else\r
+ Call __TimeStamp\r
+ !endif\r
+ Pop ${FormatedString}\r
+ !macroend\r
+\r
+!macro __TimeStamp UN\r
+Function ${UN}__TimeStamp\r
+ ClearErrors\r
+ ## Store the needed Registers on the stack\r
+ Push $0 ; Stack $0\r
+ Push $1 ; Stack $1 $0\r
+ Push $2 ; Stack $2 $1 $0\r
+ Push $3 ; Stack $3 $2 $1 $0\r
+ Push $4 ; Stack $4 $3 $2 $1 $0\r
+ Push $5 ; Stack $5 $4 $3 $2 $1 $0\r
+ Push $6 ; Stack $6 $5 $4 $3 $2 $1 $0\r
+\r
+ ## Call System API to get the current system Time\r
+ System::Alloc 16\r
+ Pop $0\r
+ System::Call 'kernel32::GetLocalTime(i) i(r0)'\r
+ System::Call '*$0(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2)i (.r1, .r2, n, .r3, .r4, .r5, .r6)'\r
+ System::Free $0\r
+\r
+ IntFmt $2 "%02i" $2\r
+ IntFmt $3 "%02i" $3\r
+ IntFmt $4 "%02i" $4\r
+ IntFmt $5 "%02i" $5\r
+ IntFmt $6 "%02i" $6\r
+\r
+ ## Generate Timestamp\r
+ StrCpy $0 "$1$2$3$4$5$6" \r
+\r
+ ## Restore the Registers and add Timestamp to the Stack\r
+ Pop $6 ; Stack $5 $4 $3 $2 $1 $0\r
+ Pop $5 ; Stack $4 $3 $2 $1 $0\r
+ Pop $4 ; Stack $3 $2 $1 $0\r
+ Pop $3 ; Stack $2 $1 $0\r
+ Pop $2 ; Stack $1 $0\r
+ Pop $1 ; Stack $0\r
+ Exch $0 ; Stack ${TimeStamp}\r
+\r
+FunctionEnd\r
+!macroend\r
+!insertmacro __TimeStamp "" \r
+!insertmacro __TimeStamp "un." \r
+!endif\r
+###########\r
\r
section\r
${GetParameters} $R0\r
${GetExePath} $R1\r
+ ${TimeStamp} $0\r
SetRegView 64\r
\r
StrCpy $1 "SOFTWARE\JavaSoft\Java Runtime Environment"\r
\r
done:\r
StrCpy $2 '-path "$R1"'\r
- StrCpy $INSTDIR "$TEMP\tizensdk_${MYTIMESTAMP}"\r
+ StrCpy $INSTDIR "$TEMP\tizensdk_$0}"\r
RMDir /r $INSTDIR\r
SetOutPath $INSTDIR\r
SetOverwrite on\r
!include LogicLib.nsh\r
!insertmacro GetParameters\r
!insertmacro GetOptions\r
-!define /date MYTIMESTAMP "%Y%m%d%H%M%S"\r
+\r
+### TimeStamp\r
+!ifndef TimeStamp\r
+ !define TimeStamp "!insertmacro _TimeStamp" \r
+ !macro _TimeStamp FormatedString\r
+ !ifdef __UNINSTALL__\r
+ Call un.__TimeStamp\r
+ !else\r
+ Call __TimeStamp\r
+ !endif\r
+ Pop ${FormatedString}\r
+ !macroend\r
+\r
+!macro __TimeStamp UN\r
+Function ${UN}__TimeStamp\r
+ ClearErrors\r
+ ## Store the needed Registers on the stack\r
+ Push $0 ; Stack $0\r
+ Push $1 ; Stack $1 $0\r
+ Push $2 ; Stack $2 $1 $0\r
+ Push $3 ; Stack $3 $2 $1 $0\r
+ Push $4 ; Stack $4 $3 $2 $1 $0\r
+ Push $5 ; Stack $5 $4 $3 $2 $1 $0\r
+ Push $6 ; Stack $6 $5 $4 $3 $2 $1 $0\r
+\r
+ ## Call System API to get the current system Time\r
+ System::Alloc 16\r
+ Pop $0\r
+ System::Call 'kernel32::GetLocalTime(i) i(r0)'\r
+ System::Call '*$0(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2)i (.r1, .r2, n, .r3, .r4, .r5, .r6)'\r
+ System::Free $0\r
+\r
+ IntFmt $2 "%02i" $2\r
+ IntFmt $3 "%02i" $3\r
+ IntFmt $4 "%02i" $4\r
+ IntFmt $5 "%02i" $5\r
+ IntFmt $6 "%02i" $6\r
+\r
+ ## Generate Timestamp\r
+ StrCpy $0 "$1$2$3$4$5$6" \r
+\r
+ ## Restore the Registers and add Timestamp to the Stack\r
+ Pop $6 ; Stack $5 $4 $3 $2 $1 $0\r
+ Pop $5 ; Stack $4 $3 $2 $1 $0\r
+ Pop $4 ; Stack $3 $2 $1 $0\r
+ Pop $3 ; Stack $2 $1 $0\r
+ Pop $2 ; Stack $1 $0\r
+ Pop $1 ; Stack $0\r
+ Exch $0 ; Stack ${TimeStamp}\r
+\r
+FunctionEnd\r
+!macroend\r
+!insertmacro __TimeStamp "" \r
+!insertmacro __TimeStamp "un." \r
+!endif\r
+###########\r
\r
section\r
${GetParameters} $R0\r
${GetExePath} $R1\r
+ ${TimeStamp} $0\r
\r
StrCpy $1 "SOFTWARE\JavaSoft\Java Runtime Environment"\r
StrCpy $2 0\r
\r
done:\r
StrCpy $2 '-path "$R1"'\r
- StrCpy $INSTDIR "$TEMP\tizensdk_${MYTIMESTAMP}"\r
+ StrCpy $INSTDIR "$TEMP\tizensdk_$0"\r
RMDir /r $INSTDIR\r
SetOutPath $INSTDIR\r
SetOverwrite on\r