Advertisement
tolikpunkoff

FoxitDisableUpdaterPatch.nsi

Jun 13th, 2022
2,394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Unicode true
  2. !include LogicLib.nsh
  3.  
  4. ; Define your application name
  5. !define APPNAME "Foxit Updater Disable Patch"
  6. !define APPNAMEANDVERSION "Foxit Updater Disable Patch"
  7.  
  8. ; Main Install settings
  9. Name "${APPNAMEANDVERSION}"
  10. InstallDir "$PROGRAMFILES\Foxit Software\Foxit Reader\"
  11. OutFile "DisableUpdaterPatch.exe"
  12.  
  13. DirText "Choose the folder in which to install ${APPNAMEANDVERSION}."
  14. ShowInstDetails show
  15. ;RequestExecutionLevel User
  16.  
  17. Section "Foxit Updater Disable Patch"
  18.  
  19.     ; Set Section properties
  20.     SetOverwrite on
  21.    
  22.     ;Check is Foxit reader install in this dir
  23.     IfFileExists "$INSTDIR\FoxitReader.exe" 0 NoReader
  24.  
  25.     ; Unpack Files
  26.     SetOutPath "$TEMP\DUPatch\"
  27.     File "new\simplem.exe"
  28.     File "old\FoxitUpdater.exe"
  29.    
  30.     DetailPrint "Install Dir: $INSTDIR"
  31.    
  32.     Var /GLOBAL Updater1
  33.     Var /GLOBAL Updater2
  34.     StrCpy $Updater1 "$INSTDIR\FoxitUpdater.exe"
  35.     StrCpy $Updater2 "$APPDATA\Foxit Software\Addon\Foxit Reader\FoxitReaderUpdater.exe"
  36.    
  37.     IfFileExists $Updater1 0 NoUpdater
  38.     IfFileExists $Updater2 0 NoUpdater
  39.    
  40.     ;Check MD5
  41.     md5dll::GetMD5File "$Updater1"
  42.     Pop $0
  43.     ;DetailPrint "$0"
  44.     StrCpy $1 "ba69c0d287a5e3991c2136d2f4002228" ;Patched file MD5
  45.     ${If} $0 == $1
  46.         ;restore
  47.         MessageBox MB_YESNO|MB_ICONQUESTION "Files patched! Restore originals?"  IDYES 0 IDNO EndProg
  48.         DetailPrint "Restore..."
  49.         CopyFiles "$TEMP\DUPatch\FoxitUpdater.exe" "$Updater1"
  50.         CopyFiles "$TEMP\DUPatch\FoxitUpdater.exe" "$Updater2"
  51.     ${Else}
  52.         StrCpy $1 "77b9b7e5296209ab38f3d6d2b5e62117" ;Original file MD5
  53.         ${If} $0 == $1
  54.             MessageBox MB_YESNO|MB_ICONQUESTION "Patch files?" IDYES 0 IDNO EndProg
  55.             DetailPrint "Patch..."
  56.             CopyFiles "$TEMP\DUPatch\simplem.exe" "$Updater1"
  57.             CopyFiles "$TEMP\DUPatch\simplem.exe" "$Updater2"
  58.         ${Else}
  59.             DetailPrint "Other version..."
  60.             MessageBox MB_YESNO|MB_ICONQUESTION "Unknow version Foxit Reader. Patch files?" IDYES 0 IDNO EndProg
  61.             DetailPrint "Patch..."
  62.             CopyFiles "$TEMP\DUPatch\simplem.exe" "$Updater1"
  63.             CopyFiles "$TEMP\DUPatch\simplem.exe" "$Updater2"
  64.         ${EndIf}       
  65.     ${EndIf}
  66.  
  67.     GoTo EndProg
  68.    
  69.     NoUpdater:
  70.         MessageBox MB_YESNO|MB_ICONQUESTION "No updater(s). Maybe updater removed. Install patched updater?" IDYES 0 IDNO EndProg
  71.         DetailPrint "Patch..."
  72.         CopyFiles "$TEMP\DUPatch\simplem.exe" "$Updater1"
  73.         CopyFiles "$TEMP\DUPatch\simplem.exe" "$Updater2"
  74.  
  75.         GoTo EndProg
  76.    
  77.     NoReader:
  78.         MessageBox MB_ICONSTOP "No file $INSTDIR\FoxitReader.exe. Foxit is not installed or wrong directory selected?"
  79.     EndProg:
  80. SectionEnd
  81.  
  82. ; eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement