nsis64 / Contrib / VPatch / VPatchLib.nsh

; PatchLib v3.0
; =============
;
; Library with macro for use with VPatch (DLL version) in NSIS 2.0.5+
; Created by Koen van de Sande

!include LogicLib.nsh

!macro VPatchFile PATCHDATA SOURCEFILE TEMPFILE

  Push $1
  Push $2
  Push $3
  Push $4

  Push ${SOURCEFILE}
  Push ${TEMPFILE}

  Pop $2 # temp file
  Pop $3 # source file

  InitPluginsDir
  GetTempFileName $1 $PLUGINSDIR
  File /oname=$1 ${PATCHDATA}

  vpatch::vpatchfile $1 $3 $2
  Pop $4
  DetailPrint $4

  StrCpy $4 $4 2
  ${Unless} $4 == "OK"
    SetErrors
  ${EndIf}

  ${If} ${FileExists} $2
    Delete $3
    Rename /REBOOTOK $2 $3
  ${EndIf}

  Delete $1

  Pop $4
  Pop $3
  Pop $2
  Pop $1

!macroend
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.