【原创】暴风影音去广告补丁源代码公布

  曾经答应过的事,现在整理好了,这几天事情多也差点忘了。NSIS写的小东西,没想到喜欢的人还不少,苦于最近时间不多,特将源码贴出,希望有能力或者想继续的朋友接力。想学NSIS的朋友,希望这个对你们也有些用处吧。没啥技术含量,所以可以随意转载,但是最好请注明出处。谢谢!

   1
;暴风影音去广告补丁
   2 ;编写:寒星
   3
   4
!define PRODUCT_NAME "暴风影音去广告补丁"
   5
!define PRODUCT_VERSION "v1.6版"
   6
!define PRODUCT_PUBLISHER "寒星工作室"
   7
!define PRODUCT_WEB_SITE "https://www.hxlive.cn"
   8
SetCompressor /solid lzma
   9
SetCompressorDictSize 32
  10
  11
;----------------基础信息--------------------------------------
  12
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  13
SetDatablockOptimize on
  14
outfile "Storm3 NoAD v1.6.exe"
  15
Caption  "暴风影音3去广告补丁 v1.6"
  16
BrandingText " 寒星工作室 ${__DATE__} "
  17
  18
;---------------------安装代码使用-------------------------------
  19
!include "MUI.nsh"
  20
!include "UsefulLib.nsh"
  21
!define MUI_ICON "Storm.ico"
  22
Page custom Storm2
  23
Page custom do
  24
!insertmacro MUI_LANGUAGE "SimpChinese"
  25
ChangeUI all default.exe
  26
MiscButtonText "" "执行" "" "完成"
  27
  28
;---------------------版本信息--------------------------------
  29
VIProductVersion "1.6.0.0314"
  30
VIAddVersionKey /LANG=${LANG_SimpChinese} "FileVersion" "1.6.0.0314"
  31
VIAddVersionKey /LANG=${LANG_SimpChinese} "ProductName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  32
VIAddVersionKey /LANG=${LANG_SimpChinese} "Comments" "${PRODUCT_NAME}"
  33
VIAddVersionKey /LANG=${LANG_SimpChinese} "CompanyName" "寒星工作室"
  34
VIAddVersionKey /LANG=${LANG_SimpChinese} "LegalCopyright" "版权所有 (C) 寒星工作室"
  35
VIAddVersionKey /LANG=${LANG_SimpChinese} "FileDescription" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  36
;---------------------------------------------------------
  37
  38
Section
  39 SectionEnd
  40
  41 ReserveFile
"${NSISDIR}PluginsInstallOptions.dll"
  42
ReserveFile "Storm216.ini"
  43
ReserveFile "TOP.bmp"
  44
  45
Function Storm2
  46   
!addplugindir E:安装制作NSISPlugins
  47    FindProcDLL::FindProc
"Storm.exe"
  48     
StrCmp $R0 1 +3 +1
  49    
FindProcDLL::FindProc "Storm2.exe"
  50     
StrCmp $R0 1 +1 +4
  51      
MessageBox MB_ICONINFORMATION|MB_RETRYCANCEL "安装程序检测到 暴风影音 正在运行!请退出程序重试或取消本次安装!"   IDRetry retry IDCANCEL Cancel
  52      Retry:
  53       
Goto -5
  54      
Cancel:
  55       
Quit
  56       
  57   InitPluginsDir
  58    File
/oname=$PLUGINSDIRStorm216.ini "Storm216.ini"
  59    
File /oname=$PLUGINSDIR op.bmp "top.bmp"
  60    
WriteINIStr "$PLUGINSDIRStorm216.ini" "Field 1" "Text" $PLUGINSDIR op.bmp
  61    
ReadRegStr $R1 HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstallstorm2" "DisplayIcon"
  62    
StrCpy $R2 $R1 -9
  63    
WriteINIStr "$PLUGINSDIRStorm216.ini" "Field 5" "State" $R2
  64
  65   
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIRStorm216.ini"
  66   
Pop $0
  67   
InstallOptions::show
  68   
Pop $0
  69