VPatchLib.nsh 677 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ; PatchLib v3.0
  2. ; =============
  3. ;
  4. ; Library with macro for use with VPatch (DLL version) in NSIS 2.0.5+
  5. ; Created by Koen van de Sande
  6. !include LogicLib.nsh
  7. !macro VPatchFile PATCHDATA SOURCEFILE TEMPFILE
  8. Push $1
  9. Push $2
  10. Push $3
  11. Push $4
  12. Push ${SOURCEFILE}
  13. Push ${TEMPFILE}
  14. Pop $2 # temp file
  15. Pop $3 # source file
  16. InitPluginsDir
  17. GetTempFileName $1 $PLUGINSDIR
  18. File /oname=$1 ${PATCHDATA}
  19. vpatch::vpatchfile $1 $3 $2
  20. Pop $4
  21. DetailPrint $4
  22. StrCpy $4 $4 2
  23. ${Unless} $4 == "OK"
  24. SetErrors
  25. ${EndIf}
  26. ${If} ${FileExists} $2
  27. Delete $3
  28. Rename /REBOOTOK $2 $3
  29. ${EndIf}
  30. Delete $1
  31. Pop $4
  32. Pop $3
  33. Pop $2
  34. Pop $1
  35. !macroend