Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Patch/Restore...
- ${If} $FILEMD5 == $MD5ORIG ;Original file. Patch.
- MessageBox MB_YESNO|MB_ICONQUESTION "Patch file?" IDYES 0 IDNO EndProg
- !insertmacro BackupFile
- GetTempFileName $R0
- vpatch::vpatchfile "change.pat" "$INSTDIR\$TARGETFILE" "$R0"
- Pop $R1
- DetailPrint "Patch:"
- DetailPrint "$R1"
- CopyFiles "$R0" "$INSTDIR\$TARGETFILE"
- IfErrors CopyError 0 ;check copy file error
- Delete "$R0" ;remove temporary file
- ${Else}
- ${If} $FILEMD5 == $MD5PATCH ; Patched file. Restore.
- MessageBox MB_YESNO|MB_ICONQUESTION "File patched! Restore original?" IDYES 0 IDNO EndProg
- !insertmacro BackupFile
- GetTempFileName $R0
- vpatch::vpatchfile "restore.pat" "$INSTDIR\$TARGETFILE" "$R0"
- Pop $R1
- DetailPrint "Restore:"
- DetailPrint "$R1"
- CopyFiles "$R0" "$INSTDIR\$TARGETFILE"
- IfErrors CopyError 0 ;check copy file error
- Delete "$R0" ;remove temporary file
- ${Else} ;Other checksum, wrong file
- MessageBox MB_ICONSTOP "Unknown or wrong file $INSTDIR\$TARGETFILE. Bad checksum."
- DetailPrint "ERROR: Unknown or wrong file $TARGETFILE. Bad checksum. "
- Goto EndProg
- ${EndIf}
- ${EndIf}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement