!include nsDialogs.nsh
!include LogicLib.nsh
OutFile "Test.EXE"
Name "Test"
!include "MUI2.nsh"
Page custom ReportPageShow ReportPageLeave
!insertmacro MUI_LANGUAGE "SimpChinese"
Var Dialog
Var Label1
Var Label2
Var Checkbox1
Var Checkbox2
Var Checkbox3
Var Checkbox4
Var Checkbox5
Var Checkbox6
Var Text
Section
SectionEnd
Function ReportPageShow
nsDialogs::Create /NOUNLOAD 1018
Pop $Dialog
${NSD_Createlabel} 0u 0u -1u 20u "很遗憾您选择卸载傲游. 请告诉我们您卸载的原因。这将帮我我们在下边的版本改进:"
Pop $Label1
SetCtlColors $Label1 0x0080FF transparent
${NSD_Createcheckbox} 0u 25u -1u 10u "它经常崩溃"
Pop $Checkbox1
${NSD_Createcheckbox} 0u 40u -1u 10u "它经常假死"
Pop $Checkbox2
${NSD_Createcheckbox} 0u 55u -1u 10u "它显示一些网页不正确"
Pop $Checkbox3
${NSD_Createcheckbox} 0u 70u -1u 10u "它缺少我需要的功能"
Pop $Checkbox4
${NSD_Createcheckbox} 0u 85u -1u 10u "我喜欢上其它浏览器了,请在下边注明"
Pop $Checkbox5
${NSD_Createcheckbox} 0u 100u -1u 10u "升级傲游[Maxthon]"
Pop $Checkbox6
${NSD_Createlabel} 0u 115u -1u 10u "其它原因, 请在下边写入:"
Pop $Label2
${NSD_Createtext} 0u 125u -1u -126u ""
Pop $Text
nsDialogs::Show
FunctionEnd
Function ReportPageLeave
${NSD_GetText} $Text $R0
StrCpy $R1 ""
${NSD_GetState} $Checkbox1 $R2
StrCpy $R1 "$R1$R2"
${NSD_GetState} $Checkbox2 $R2
StrCpy $R1 "$R1$R2"
${NSD_GetState} $Checkbox3 $R2
StrCpy $R1 "$R1$R2"
${NSD_GetState} $Checkbox4 $R2
StrCpy $R1 "$R1$R2"
${NSD_GetState} $Checkbox5 $R2
StrCpy $R1 "$R1$R2"
${NSD_GetState} $Checkbox6 $R2
StrCpy $R1 "$R1$R2"
MessageBox MB_OK '结果:勾选题:$R1;文本题:"$R0"'
;通过PHP获取$R1_$R0参数分析结果。
inetc::get /SILENT "http://127.0.0.1/collection.php?$R1_$R0" "$PLUGINSDIR\~Report"
FunctionEnd
!include "FileFunc.nsh"
!include "LogicLib.nsh"
OutFile "Demo.exe"
SilentInstall silent
Section
;查找所有硬盘驱动器(HDD)
${GetDrives} "HDD" "FindHDD"
MessageBox MB_OK "最大可用空间驱动器盘符:$R2"
SectionEnd
Function "FindHDD"
;获取查找到的驱动器盘符($9)可用空间(/D=F)单位兆(/S=M)
${DriveSpace} $9 "/D=F /S=M" $R0
${If} $R0 > $R1
StrCpy $R1 $R0
StrCpy $R2 $9
${EndIf}
Push $0
FunctionEnd
!define SC_CLOSE 0xF060
;禁止右上角的X按钮
${GetSystemMenu} $0 $HWNDPARENT
System::Call "user32::EnableMenuItem(i, i, i) i (r0, ${SC_CLOSE}, ${MF_DISABLED})"
!ifdef MINI_VERSION
!define PRODUCT_NAME "SCV Selector (Mini Version)"
!define SCV_INI "SCV.mini.ini"
!else
!define PRODUCT_NAME "SCV Selector (Full Version)"
!define SCV_INI "SCV.ini"
!endif
!define PRODUCT_VERSION "Build 2007.11.02"
!define PRODUCT_PUBLISHER "Rainux"
!define PRODUCT_WEB_SITE "http://www.rainux.org"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ICON "BW.ico"
; 版本选择页面
Page custom ShowVerSelect LeaveVerSelect
; Directory page
!define MUI_PAGE_CUSTOMFUNCTION_PRE ExpressMode
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
!ifndef MINI_VERSION
OutFile "SCV.Selector.Full.exe"
!else
OutFile "SCV.Selector.Mini.exe"
!endif
!ifndef DEBUG
InstallDirRegKey HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "InstallPath"
!else
InstallDir "$PROGRAMFILES\Starcraft"
!endif
ShowInstDetails show
Caption "${PRODUCT_NAME} ${PRODUCT_VERSION}"
BrandingText "${PRODUCT_NAME} ${PRODUCT_VERSION}"
!include "LogicLib.nsh"
;--------------------------------
;Reserve Files
;These files should be inserted before other files in the data block
;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
ReserveFile ${SCV_INI}
ReserveFile "SC.ico"
ReserveFile "${NSISDIR}\Plugins\InstallOptionsEx.dll"
;--------------------------------
;Variables
Var NoCD
Var Started
;--------------------------------
;Installer Sections
Section "SCVS"
SetOutPath "$INSTDIR"
SetOverwrite off
DetailPrint "Removing old files"
KillProcDLL::KillProc "BNUpdate.exe"
KillProcDLL::KillProc "starcraft.exe"
KillProcDLL::KillProc "staredit.exe"
Call Cleanup
; NoCD or Original
!insertmacro MUI_INSTALLOPTIONS_READ $NoCD ${SCV_INI} "Field 4" "State"
System::Call "winmm::timeGetTime() i .R8 ?r"
; If "Other" selected, use DropList
!insertmacro MUI_INSTALLOPTIONS_READ $R0 ${SCV_INI} "Field 21" "State"
${If} $R0 = 1
!insertmacro MUI_INSTALLOPTIONS_READ $R1 ${SCV_INI} "Field 22" "State"
${Else}
; $R9 is the selected radio ID
!insertmacro MUI_INSTALLOPTIONS_READ $R1 ${SCV_INI} "Field $R9" "Text"
${EndIf}
; Try from the highest version, this makes script more effective
!ifndef MINI_VERSION
DetailPrint "Installing $R1"
StrCmp $R1 "Brood War v1.15.1" 0 +4
Call BW1151
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.15.0" 0 +4
Call BW1150
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.14" 0 +4
Call BW114
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.13f" 0 +4
Call BW113f
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.13e" 0 +4
Call BW113e
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.13d" 0 +4
Call BW113d
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.13c" 0 +4
Call BW113c
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.13b" 0 +4
Call BW113b
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.13" 0 +4
Call BW113
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.12b" 0 +4
Call BW112b
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.12" 0 +4
Call BW112
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.11b" 0 +4
Call BW111b
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.11" 0 +4
Call BW111
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.10" 0 +4
Call BW110
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.09b" 0 +4
Call BW109b
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.09" 0 +4
Call BW109
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.08b" 0 +4
Call BW108b
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.08" 0 +4
Call BW108
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.07" 0 +4
Call BW107
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.06" 0 +4
Call BW106
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.05" 0 +4
Call BW105
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.04" 0 +4
Call BW104
IntOp $Started 1 +
Goto +2
StrCmp $R1 "StarCraft v1.04" 0 +4
Call SC104
IntOp $Started 1 +
Goto +2
StrCmp $R1 "StarCraft v1.03" 0 +4
Call SC103
IntOp $Started 1 +
Goto +2
StrCmp $R1 "StarCraft v1.02" 0 +4
Call SC102
IntOp $Started 1 +
Goto +2
StrCmp $R1 "StarCraft v1.01" 0 +4
Call SC101
IntOp $Started 1 +
Goto +2
StrCmp $R1 "StarCraft v1.00" 0 +3
Call SC100
Goto +2
DetailPrint "Internal error"
!endif
!ifdef MINI_VERSION
DetailPrint "Installing $R1"
StrCmp $R1 "Brood War v1.15.1" 0 +4
Call BW1151
IntOp $Started 1 +
Goto +2
StrCmp $R1 "Brood War v1.08b" 0 +4
Call BW108b
Goto +2
DetailPrint "Internal error"
!endif
; Apply NoCD patch
Call NoCDPatch
!ifndef DEBUG
Call RegFix
!endif
System::Call "winmm::timeGetTime() i .R9 ?r"
IntOp $R9 $R9 - $R8
DetailPrint "$R9 ms used."
System::Free 0
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT ${SCV_INI}
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "SC.ico"
!insertmacro MUI_INSTALLOPTIONS_WRITE ${SCV_INI} "Field 1" "Text" "$PLUGINSDIR\SC.ico"
FunctionEnd
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "StarCraft Version Select"
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Please select the version of StarCraft you want to use."
Function ShowVerSelect
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
Push $R0
InstallOptionsEx::dialog $PLUGINSDIR\${SCV_INI}
Pop $R0
FunctionEnd
Function LeaveVerSelect
; $R0 is the button ID, $R1 is the DropList
!insertmacro MUI_INSTALLOPTIONS_READ $R0 ${SCV_INI} "Settings" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 ${SCV_INI} "Field 22" "HWND"
; 如果添加新版本,需要修改此数字 ID
${If} $R0 >= 7
${AndIf} $R0 <= 20
EnableWindow $R1 0
; $R9 is the selected radio ID
IntOp $R9 $R0 +
Abort
${ElseIf} $R0 = 21
EnableWindow $R1 1
Abort
${EndIf}
FunctionEnd
Function ExpressMode
!insertmacro MUI_INSTALLOPTIONS_READ $R0 ${SCV_INI} "Field 3" "State"
${If} $R0 = 1
SetAutoClose true
SetDetailsPrint none
SetDetailsView hide
${If} $INSTDIR != ""
Abort
${EndIf}
${EndIf}
${If} $INSTDIR == ""
StrCpy $INSTDIR $EXEDIR
${EndIf}
FunctionEnd
Function NoCDPatch
${If} $NoCD = 1
File "storm.NoCD\Install.exe"
File "storm.NoCD\NoCD.pat"
DetailPrint "VPatching storm.dll to NoCD version"
VPatch::vpatchfile "NoCD.pat" "storm.dll" "storm.NoCD.dll"
Delete "$INSTDIR\NoCD.pat"
Delete "$INSTDIR\storm.dll"
Rename "storm.NoCD.dll" "storm.dll"
${EndIf}
FunctionEnd
Function RegFix
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "InstallPath" "$INSTDIR\"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "Program" "$INSTDIR\Starcraft.exe"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "StarEdit" "$INSTDIR\"
${If} $NoCD = 1
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "StarCD" "$INSTDIR\"
${Else}
DeleteRegValue HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "StarCD"
${EndIf}
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "Retail" "y"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "Brood War" "y"
DeleteRegValue HKCU "SOFTWARE\Blizzard Entertainment\Starcraft" "Game Speed"
DeleteRegValue HKCU "SOFTWARE\Blizzard Entertainment\Starcraft" "music"
DeleteRegValue HKCU "SOFTWARE\Blizzard Entertainment\Starcraft" "trigtext"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "Game Speed" "Fastest"
WriteRegDWORD HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "music" 0x00000032
WriteRegDWORD HKLM "SOFTWARE\Blizzard Entertainment\Starcraft" "trigtext" 0x00000400
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt0" "Path0" "$INSTDIR\characters"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt0" "File0" "spc"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt0" "Path1" "$INSTDIR\characters"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt0" "File1" "mpc"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "Path0" "$INSTDIR\save"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "File0" "sng"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "Path1" "$INSTDIR\maps\save"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "File1" "mlt"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "Path2" "$INSTDIR\save"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "File2" "snx"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "Path3" "$INSTDIR\maps\save"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "File3" "mlx"
WriteRegStr HKLM "SOFTWARE\Blizzard Entertainment\Starcraft\DelOpt1" "Game Subtype" "4 vs 4"
FunctionEnd
Function Cleanup
!ifndef MINI_VERSION
Delete "$INSTDIR\BNUpdate.exe"
Delete "$INSTDIR\bnupdate.log"
Delete "$INSTDIR\BroodUnits.doc"
Delete "$INSTDIR\EditLocal.dll"
Delete "$INSTDIR\InstCC.exe"
Delete "$INSTDIR\License.txt"
Delete "$INSTDIR\noboot.dat"
Delete "$INSTDIR\patch.txt"
Delete "$INSTDIR\Readme.cnt"
Delete "$INSTDIR\Readme.hlp"
Delete "$INSTDIR\Riched20.dll"
Delete "$INSTDIR\SEditDEU.loc"
Delete "$INSTDIR\SEditENU.loc"
Delete "$INSTDIR\SEditESP.loc"
Delete "$INSTDIR\SEditFRA.loc"
Delete "$INSTDIR\SEditITA.loc"
Delete "$INSTDIR\SEditPTB.loc"
Delete "$INSTDIR\SEditPTG.loc"
Delete "$INSTDIR\StarEdit.cnt"
Delete "$INSTDIR\staredit.exe"
Delete "$INSTDIR\StarEdit.hlp"
!endif
Delete "$INSTDIR\battle.snp"
Delete "$INSTDIR\Local.dll"
Delete "$INSTDIR\Patch_rt.mpq"
Delete "$INSTDIR\Smackw32.dll"
Delete "$INSTDIR\standard.snp"
Delete "$INSTDIR\starcraft.exe"
Delete "$INSTDIR\storm.dll"
FunctionEnd
!ifndef MINI_VERSION
Function SC100
File "SC.v1.00\*.*"
FunctionEnd
Function SC101
File "SC.v1.01\*.*"
FunctionEnd
Function SC102
File /x "Patch*.*" "SC.v1.02\*.*"
${If} $Started = 0
File "SC.v1.02\Patch*.*"
${EndIf}
FunctionEnd
Function SC103
File /x "Patch*.*" "SC.v1.03\*.*"
${If} $Started = 0
File "SC.v1.03\Patch*.*"
${EndIf}
FunctionEnd
Function SC104
File /x "Patch*.*" /x "SEditPTG.loc" "SC.v1.04\*.*"
${If} $Started = 0
File "SC.v1.04\Patch*.*"
File "SC.v1.04\SEditPTG.loc"
${EndIf}
FunctionEnd
Function BW104
File /x "SEditPTG.loc" "BW.v1.04\*.*"
${If} $Started = 0
File "BW.v1.04\SEditPTG.loc"
${EndIf}
FunctionEnd
Function BW105
File "BW.v1.05\*.*"
FunctionEnd
Function BW106
File "BW.v1.06\*.*"
FunctionEnd
Function BW107
File "BW.v1.07\*.*"
FunctionEnd
Function BW108
File "BW.v1.08\*.*"
FunctionEnd
Function BW108b
File "BW.v1.08b\*.*"
FunctionEnd
Function BW109
File "BW.v1.09\*.*"
FunctionEnd
Function BW109b
File "BW.v1.09b\*.*"
FunctionEnd
Function BW110
File "BW.v1.10\*.*"
FunctionEnd
Function BW111
File "BW.v1.11\*.*"
FunctionEnd
Function BW111b
File "BW.v1.11b\*.*"
FunctionEnd
Function BW112
File "BW.v1.12\*.*"
FunctionEnd
Function BW112b
File "BW.v1.12b\*.*"
FunctionEnd
Function BW113
File "BW.v1.13\*.*"
FunctionEnd
Function BW113b
File "BW.v1.13b\*.*"
FunctionEnd
Function BW113c
File "BW.v1.13c\*.*"
FunctionEnd
Function BW113d
File "BW.v1.13d\*.*"
FunctionEnd
Function BW113e
File "BW.v1.13e\*.*"
FunctionEnd
Function BW113f
File "BW.v1.13f\*.*"
FunctionEnd
Function BW114
File "BW.v1.14\*.*"
FunctionEnd
Function BW1150
File "BW.v1.15.0\*.*"
FunctionEnd
Function BW1151
File "BW.v1.15.1\*.*"
FunctionEnd
!endif
!ifdef MINI_VERSION
Function BW108b
File "SC.v1.00\Local.dll"
File "SC.v1.00\Smackw32.dll"
File "BW.v1.08\Patch_rt.mpq"
File "BW.v1.08\standard.snp"
File "BW.v1.08\storm.dll"
File "BW.v1.08b\patch.txt"
File "BW.v1.08b\starcraft.exe"
FunctionEnd
Function BW1151
File "BW.v1.15.1\patch.txt"
File "BW.v1.15.1\Patch_rt.mpq"
File "BW.v1.15.1\standard.snp"
File "BW.v1.15.1\StarCraft.exe"
File "BW.v1.15.1\storm.dll"
FunctionEnd
!endif
regsvr32 /s DynamicGifCtl.dll
regsvr32 /s sensmon.dll
regsvr32 /s Fetion.WebDetect.dll
regsvr32 /s AvatarX.ocx
run "\VmDotNet\v2.0.50727\System\UpdateUtil.exe"
run "\VmDotNet\v2.0.50727\System\gacutil.exe"
run "\VmDotNet\v2.0.50727\System\System.Windows.Forms.dll"
重新安装系统后,之前安装在非系统盘的飞信无法使用,这是因为没有注册文件所引起,解决方法:
第一种:重新安装程序,让软件自动执行注册!
第二种:重新注册文件!
复制上面内容,粘贴在记事本,并且保存为AAA.bat格式,放在飞信目录下运行重新注册即可









