脚本:蓝色网际的Winamp安装包

优质
小牛编辑
136浏览
2023-12-01
引用Winamp.nsi的内容:

#######################################################################################
# 编译: 必须使用 NSIS 2.01 或以上版本

# 自定义设置,版本号等等
!define VERSION "5.05"
!define VERSION_NUM "505"

# 至少定义一个版本,至多定义一个版本
# 定义一个版本的同时,注释另外两个版本的定义
!define INSTALLER_FULL		;定义完整版
;!define INSTALLER_PRO		;定义专业版
;!define INSTALLER_LITE		;定义精简版

# 定义是否使用 LogSet 指令,默认为启用
# 如果定义你还需要一个启用了 LogSet 指令的特别版 makensis.exe
# 地址: http://nsis.sourceforge.net/download/specialbuilds/
# 定义 LogSet 后可以根据安装时创建的记录文件在卸载时自动删除文件而不需要手动加入删除指令
# 使用了 File,CreateShortCut 指令产生的文件在卸载时都会被自动删除
# 如果需要上面所述的功能,取消定义前的注释,如果不需要,注释下面的定义
!define LOG_SET_SUPPORT

# 定义是否使用是否把许可页面的文本框里的字体设为 Tahoma 8,默认为启用
# 如果许可文本是全英文或英文占多数的话 Tahoma 8 会有较好的显示效果
# 此定义可以越过 NSIS 所使用语言的字体控制,但仅对许可页面的文本有效
# 取消此定义则许可页面文本使用所使用语系的默认字体(由 NSIS 语言文件控制)
# 如果需要上面所述的功能,取消定义前的注释,如果不需要,注释下面的定义
!define LICENSE_PAGE_CHANGE_FONT

# 定义是否在启动时是否要选择语言,默认为禁用
# 如果需要上面所述的功能,取消定义前的注释,如果不需要,注释下面的定义
;!define LANGUAGE_SELECT_SUPPORT

#######################################################################################


!ifdef INSTALLER_FULL	
	!ifdef INSTALLER_LITE | INSTALLER_PRO
		!error "INSTALLER_FULL、INSTALLER_PRO、INSTALLER_LITE 中只能定义一个。"
	!endif
	!define GAYDATA "gaydata.ini"
	!define FILE_NAME "Winamp${VERSION_NUM}_full"
!endif

!ifdef INSTALLER_PRO	
	!ifdef INSTALLER_FULL | INSTALLER_LITE
		!error "INSTALLER_FULL、INSTALLER_PRO、INSTALLER_LITE 中只能定义一个。"
	!endif
	!define GAYDATA "gaydata.ini"
	!define FILE_NAME "Winamp${VERSION_NUM}_pro"
!endif	

!ifdef INSTALLER_LITE	
	!ifdef INSTALLER_FULL | INSTALLER_PRO
		!error "INSTALLER_FULL、INSTALLER_PRO、INSTALLER_LITE 中只能定义一个。"
	!endif
	!define GAYDATA "gaydata_lite.ini"
	!define FILE_NAME "Winamp${VERSION_NUM}_lite"
!endif	

!ifndef INSTALLER_FULL & INSTALLER_PRO & INSTALLER_LITE
	!error "请定义 INSTALLER_FULL、INSTALLER_PRO、INSTALLER_LITE 中的一个。"
!endif	
	
;----------------------------------安装程序属性
Name                 "Winamp"
OutFile              "${FILE_NAME}.exe"
SetCompressor        lzma
BrandingText         "$(BRANDING_TEXT)"
InstallDir           "$PROGRAMFILES\Winamp"
InstallDirRegKey     HKCU "Software\Winamp" ""

Var HWND
Var INTERNET

ReserveFile          ".\resource\${GAYDATA}"
ReserveFile          ".\resource\opt2page.ini"
ReserveFile          ".\resource\opt3page.ini"	
ReserveFile          ".\resource\classic256.bmp"
ReserveFile          ".\resource\modern256.bmp"
ReserveFile          "${NSISDIR}\Plugins\InstallOptions.dll"
!ifdef LANGUAGE_SELECT_SUPPORT
ReserveFile          "${NSISDIR}\Plugins\LangDLL.dll"
!endif
	
!include             "MUI.nsh"
!include             "Sections.nsh"
!define              LOGICLIB_SECTIONCMP
!include             "LogicLib.nsh"
;----------------------------------包含多语言
!include             "Language.nsi"

;----------------------------------页面界面设置
	!define MUI_ICON ".\resource\inst.ico"
	!define MUI_UNICON ".\resource\uninst.ico"
	!define MUI_HEADERIMAGE
	!define MUI_HEADERIMAGE_BITMAP ".\resource\modern-header.bmp"
	!define MUI_COMPONENTSPAGE_NODESC
	
;----------------------------------页面文本设置
	!define MUI_LICENSEPAGE_TEXT_TOP "$(MUI_LICENSEPAGE_TEXT_TOP)"
	!define MUI_COMPONENTSPAGE_TEXT_TOP "$(MUI_COMPONENTSPAGE_TEXT_TOP)"
	!define MUI_DIRECTORYPAGE_TEXT_TOP "$(MUI_DIRECTORYPAGE_TEXT_TOP)"
	!define MUI_ABORTWARNING

;----------------------------------插入页面
!ifdef LICENSE_PAGE_CHANGE_FONT
	!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicensePage
!endif	
	!insertmacro MUI_PAGE_LICENSE ".\resource\License.txt"
	!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentPre
	!define MUI_PAGE_CUSTOMFUNCTION_SHOW ComponentShow
	!insertmacro MUI_PAGE_COMPONENTS
	!insertmacro MUI_PAGE_DIRECTORY
	!define MUI_PAGE_HEADER_TEXT "$(MUI_PAGE_ASSOCIATION_HEADER_TEXT)"
	!define MUI_PAGE_HEADER_SUBTEXT "$(MUI_PAGE_ASSOCIATION_HEADER_SUBTEXT)"
	!define MUI_PAGE_CUSTOMFUNCTION_PRE AsscoiationPre
	!define MUI_PAGE_CUSTOMFUNCTION_SHOW AsscoiationShow
	!insertmacro MUI_PAGE_COMPONENTS
	Page custom SetCustom2 LeaveCustom2
	Page custom SetCustom3 LeaveCustom3
	!insertmacro MUI_PAGE_INSTFILES

	!insertmacro MUI_UNPAGE_CONFIRM
	!insertmacro MUI_UNPAGE_INSTFILES
;----------------------------------插入语言
	!insertmacro MUI_LANGUAGE English
	!insertmacro MUI_LANGUAGE SimpChinese
	
!macro SelectIfSet SECTION1 SECTION2
	Push $0
	Push $1
		SectionGetFlags ${SECTION1} $0
		SectionGetFlags ${SECTION2} $1
		IntOp $0 $0 & ${SF_SELECTED}
		StrCmp $0 ${SF_SELECTED} +5 
		IntOp $1 $1 & ${SECTION_OFF}
		SectionSetFlags ${SECTION2} $1
		SectionSetText ${SECTION2} ""
		Goto +3
		IntOp $1 $1 | ${SF_SELECTED}
		SectionSetFlags ${SECTION2} $1
	Pop $1
	Pop $0
!macroend

!macro AssocIfSectionIsSelected EXT TYPE SECTION
	Push $0
		${If} ${SectionIsSelected} ${SECTION}
			ReadRegStr $0 HKCR ".${EXT}" ""
			${If} $0 != "Winamp.File"
			${AndIf} $0 != "Winamp.Playlist"
			${AndIf} $0 != "Winamp.SkinZip"
				WriteRegStr HKCR ".${EXT}" "" "${TYPE}"
				WriteRegStr HKCR ".${EXT}" "Winamp_Back" $0
			${EndIf}
		${EndIf}
	Pop $0
!macroend

!ifdef INSTALLER_FULL | INSTALLER_PRO	
InstType "$(INST_TYPE_FULL)"
InstType "$(INST_TYPE_STD)"
!endif
InstType "$(INST_TYPE_LITE)"
InstType "$(INST_TYPE_MIN)"

Section "主程序" main
	SectionIn 1 2 3 4 RO
	SetAutoClose         true
	
	ClearErrors ;检测,如果 Winamp 在运行则关闭
	Delete "$INSTDIR\Winamp.exe"
	${If} ${Errors}
		Push "Winamp v1.x" 
		Call CloseProgram
	${EndIf}
	
!ifdef LOG_SET_SUPPORT
	Delete "$INSTDIR\install.log"
	LogSet on
!endif

	SetOutPath $INSTDIR
	File ".\include\demo.mp3"
	File ".\include\whatsnew.txt"
	File ".\include\Winamp.exe"
	File ".\include\winamp.lks"
	File ".\include\Winamp.q1"
	File ".\include\winampmb.htm"
	
	;写入 winamp.m3u
	FileOpen $0 "$INSTDIR\winamp.m3u" w
	FileWrite $0 "#EXTM3U$\r$\n"
	FileWrite $0 "#EXTINF:5,demo$\r$\n"
	FileWrite $0 "demo.mp3$\r$\n"
	FileClose $0
	
	SetOutPath "$INSTDIR\Plugins"
	File ".\include\Plugins\out_wave.dll"
	File ".\include\Plugins\in_mp3.dll"
SectionEnd

Section "Winamp 代理" agent
	SectionIn 1 2 3
	Push "WinampAgentMain"
	Call CloseProgram
	StrCpy $0 "$INSTDIR\winampa.exe"
	ClearErrors
	Delete $0
	${If} ${Errors}
		GetTempFileName $1
		StrCpy $0 $1
	${EndIf}	
	File /oname=$0 ".\include\winampa.exe"
	${IfThen} $0 == $1 ${|} Rename /REBOOTOK $0 "$INSTDIR\winampa.exe" ${|}
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Run" WinampAgent "$INSTDIR\winampa.exe"
SectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO
	
Section "Winamp 媒体库"
	SectionIn 1 2
	File ".\include\Plugins\gen_ml.dll"
SectionEnd

Section "现代外观" modern_skin
	SectionIn 1 2
	SetOutPath "$INSTDIR\Skins"
	File /r ".\include\Skins\Winamp Modern"
	SetOutPath "$INSTDIR\Plugins"
	File ".\include\Plugins\gen_ff.dll"
	File /r ".\include\Plugins\freeform"
SectionEnd

!endif

SubSection "界面扩展"
	Section "全局热键"
		SectionIn 1 2 3
		File ".\include\Plugins\gen_hotkeys.dll"
	SectionEnd

	Section "跳转到文件"
		SectionIn 1 2 3
		File ".\include\Plugins\gen_jumpex.dll"
	SectionEnd

	Section "托盘控制"
		SectionIn 1 2 3
		File ".\include\Plugins\gen_tray.dll"
	SectionEnd
SubSectionEnd

SubSection "音频文件"
!ifdef INSTALLER_FULL | INSTALLER_PRO	
	Section "Windows Media Audio (WMA)" wma
		SectionIn 1
		File ".\include\Plugins\in_wm.dll"
		File ".\include\Plugins\wmahelp.dll"
		
!ifdef LOG_SET_SUPPORT
	LogSet off
!endif
		;如果已安装则跳过
		ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32" "msacm.msaudio1"
		ReadRegStr $1 HKLM "System\CurrentControlSet\Control\MediaResources\ACM\msacm.msaudio1" "Driver"
		${If} $0 != "msaud32.acm"
		${AndIf} $1 != "msaud32.acm"
			File "/oname=$PLUGINSDIR\wmaudioredist.exe" ".\include\wmaudioredist.exe"
			ExecWait '"$PLUGINSDIR\wmaudioredist.exe" /Q /R:N'
		${EndIf}
!ifdef LOG_SET_SUPPORT
	LogSet on
!endif
	SectionEnd

	Section "MIDI" midi
		SectionIn 1 2
		File ".\include\Plugins\in_midi.dll"
		File ".\include\Plugins\read_file.dll"
	SectionEnd

	Section "MOD/XM/S3M/IT" mod
		SectionIn 1 2
		File ".\include\Plugins\in_mod.dll"
	SectionEnd

	Section "OGG Vorbis" ogg
		SectionIn 1 2
		File ".\include\Plugins\in_vorbis.dll"
	SectionEnd

	Section "AAC 编码"
		SectionIn 1 2
		File ".\include\Plugins\enc_aac.dll"
	SectionEnd

	Section "MP3 编码"
		SectionIn 1 2
		File ".\include\Plugins\enc_lame.dll"
		File ".\include\Plugins\lame_enc.dll"
	SectionEnd

	Section "MP4" mp4
		SectionIn 1 2
		File ".\include\Plugins\in_mp4.dll"
		File ".\include\Plugins\enc_mp4.dll"
		File ".\include\Plugins\libmp4v2.dll"
	SectionEnd
!endif

	Section "CD" cd
		SectionIn 1 2 3
		File ".\include\Plugins\in_cdda.dll"
	SectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO	
	Section "Sonic Rip、烧录"
		SectionIn 1 2
		File "/oname=$INSTDIR\PXSDKPLS.dll" ".\include\PXSDKPLS.dll"
		
!ifdef LOG_SET_SUPPORT
	LogSet off
!endif
		;SetOutPath "$PLUGINSDIR"
		;File /r ".\include\Sonic Runtime\*.*"
		;unknown how to install the drivers
		SetOutPath "$INSTDIR\Plugins"
!ifdef LOG_SET_SUPPORT
	LogSet on
!endif
	SectionEnd

	Section "CDDB" cddb
		SectionIn 1 2
		File ".\include\Plugins\CDDBControlWinamp.dll"
		File ".\include\Plugins\CDDBUIWinamp.dll"
		File ".\include\Plugins\in_cdda.dll"
	SectionEnd
!endif ;end of INSTALLER_FULL | INSTALLER_PRO above

	Section "WAV/VOC/AU/AIFF" wav
		SectionIn 1 2 3
		File ".\include\Plugins\in_wave.dll"
	SectionEnd
SubSectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO	
SubSection "视频文件" sub_video
	Section "Nullsoft 视频 (NSV)" nsv
		SectionIn 1 2
		File ".\include\Plugins\in_nsv.dll"
		File ".\include\Plugins\nsvdec_vp5.dll"
		File ".\include\Plugins\nsvdec_vp6.dll"
	SectionEnd

	Section "AVI/MPG/ASF" avi
		SectionIn 1 2
		File ".\include\Plugins\in_dshow.dll"
	SectionEnd
SubSectionEnd
!endif

SubSection "可视化"
	Section "Nullsoft 微型全屏"
		SectionIn 1 2 3
		File ".\include\Plugins\vis_nsfs.dll"
	SectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO	
	Section "高级可视化"
		SectionIn 1 2
		File ".\include\Plugins\vis_avs.dll"
		File /r ".\include\Plugins\avs"
	SectionEnd

	Section "Milkdrop"
		SectionIn 1 2
		File ".\include\Plugins\vms_desktop.dll"
		File ".\include\Plugins\milkdrop.html"
		File ".\include\Plugins\vis_milk.dll"
		File /r ".\include\Plugins\Milkdrop"
	SectionEnd
!endif
SubSectionEnd

SubSection "特别的音频输出、效果支持"
!ifdef INSTALLER_FULL | INSTALLER_PRO	
	Section "信号处理器工作室插件"
		SectionIn 1 2 3
		File ".\include\Plugins\dsp_sps.dll"
		File /r ".\include\Plugins\DSP_SPS"
	SectionEnd

	Section "写入 WAV 文件支持"
		SectionIn 1 2
		File ".\include\Plugins\out_disk.dll"
	SectionEnd
!endif

	Section "DirectSound 输出支持"
		SectionIn 1 2 3
		File ".\include\Plugins\out_ds.dll"
	SectionEnd
SubSectionEnd

Section "" compon
SectionEnd	

Section "" icon
SectionEnd	

Section "开始菜单组"
	SectionIn 1 2 3 4
	SetOutPath "$SMPROGRAMS\Winamp"
	CreateShortCut "$SMPROGRAMS\Winamp\Winamp.lnk" "$INSTDIR\Winamp.exe"
	CreateShortCut "$SMPROGRAMS\Winamp\What's New.lnk" "$INSTDIR\whatsnew.txt"
	CreateShortCut "$SMPROGRAMS\Winamp\$(START_MENU_UNINST).lnk" "$INSTDIR\UninstWA.exe"
SectionEnd	

Section "桌面图标"
	SectionIn 1 2 3 4
	SetOutPath $DESKTOP
	CreateShortCut "$DESKTOP\Winamp.lnk" "$INSTDIR\Winamp.exe"
SectionEnd	

Section "快速启动栏"
	SectionIn 1 2 3 4
	SetOutPath $QUICKLAUNCH
	CreateShortCut "$QUICKLAUNCH\Winamp.lnk" "$INSTDIR\Winamp.exe"
SectionEnd	

Section
!ifdef LOG_SET_SUPPORT
	LogSet off
!endif
SectionEnd	

Section "系统托盘图标/代理" run_agent
	SectionIn 1 2 3 4
	Exec "$INSTDIR\winampa.exe"
SectionEnd	

Section "关联音频文件"
	SectionIn 1 2 3 4
	DetailPrint "$(REGISTRYING)"
	!insertmacro AssocIfSectionIsSelected mp3 "Winamp.File" ${main}
	!insertmacro AssocIfSectionIsSelected mp2 "Winamp.File" ${main}
	!insertmacro AssocIfSectionIsSelected mp1 "Winamp.File" ${main}
	!insertmacro AssocIfSectionIsSelected aac "Winamp.File" ${main}
	!insertmacro AssocIfSectionIsSelected apl "Winamp.File" ${main}
	!insertmacro AssocIfSectionIsSelected aif "Winamp.File" ${wav}
	!insertmacro AssocIfSectionIsSelected aiff "Winamp.File" ${wav}
	!insertmacro AssocIfSectionIsSelected au "Winamp.File" ${wav}
	!insertmacro AssocIfSectionIsSelected snd "Winamp.File" ${wav}
	!insertmacro AssocIfSectionIsSelected voc "Winamp.File" ${wav}
	!insertmacro AssocIfSectionIsSelected wav "Winamp.File" ${wav}
!ifdef INSTALLER_FULL | INSTALLER_PRO	
	!insertmacro AssocIfSectionIsSelected NSA "Winamp.File" ${nsv}
	!insertmacro AssocIfSectionIsSelected wma "Winamp.File" ${wma}
	!insertmacro AssocIfSectionIsSelected mid "Winamp.File" ${midi}
	!insertmacro AssocIfSectionIsSelected midi "Winamp.File" ${midi}
	!insertmacro AssocIfSectionIsSelected rmi "Winamp.File" ${midi}
	!insertmacro AssocIfSectionIsSelected KAR "Winamp.File" ${midi}
	!insertmacro AssocIfSectionIsSelected miz "Winamp.File" ${midi}
	!insertmacro AssocIfSectionIsSelected it "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected itz "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected mdz "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected mod "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected mtm "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected m3m "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected s3z "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected stm "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected xm "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected xmz "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected 669 "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected amf "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected far "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected nst "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected okt "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected ptm "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected stz "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected ult "Winamp.File" ${mod}
	!insertmacro AssocIfSectionIsSelected ogg "Winamp.File" ${ogg}
	${IfThen} ${SectionIsSelected} ${ogg} ${|} WriteRegDWORD HKCU "Software\Winamp\in_vorbis" version 0x10204 ${|}
	!insertmacro AssocIfSectionIsSelected m4a "Winamp.File" ${mp4}
	!insertmacro AssocIfSectionIsSelected mp4 "Winamp.File" ${mp4}
	!insertmacro AssocIfSectionIsSelected cda "Winamp.File" ${cddb}
!endif	
SectionEnd	

!ifdef INSTALLER_FULL | INSTALLER_PRO	
Section "关联视频文件" assoc_video
	SectionIn 1 2 3 4
	DetailPrint "$(REGISTRYING)"
	!insertmacro AssocIfSectionIsSelected NSV "Winamp.File" ${nsv}
	!insertmacro AssocIfSectionIsSelected avi "Winamp.File" ${avi}
	!insertmacro AssocIfSectionIsSelected asf "Winamp.File" ${avi}
	!insertmacro AssocIfSectionIsSelected m2v "Winamp.File" ${avi}
	!insertmacro AssocIfSectionIsSelected mpeg "Winamp.File" ${avi}
	!insertmacro AssocIfSectionIsSelected mpg "Winamp.File" ${avi}
	!insertmacro AssocIfSectionIsSelected wmv "Winamp.File" ${avi}
SectionEnd	
!endif

Section "关联音频 CD" assoc_cd
	SectionIn 1 2 3 4
	DetailPrint "$(REGISTRYING)"
	ReadRegStr $0 HKCR "AudioCD\shell\play\command" ""
	StrCpy $1 $0 "" 14
	StrCmp $1 'Winamp.exe" %1' +3
	WriteRegStr HKCR "AudioCD\shell\play\command" "Winamp_Back" $0
	WriteRegStr HKCR "AudioCD\shell\play\command" "" '"$INSTDIR\Winamp.exe" %1'
SectionEnd	

Section "关联播放列表文件 (*.m3u,*.pls)" pls
	SectionIn 1 2 3 4
	!insertmacro AssocIfSectionIsSelected m3u "Winamp.Playlist" ${main}
	!insertmacro AssocIfSectionIsSelected pls "Winamp.Playlist" ${main}
SectionEnd	

Section "" end
	!insertmacro AssocIfSectionIsSelected wsz "Winamp.SkinZip" ${main}
	!insertmacro AssocIfSectionIsSelected wal "Winamp.SkinZip" ${main}
	
	WriteRegStr HKCU "Software\Winamp" "" "$INSTDIR"
	WriteRegStr HKCR "Winamp.File" "" "$(REG_MEDIA_FILE)"
	WriteRegStr HKCR "Winamp.File\DefaultIcon" "" "$INSTDIR\Winamp.exe,1"
	WriteRegStr HKCR "Winamp.File\shell" "" "Play"
	WriteRegStr HKCR "Winamp.File\shell\Play" "" "$(REG_PLAY)"
	WriteRegStr HKCR "Winamp.File\shell\Play\command" "" "$\"$INSTDIR\Winamp.exe$\" $\"%1$\""
	WriteRegStr HKCR "Winamp.File\shell\open" "" ""
	WriteRegStr HKCR "Winamp.File\shell\open\command" "" "$\"$INSTDIR\Winamp.exe$\" $\"%1$\""
	WriteRegStr HKCR "Winamp.File\shell\Enqueue" "" "$(REG_ENQUEUE)"
	WriteRegStr HKCR "Winamp.File\shell\Enqueue\command" "" "$\"$INSTDIR\Winamp.exe$\" /ADD $\"%1$\""
	WriteRegStr HKCR "Winamp.File\shell\ListBookmark" "" "$(REG_ADD_BOOKMARK)"
	WriteRegStr HKCR "Winamp.File\shell\ListBookmark\command" "" "$\"$INSTDIR\Winamp.exe$\" /BOOKMARK $\"%1$\""
	WriteRegStr HKCR "Winamp.Playlist" "" "$(REG_PLAYLIST_FILE)"
	WriteRegBin HKCR "Winamp.Playlist" "EditFlags" 00000100
	WriteRegStr HKCR "Winamp.Playlist\DefaultIcon" "" "$INSTDIR\Winamp.exe,1"
	WriteRegStr HKCR "Winamp.Playlist\shell" "" "Play"
	WriteRegStr HKCR "Winamp.Playlist\shell\Play" "" "$(REG_PLAY)"
	WriteRegStr HKCR "Winamp.Playlist\shell\Play\command" "" "$\"$INSTDIR\Winamp.exe$\" $\"%1$\""
	WriteRegStr HKCR "Winamp.Playlist\shell\open" "" ""
	WriteRegStr HKCR "Winamp.Playlist\shell\open\command" "" "$\"$INSTDIR\Winamp.exe$\" $\"%1$\""
	WriteRegStr HKCR "Winamp.Playlist\shell\Enqueue" "" "$(REG_ENQUEUE)"
	WriteRegStr HKCR "Winamp.Playlist\shell\Enqueue\command" "" "$\"$INSTDIR\Winamp.exe$\" /ADD $\"%1$\""
	WriteRegStr HKCR "Winamp.Playlist\shell\ListBookmark" "" "$(REG_ADD_BOOKMARK)"
	WriteRegStr HKCR "Winamp.Playlist\shell\ListBookmark\command" "" "$\"$INSTDIR\Winamp.exe$\" /BOOKMARK $\"%1$\""
	WriteRegStr HKCR "Winamp.SkinZip" "" "$(REG_EXT_INST_FILE)"
	WriteRegBin HKCR "Winamp.SkinZip" "EditFlags" 00000100
	WriteRegStr HKCR "Winamp.SkinZip\DefaultIcon" "" "$INSTDIR\Winamp.exe,1"
	WriteRegStr HKCR "Winamp.SkinZip\shell" "" "Install"
	WriteRegStr HKCR "Winamp.SkinZip\shell\install" "" ""
	WriteRegStr HKCR "Winamp.SkinZip\shell\install\command" "" "$\"$INSTDIR\Winamp.exe$\" $\"%1$\""
	WriteRegStr HKCR "Directory\shell\Winamp.Play" "" "$(REG_PLAY)"
	WriteRegStr HKCR "Directory\shell\Winamp.Play\command" "" "$\"$INSTDIR\Winamp.exe$\" $\"%1$\""
	WriteRegStr HKCR "Directory\shell\Winamp.Enqueue" "" "$(REG_ENQUEUE)"
	WriteRegStr HKCR "Directory\shell\Winamp.Enqueue\command" "" "$\"$INSTDIR\Winamp.exe$\" /ADD $\"%1$\""
	WriteRegStr HKCR "Directory\shell\Winamp.Bookmark" "" "$(REG_ADD_BOOKMARK)"
	WriteRegStr HKCR "Directory\shell\Winamp.Bookmark\command" "" "$\"$INSTDIR\Winamp.exe$\" /BOOKMARK $\"%1$\""
	
	StrCmp $INTERNET "" +2
	WriteINIStr "$INSTDIR\Winamp.ini" Winamp inet_mode $INTERNET
	
	ReadINIStr $0 "$PLUGINSDIR\opt2page.ini" "Field 7" State
	StrCmp $0 "" +3
	StrCmp $0 "$(MUI_PAGE_OPTION2_FIELD7_STATE)" +2
	WriteINIStr "$INSTDIR\Winamp.ini" Winamp langpack "$0.lng"
		
	ReadINIStr $0 "$PLUGINSDIR\opt2page.ini" "Field 3" State
	StrCmp $0 "" +2
	WriteINIStr "$INSTDIR\Winamp.ini" Winamp Proxy $0
	
	ReadINIStr $0 "$PLUGINSDIR\opt2page.ini" "Field 5" State
	StrCmp $0 "" +2
	WriteINIStr "$INSTDIR\Winamp.ini" Winamp proxyonly80 $0
	
	ReadINIStr $0 "$PLUGINSDIR\opt3page.ini" "Field 2" State ;经典界面
	ReadINIStr $1 "$PLUGINSDIR\opt3page.ini" "Field 3" State ;Modern 界面
	ReadINIStr $2 "$PLUGINSDIR\opt3page.ini" "Field 4" State ;其他界面
	${If} $0 == "1"
		WriteINIStr "$INSTDIR\Winamp.ini" winamp skin ""
	${ElseIf} $1 == "1"
		WriteINIStr "$INSTDIR\Winamp.ini" winamp skin "Winamp Modern"
	${ElseIf} $2 == "1"
		ReadINIStr $0 "$PLUGINSDIR\opt3page.ini" "Field 5" State ;其他界面
		${If} ${FileExists} "$INSTDIR\Skins\$0.wsz"
			WriteINIStr "$INSTDIR\Winamp.ini" winamp skin "$0.wsz"
		${ElseIf} ${FileExists} "$INSTDIR\Skins\$0.wal"
			WriteINIStr "$INSTDIR\Winamp.ini" winamp skin "$0.wal"
		${EndIf}
	${EndIf}
		
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "DisplayName" "$(UNINST_DISPLAY_NAME)"
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString" "$\"$INSTDIR\UninstWA.exe$\""
	WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "Installer Language" "$LANGUAGE"
	WriteUninstaller "$INSTDIR\UninstWA.exe"
	
  System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'
	
	${If} ${RebootFlag}
		MessageBox MB_YESNO "$(MB_REBOOT_REQUIRED)" IDNO +2
		Reboot
	${Else}
		Exec '"$INSTDIR\Winamp.exe" /NEW "$INSTDIR\Winamp.m3u"'
	${EndIf}
SectionEnd	

Function .onInit
  InitPluginsDir
	
!ifdef LANGUAGE_SELECT_SUPPORT
	!insertmacro MUI_LANGDLL_DISPLAY
!endif

	find_winamp:
	FindWindow $0 "Winamp v1.x"
	IntCmp $0 0 find_winamp_end
	StrCmp $LANGUAGE ${ENG} 0 +3
	MessageBox MB_ABORTRETRYIGNORE "You must close Winamp before you can continue.$\r$\n$\r$\n$\tAfter you have closed Winamp, select Retry.$\r$\n$\r$\n$\tIf you wish to try to install anyway, select Ignore.$\r$\n$\r$\n$\tIf you wish to abort the installation, select Abort." IDRETRY find_winamp IDIGNORE find_winamp_end
	Goto quit
	StrCmp $LANGUAGE ${CHS} 0 +3
	MessageBox MB_ABORTRETRYIGNORE "在你继续之前你必须先关闭 Winamp。$\r$\n$\r$\n$\t在你关闭 Winamp 后,选择重试。$\r$\n$\r$\n$\t如果你希望在别的地方安装,选择忽略。$\r$\n$\r$\n$\t如果你想退出安装,选择终止。" IDRETRY find_winamp IDIGNORE find_winamp_end
	Goto quit
	quit:
	Quit
	find_winamp_end:
	
	File "/oname=$PLUGINSDIR\gaydata.ini" ".\resource\${GAYDATA}"
	File "/oname=$PLUGINSDIR\opt2page.ini" ".\resource\opt2page.ini"
	File "/oname=$PLUGINSDIR\opt3page.ini" ".\resource\opt3page.ini"	
	File "/oname=$PLUGINSDIR\classic256.bmp" ".\resource\classic256.bmp"
	File "/oname=$PLUGINSDIR\modern256.bmp" ".\resource\modern256.bmp"
FunctionEnd

Function ComponentPre
	Push $0
		Call ResetSectionText
		;隐藏 Asscoiations
		${For} $0 ${icon} ${end}
			SectionSetText $0 ""
		${Next}
	Pop $0
FunctionEnd

Function ComponentShow
	Push $0
	Push $1
		${For} $1 ${main} ${compon}
			ReadINIStr $0 "$PLUGINSDIR\gaydata.ini" "$(MUI_COMPONENTSPAGE_SECTION_NAME)" "sec$1"
			SectionSetText $1 $0
		${Next}
	Pop $1
	Pop $0
FunctionEnd

Function AsscoiationPre
	Push $0
	
	Call ResetSectionText
	;隐藏 Components
	${For} $0 ${main} ${compon}
		SectionSetText $0 ""
	${Next}	
	
	;检测依存关系
!ifdef INSTALLER_FULL | INSTALLER_PRO
	${If} ${SectionIsSelected} ${nsv}
	${OrIf} ${SectionIsSelected} ${avi} 
		!insertmacro SelectSection ${assoc_video}
	${Else}
		!insertmacro UnselectSection ${assoc_video}
		SectionSetText ${assoc_video} ""
	${EndIf}
!endif
	!insertmacro SelectIfSet ${agent} ${run_agent}
	!insertmacro SelectIfSet ${cd} ${assoc_cd}
	
	Pop $0
FunctionEnd

Function AsscoiationShow
	Push $0
	Push $1
	
	FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $1 $0 1017
	ShowWindow $1 ${SW_HIDE}
  GetDlgItem $1 $0 1021
	ShowWindow $1 ${SW_HIDE}
  GetDlgItem $1 $0 1023
	ShowWindow $1 ${SW_HIDE}
  GetDlgItem $1 $0 1006
	SendMessage $1 ${WM_SETTEXT} 0 "STR:$(MUI_PAGE_ASSOCIATION_TEXT_TOP)"
  GetDlgItem $1 $0 1022
	SendMessage $1 ${WM_SETTEXT} 0 "STR:$(MUI_PAGE_ASSOCIATION_TEXT_COMPLIST)"
	
	${For} $1 ${icon} ${end}
		ReadINIStr $0 "$PLUGINSDIR\gaydata.ini" "$(MUI_COMPONENTSPAGE_SECTION_NAME)" "sec$1"
		SectionSetText $1 $0
	${Next}
	
	Pop $1
	Pop $0
FunctionEnd

Function ResetSectionText
	Push $R0
	Push $R1
		${For} $R1 ${main} ${end}
			ReadINIStr $R0 "$PLUGINSDIR\gaydata.ini" "$(MUI_COMPONENTSPAGE_SECTION_NAME)" "sec$R1"
			${If} $R0 == ""
				SectionSetText $R1 ""
			${Else}
				SectionSetText $R1 " "
			${EndIf}
		${Next}
	Pop $R1
	Pop $R0
FunctionEnd

Function SetCustom2
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 1" Text "$(MUI_PAGE_OPTION2_FIELD1_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 2" ListItems "$(MUI_PAGE_OPTION2_FIELD2_LISTITEMS)"
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 4" Text "$(MUI_PAGE_OPTION2_FIELD4_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 5" Text "$(MUI_PAGE_OPTION2_FIELD5_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 6" Text "$(MUI_PAGE_OPTION2_FIELD6_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 7" ListItems "$(MUI_PAGE_OPTION2_FIELD7_LISTITEMS)"
	
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 2" State "$(MUI_PAGE_OPTION2_FIELD2_STATE)"
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 7" State "$(MUI_PAGE_OPTION2_FIELD7_STATE)"
	
	ReadINIStr $0 "$INSTDIR\Winamp.ini" Winamp Proxy
	StrCmp $0 "" +2
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 3" State $0
	
	ReadINIStr $0 "$INSTDIR\Winamp.ini" Winamp proxyonly80
	StrCmp $0 "" +2
	WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 5" State $0
	
	Push $INSTDIR
	Call SearchLanguages
	
  InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\opt2page.ini"
	Pop $HWND
  !insertmacro MUI_HEADER_TEXT "$(MUI_PAGE_OPTION2_HEADER_TEXT)" "$(MUI_PAGE_OPTION2_HEADER_SUBTEXT)"
	
	ReadINIStr $0 "$INSTDIR\Winamp.ini" Winamp inet_mode
	StrCmp $0 "" +3
	GetDlgItem $1 $HWND 1201
	SendMessage $1 0x014E $0 0
	
 	InstallOptions::show
FunctionEnd

Function LeaveCustom2
	GetDlgItem $0 $HWND 1201
	SendMessage $0 0x0147 0 0 $INTERNET
FunctionEnd

Function SetCustom3
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 1" Text "$(MUI_PAGE_OPTION3_FIELD1_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 2" Text "$(MUI_PAGE_OPTION3_FIELD2_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 3" Text "$(MUI_PAGE_OPTION3_FIELD3_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 4" Text "$(MUI_PAGE_OPTION3_FIELD4_TEXT)"
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 6" Text "$PLUGINSDIR\classic256.bmp"
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 7" Text "$PLUGINSDIR\modern256.bmp"
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 8" Text "$(MUI_PAGE_OPTION3_FIELD8_TEXT)"
	
!ifdef INSTALLER_FULL | INSTALLER_PRO	
	;检测是否安装了现代外观 Field 3 = modern_skin
	${If} ${SectionIsSelected} ${modern_skin}
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 3" State 1
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 3" Flags "NOTABSTOP|NOTIFY"
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 2" State ""
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 4" State ""
	${Else}
!endif	
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 3" State ""
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 3" Flags "NOTABSTOP|DISABLED|NOTIFY"
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 2" State 1
		WriteINIStr $PLUGINSDIR\opt3page.ini "Field 4" State ""
!ifdef INSTALLER_FULL | INSTALLER_PRO	
	${EndIf}
!endif	
	
	;查找安装目录下的其它外观
	Push "$INSTDIR\Skins"
	Call SearchSkins
	
  InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\opt3page.ini"
	Pop $HWND
  !insertmacro MUI_HEADER_TEXT "$(MUI_PAGE_OPTION3_HEADER_TEXT)" "$(MUI_PAGE_OPTION3_HEADER_SUBTEXT)"
	
	GetDlgItem $0 $HWND 1204
	EnableWindow $0 0
	
	ReadINIStr $0 "$PLUGINSDIR\opt3page.ini" "Field 5" State
	StrCmp $0 "" 0 +3
	GetDlgItem $0 $HWND 1203
	EnableWindow $0 0
	
 	InstallOptions::show
FunctionEnd

Function LeaveCustom3
	ReadINIStr $0 "$PLUGINSDIR\opt3page.ini" Settings State
  ${Switch} $0
	${Default}
		Abort
	
  ${Case} 2
		GetDlgItem $1 $HWND 1204
		EnableWindow $1 0
		Abort
	
  ${Case} 3
		GetDlgItem $1 $HWND 1204
		EnableWindow $1 0
		Abort
	
  ${Case} 4
		GetDlgItem $1 $HWND 1204
		EnableWindow $1 1
		Abort
	
  ${Case} 0
	${EndSwitch}
FunctionEnd

!ifdef LICENSE_PAGE_CHANGE_FONT
Function LicensePage
	;更改许可页面的字体为 Tahoma 8
	FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1000
	CreateFont $1 "Tahoma" "8" "" "" 
	SendMessage $0 ${WM_SETFONT} $1 0
FunctionEnd
!endif
	
Function SearchSkins
	Exch $R4
	Push $R0
	Push $R1
	Push $R2
	Push $R3
	
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 5" ListItems ""
  ClearErrors
  FindFirst $R0 $R1 "$R4\*"
  ${Unless} ${Errors}
    ${Do}
      ${Select} $R1
        ${Case2} "." ".."
          ; Do nothing
        ${CaseElse}
					${If} ${FileExists} "$R4\$R1\*"
						${If} $R1 != "Winamp Modern"
							ReadINIStr $R2 "$PLUGINSDIR\opt3page.ini" "Field 5" ListItems
							WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 5" ListItems "$R2|$R1"
							StrCmp $R3 "" 0 +2
							StrCpy $R3 $R1
						${EndIf}
					${Else}
						StrCpy $R2 $R1 "" -4
						${If} $R2 == ".wsz"
						${OrIf} $R2 == ".wal"
							ReadINIStr $R2 "$PLUGINSDIR\opt3page.ini" "Field 5" ListItems
							StrCpy $R2 "$R2|$R1" -4 ;不带扩展名
							WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 5" ListItems $R2
							StrCmp $R3 "" 0 +2
							StrCpy $R3 $R1 -4
						${EndIf}
					${EndIf}
          ;DetailPrint "Found $R4\$R1"
      ${EndSelect}
      FindNext $R0 $R1
    ${LoopUntil} ${Errors}
    FindClose $R0
  ${EndUnless}
	
	WriteINIStr "$PLUGINSDIR\opt3page.ini" "Field 5" State $R3
	
	Pop $R3
	Pop $R2
	Pop $R1
	Pop $R0
	Pop $R4
FunctionEnd	
	
Function SearchLanguages
	Exch $R3
	Push $R0
	Push $R1
	Push $R2
	
  ClearErrors
  FindFirst $R0 $R1 "$R3\*"
  ${Unless} ${Errors}
    ${Do}
      ${Select} $R1
        ${Case2} "." ".."
          ; Do nothing
        ${CaseElse}
					${If} ${FileExists} "$R3\$R1\*"
					${Else}
						StrCpy $R2 $R1 "" -4
						${If} $R2 == ".lng"
							ReadINIStr $R2 "$PLUGINSDIR\opt2page.ini" "Field 7" ListItems
							StrCpy $R2 "$R2|$R1" -4
							WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 7" ListItems $R2
						${EndIf}
					${EndIf}
      ${EndSelect}
      FindNext $R0 $R1
    ${LoopUntil} ${Errors}
    FindClose $R0
  ${EndUnless}
	
	ReadINIStr $R0 "$INSTDIR\Winamp.ini" Winamp langpack
	${If} $R0 != ""
			${If} ${FileExists} "$INSTDIR\$R0"
				StrCpy $R0 $R0 -4
				WriteINIStr "$PLUGINSDIR\opt2page.ini" "Field 7" State $R0
			${EndIf}	
	${EndIf}
	
	Pop $R2
	Pop $R1
	Pop $R0
	Pop $R3
FunctionEnd	

Function CloseProgram 
	Exch $R0 ;首先要 !include LogicLib.nsh
	Push $R1
	Push $R2
	${Do}
		FindWindow $R2 $R0
		${If} $R2 = 0
			${ExitDo}
		${Else}
			SendMessage $R2 ${WM_CLOSE} 0 0
			;SendMessage $R2 ${WM_DESTROY} 0 0
		${EndIf}
		Sleep 200
		${If} $R1 > 10
			${ExitDo}
		${EndIf}
		IntOp $R1 $R1 + 1
	${Loop}
	Pop $R2
	Pop $R1 
	Pop $R0
FunctionEnd

;--------------------------------------------
; 卸载段
;--------------------------------------------

Section Uninstall
	ExecWait '"$INSTDIR\Winamp.exe" /UNREG'
	Call un.Restore
	DeleteRegKey HKCR "Winamp.File"
	DeleteRegKey HKCR "Winamp.Playlist"
	DeleteRegKey HKCR "Winamp.SkinZip"
	DeleteRegKey HKCR "Directory\shell\Winamp.Play"
	DeleteRegKey HKCR "Directory\shell\Winamp.Enqueue"
	DeleteRegKey HKCR "Directory\shell\Winamp.Bookmark"
	DeleteRegKey HKCU "Software\Winamp"
	DeleteRegKey HKLM "SOFTWARE\Nullsoft\Winamp"
	DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp"
	
	Push "WinampAgentMain"
	Call un.CloseProgram

	;必删除的文件或使用过程中产生的文件
	Delete /REBOOTOK "$INSTDIR\Winamp.m3u"
	Delete /REBOOTOK "$INSTDIR\Winamp.ini"
	Delete /REBOOTOK "$INSTDIR\UninstWA.exe"
	Delete /REBOOTOK "$INSTDIR\Plugins\vis_avs.dat"
	Delete /REBOOTOK "$INSTDIR\studio.xnf"
	Delete /REBOOTOK "$INSTDIR\Plugins\gen_ml.ini"
	RMDir /r "$INSTDIR\Plugins\ml"
	
!ifdef LOG_SET_SUPPORT
	Push "$INSTDIR\install.log"
	Call un.DelFileByLog
	Push "$INSTDIR\install.log"
	Call un.RMDirByLog
	Delete "$INSTDIR\install.log"
!else	
	;桌面图标
	Delete /REBOOTOK "$DESKTOP\Winamp.lnk"
	
	;快速启动栏图标
	Delete /REBOOTOK "$QUICKLAUNCH\Winamp.lnk"
	
	;开始菜单组
	RMDir /r "$SMPROGRAMS\Winamp"
	
	;主程序文件
	Delete /REBOOTOK "$INSTDIR\whatsnew.txt"
	Delete /REBOOTOK "$INSTDIR\demo.mp3"
	Delete /REBOOTOK "$INSTDIR\winamp.exe"
	Delete /REBOOTOK "$INSTDIR\winamp.lks"
	Delete /REBOOTOK "$INSTDIR\Winamp.q1"
	Delete /REBOOTOK "$INSTDIR\winampmb.htm"
	Delete /REBOOTOK "$INSTDIR\Plugins\out_wave.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\in_mp3.dll" 
	
	;Winamp 代理
	Delete /REBOOTOK "$INSTDIR\winampa.exe"
	
	;媒体库
	Delete /REBOOTOK "$INSTDIR\Plugins\gen_ml.dll"
	
	;现代外观文件
	RMDir /r "$INSTDIR\Skins\Winamp Modern"
	Delete /REBOOTOK "$INSTDIR\Plugins\gen_ff.dll"
	RMDir /r "$INSTDIR\Plugins\freeform"
	
	;全局热键
	Delete /REBOOTOK "$INSTDIR\Plugins\gen_hotkeys.dll"
	
	;跳转到文件
	Delete /REBOOTOK "$INSTDIR\Plugins\gen_jumpex.dll"

	;托盘控制
	Delete /REBOOTOK "$INSTDIR\Plugins\gen_tray.dll"

	;Windows Media Audio (WMA)
	Delete /REBOOTOK "$INSTDIR\Plugins\in_wm.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\wmahelp.dll"
		
	;MIDI
	Delete /REBOOTOK "$INSTDIR\Plugins\in_midi.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\read_file.dll"

	;MOD/XM/S3M/IT
	Delete /REBOOTOK "$INSTDIR\Plugins\in_mod.dll"

	;OGG Vorbis
	Delete /REBOOTOK "$INSTDIR\Plugins\in_vorbis.dll"

	;AAC 编码
	Delete /REBOOTOK "$INSTDIR\Plugins\enc_aac.dll"

	;MP3 编码
	Delete /REBOOTOK "$INSTDIR\Plugins\enc_lame.dll"
	Delete /REBOOTOK "$INSTDIRe\Plugins\lame_enc.dll"

	;MP4
	Delete /REBOOTOK "$INSTDIR\Plugins\in_mp4.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\enc_mp4.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\libmp4v2.dll"

	;CD
	Delete /REBOOTOK "$INSTDIR\Plugins\in_cdda.dll"

	;Sonic Rip、烧录
	Delete /REBOOTOK "$INSTDIR\PXSDKPLS.dll"
		
	;CDDB
	Delete /REBOOTOK "$INSTDIR\Plugins\CDDBControlWinamp.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\CDDBUIWinamp.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\in_cdda.dll"
		
	;WAV/VOC/AU/AIFF
	Delete /REBOOTOK "$INSTDIR\Plugins\in_wave.dll"
		
	;Nullsoft 视频 (NSV)
	Delete /REBOOTOK "$INSTDIR\Plugins\in_nsv.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\nsvdec_vp5.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\nsvdec_vp6.dll"

	;AVI/MPG/ASF
	Delete /REBOOTOK "$INSTDIR\Plugins\in_dshow.dll"
		
	;Nullsoft 微型全屏
	Delete /REBOOTOK "$INSTDIR\Plugins\vis_nsfs.dll"

	;高级可视化
	Delete /REBOOTOK "$INSTDIR\Plugins\vis_avs.dll"
	RMDir /r "$INSTDIR\Plugins\avs"
		
	;Milkdrop
	Delete /REBOOTOK "$INSTDIR\Plugins\vms_desktop.dll"
	Delete /REBOOTOK "$INSTDIR\Plugins\milkdrop.html"
	Delete /REBOOTOK "$INSTDIR\Plugins\vis_milk.dll"
	RMDir /r "$INSTDIR\Plugins\Milkdrop"
		
	;信号处理器工作室插件
	Delete /REBOOTOK "$INSTDIR\Plugins\dsp_sps.dll"
	RMDir /r "$INSTDIR\Plugins\DSP_SPS"
		
	;写入 WAV 文件支持
	Delete /REBOOTOK "$INSTDIR\Plugins\out_disk.dll"

	;DirectSound 输出支持
	Delete /REBOOTOK "$INSTDIR\Plugins\out_ds.dll"
!endif	;end of LOG_SET_SUPPORT
	
	;如果目录为空则删除
	RMDir "$INSTDIR\Plugins"
	RMDir "$INSTDIR\Skins"
	RMDir "$INSTDIR"
	
	System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'
	
	${If} ${FileExists} $INSTDIR
		MessageBox MB_OK|MB_ICONEXCLAMATION "$(MB_NOT_COMPLETE_REMOVE)"
		ExecShell open $INSTDIR "" SW_SHOWMAXIMIZED
	${EndIf}
	MessageBox MB_OK|MB_ICONEXCLAMATION "$(MB_UNINST_FINISH)"
SectionEnd	

Function un.onInit
	ReadRegStr $LANGUAGE HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "Installer Language"
FunctionEnd

Function un.CloseProgram 
	Exch $R0 ;首先要 !include LogicLib.nsh
	Push $R1
	Push $R2
	${Do}
		FindWindow $R2 $R0
		${If} $R2 = 0
			${ExitDo}
		${Else}
			SendMessage $R2 ${WM_CLOSE} 0 0
			;SendMessage $R2 ${WM_DESTROY} 0 0
		${EndIf}
		Sleep 200
		${If} $R1 > 10
			${ExitDo}
		${EndIf}
		IntOp $R1 $R1 + 1
	${Loop}
	Pop $R2
	Pop $R1 
	Pop $R0
FunctionEnd

Function un.Restore
  Push $R0 ;首先要 !include LogicLib.nsh
  Push $R1
  Push $R2
		${Do}
			EnumRegKey $R0 HKLM "SOFTWARE\Classes" $R1
			StrCpy $R2 $R0 1
			${If} $R2 == "."
				Push $R0
				Call un.Restore.EnumRegValue
			${EndIf}
			IntOp $R1 $R1 + 1
		${LoopUntil} $R0 == ""
		
		StrCpy $R1 0
		StrCpy $R2 0
		${Do}
			EnumRegValue $R0 HKCR "Winamp.File\temp" $R1
			${If} $R0 == ""
				IntOp $R2 $R2 + 1
			${Else}
				DeleteRegKey HKCR $R0
				DetailPrint "$(REMOVE_ASSOC) $R0"
			${EndIf}
			IntOp $R1 $R1 + 1
		${LoopUntil} $R2 > 2
		DeleteRegKey HKCR "Winamp.File\temp"
		
		StrCpy $R1 0
		StrCpy $R2 0
		${Do}
			EnumRegValue $R0 HKCU "Software\Netscape\Netscape Navigator\Viewers" $R1
			${If} $R0 == ""
				IntOp $R2 $R2 + 1
			${Else}
				StrCpy $R3 $R0 "" -10
				${IfThen} $R3 == "Winamp.exe" ${|} DeleteRegValue HKCU "Software\Netscape\Netscape Navigator\Viewers" $R0 ${|}
			${EndIf}
			IntOp $R1 $R1 + 1
		${LoopUntil} $R2 > 2
		
		ReadRegStr $R0 HKCR "AudioCD\shell\play\command" "Winamp_Back"
		${IfThen} $R0 != "" ${|} WriteRegStr HKCR "AudioCD\shell\play\command" "" $R0 ${|}
		DeleteRegValue HKCR "AudioCD\shell\play\command" "Winamp_Back"
  Pop $R2
  Pop $R1
  Pop $R0
FunctionEnd

Function un.Restore.EnumRegValue
	Exch $R0 ;首先要 !include LogicLib.nsh
	Push $R1
	Push $R2
	Push $R3
		StrCpy $R1 0
		${Do}
			EnumRegValue $R2 HKLM "SOFTWARE\Classes\$R0" $R1
			${IfThen} $R2 == "" ${|} IntOp $R3 $R3 + 1 ${|}
			
			${If} $R2 == "Winamp_Back"
					ReadRegStr $R2 HKCR "$R0" "Winamp_Back"
					WriteRegStr HKCR "$R0" "" "$R2"
					DeleteRegValue HKCR "$R0" "Winamp_Back"
					${If} $R2 == ""
						WriteRegStr HKCR "Winamp.File\temp" $R0 ""
					${Else}
						ReadRegStr $R2 HKCR "$R2" ""
						DetailPrint "$(RESTORE_ASSOC) $R0 -> $R2"
					${EndIf}
			${EndIf}
			IntOp $R1 $R1 + 1
		${LoopUntil} $R3 > 2
	Pop $R3
	Pop $R2
	Pop $R1
	Pop $R0
FunctionEnd

!ifdef LOG_SET_SUPPORT
Function un.DelFileByLog
	Exch $R0
	Push $R1
	Push $R2
	Push $R3
	
	FileOpen $R0 $R0 r
	${Do}
	  FileRead $R0 $R1
		StrCpy $R1 $R1 -2
		StrCpy $R2 $R1 11
		StrCpy $R3 $R1 20
		${If} $R2 == "File: wrote"
		${OrIf} $R2 == "File: skipp"
		${OrIf} $R3 == "CreateShortCut: out:"
		${OrIf} $R3 == "created uninstaller:"
			Push $R1
			Push '"'
			Call un.StrLoc
			Pop $R2
			${If} $R2 != ""
				IntOp $R2 $R2 + 1
				StrCpy $R3 $R1 "" $R2
				Push $R3
				Push '"'
				Call un.StrLoc
				Pop $R2
				${If} $R2 != ""
					StrCpy $R3 $R3 $R2
					Delete /REBOOTOK $R3
				${EndIf}
			${EndIf}
		${EndIf}
		StrCpy $R2 $R1 7
		${If} $R2 == "Rename:"
			Push $R1
			Push '->'
			Call un.StrLoc
			Pop $R2
			${If} $R2 != ""
				IntOp $R2 $R2 + 2
				StrCpy $R3 $R1 "" $R2
				Delete /REBOOTOK $R3
			${EndIf}
		${EndIf}
	${LoopUntil} $R1 == ""
	FileClose $R0
		
	Pop $R3
	Pop $R2
	Pop $R1
	Pop $R0
FunctionEnd

Function un.RMDirByLog
	Exch $R0
	Push $R1
	Push $R2
	Push $R3
	Push $R4
	
	FileOpen $R0 $R0 r
	FileSeek $R0 16 END $R1
	${Do}
		FileSeek $R0 -3 CUR $R1
		FileReadByte $R0 $R2
		FileReadByte $R0 $R3
		${If} "$R2$R3" == "1310"
			FileRead $R0 $R2
			FileSeek $R0 $R1
			StrCpy $R3 $R2 16
			${If} $R3 == "CreateDirectory:"
				Push $R2
				Push '"'
				Call un.StrLoc
				Pop $R3
				${If} $R3 != ""
					IntOp $R3 $R3 + 1
					StrCpy $R3 $R2 "" $R3
					Push $R3
					Push '"'
					Call un.StrLoc
					Pop $R2
					${If} $R2 != ""
						StrCpy $R2 $R3 $R2
						; ----------------------特殊目录则跳过
						${If} $R2 != $PLUGINSDIR
						${AndIf} $R2 != $PROGRAMFILES
						${AndIf} $R2 != $COMMONFILES
						${AndIf} $R2 != $DESKTOP
						${AndIf} $R2 != $STARTMENU
						${AndIf} $R2 != $SMPROGRAMS
						${AndIf} $R2 != $SMSTARTUP
						${AndIf} $R2 != $QUICKLAUNCH
						${AndIf} $R2 != $FAVORITES
							RMDir $R2 ;如果是空目录则删除
						${EndIf}
						; ----------------------
					${EndIf}
				${EndIf}
			${EndIf}
		${EndIf}
	${LoopUntil} $R1 < 10
	FileClose $R0
	
	Pop $R4
	Pop $R3
	Pop $R2
	Pop $R1
	Pop $R0
FunctionEnd

Function un.StrLoc
	Exch $R0 ;Str to search for
	Exch
	Exch $R1 ;string
	Push $R2 ;len of Str to search for
	Push $R3 ;len of string
	Push $R4
	Push $R5
		StrLen $R2 $R0
		StrLen $R3 $R1
		${Do}
			StrCpy $R5 $R1 $R2 $R4
			${If} $R5 == $R0
			${OrIf} $R4 = $R3
				${ExitDo}
			${EndIf}
			IntOp $R4 $R4 + 1
		${Loop}
		${If} $R4 = $R3
			StrCpy $R0 ""
		${Else}
			StrCpy $R0 $R4
		${EndIf}	
	Pop $R5
	Pop $R4
	Pop $R3
	Pop $R2
	Pop $R1
	Exch $R0
FunctionEnd	
!endif

引用Language.nsi的内容:

!define ENG 1033
!define CHS 2052
!define CHT 1028

LangString CAPTION ${ENG} "Winamp Setup"
LangString CAPTION ${CHS} "Winamp 安装"

LangString BRANDING_TEXT ${ENG} "Nullsoft Install System -- built on ${__DATE__} at ${__TIME__}"
LangString BRANDING_TEXT ${CHS} "Nullsoft Install System -- 创建于 ${__DATE__} 在 ${__TIME__}"

LangString MUI_LICENSEPAGE_TEXT_TOP ${ENG} "Please read and agree to the license terms below before installing."
LangString MUI_LICENSEPAGE_TEXT_TOP ${CHS} "请在安装前阅读并同意下面的许可条款"

LangString INST_TYPE_FULL ${ENG} "Full"
LangString INST_TYPE_FULL ${CHS} "完全"

LangString INST_TYPE_STD ${ENG} "Standard"
LangString INST_TYPE_STD ${CHS} "标准"

LangString INST_TYPE_LITE ${ENG} "Lite"
LangString INST_TYPE_LITE ${CHS} "精简"

LangString INST_TYPE_MIN ${ENG} "Minimal"
LangString INST_TYPE_MIN ${CHS} "最小"

!ifdef INSTALLER_FULL
	LangString MUI_COMPONENTSPAGE_TEXT_TOP ${ENG} "This will install Winamp ${VERSION}. This installer contains the full install."
	LangString MUI_COMPONENTSPAGE_TEXT_TOP ${CHS} "现在将安装 Winamp ${VERSION}。本安装程序为完全版"
!endif

!ifdef INSTALLER_PRO
	LangString MUI_COMPONENTSPAGE_TEXT_TOP ${ENG} "This will install Winamp ${VERSION}. This installer contains the pro install."
	LangString MUI_COMPONENTSPAGE_TEXT_TOP ${CHS} "现在将安装 Winamp ${VERSION}。本安装程序为专业版"
!endif

!ifdef INSTALLER_LITE
	LangString MUI_COMPONENTSPAGE_TEXT_TOP ${ENG} "This will install Winamp ${VERSION}. This installer contains the lite install."
	LangString MUI_COMPONENTSPAGE_TEXT_TOP ${CHS} "现在将安装 Winamp ${VERSION}。本安装程序为精简版"
!endif

LangString MUI_COMPONENTSPAGE_SECTION_NAME ${ENG} "secnames"
LangString MUI_COMPONENTSPAGE_SECTION_NAME ${CHS} "secnames_chs"

LangString MUI_DIRECTORYPAGE_TEXT_TOP ${ENG} "Setup has determined the optimal location to install. If you would like to change the folder, do so now."
LangString MUI_DIRECTORYPAGE_TEXT_TOP ${CHS} "安装程序检测到最佳的安装位置。如果你要改变目录,现在手动修改。"

LangString MUI_PAGE_ASSOCIATION_HEADER_TEXT ${ENG} "Choose Install Options"
LangString MUI_PAGE_ASSOCIATION_HEADER_TEXT ${CHS} "选择安装选项"

LangString MUI_PAGE_ASSOCIATION_HEADER_SUBTEXT ${ENG} "Choose where to install Winamp icons and what media to associate with Winamp"
LangString MUI_PAGE_ASSOCIATION_HEADER_SUBTEXT ${CHS} "选择安装 Winamp 图标的位置和关联到 Winamp 的媒体类型"

LangString MUI_PAGE_ASSOCIATION_TEXT_TOP ${ENG} "Select which icons you want installed, and whether you want files and CDs associated with"
LangString MUI_PAGE_ASSOCIATION_TEXT_TOP ${CHS} "选择你要安装的图标,和你是否让文件和 CD 与 Winamp 关联。"

LangString MUI_PAGE_ASSOCIATION_TEXT_COMPLIST ${ENG} "Select icons to install and media associations:"
LangString MUI_PAGE_ASSOCIATION_TEXT_COMPLIST ${CHS} "选择安装的图标和媒体关联:"

LangString MUI_PAGE_OPTION2_HEADER_TEXT ${ENG} "Internet Connection and Language Settings"
LangString MUI_PAGE_OPTION2_HEADER_TEXT ${CHS} "Internet 连接和语言设置"

LangString MUI_PAGE_OPTION2_HEADER_SUBTEXT ${ENG} "Configure Winamp's path to the Internet and select your language."
LangString MUI_PAGE_OPTION2_HEADER_SUBTEXT ${CHS} "配置 Winamp 连接到 Internet 的方式并选择你的语言。"

LangString MUI_PAGE_OPTION2_FIELD1_TEXT ${ENG} "Select your internet connection type:"
LangString MUI_PAGE_OPTION2_FIELD1_TEXT ${CHS} "选择你的 Internet 连接类型:"

LangString MUI_PAGE_OPTION2_FIELD2_STATE ${ENG} "Always connected (LAN, DSL, Cable)"
LangString MUI_PAGE_OPTION2_FIELD2_STATE ${CHS} "总是连接(LAN, DSL, Cable)"

LangString MUI_PAGE_OPTION2_FIELD2_LISTITEMS ${ENG} "Always connected (LAN, DSL, Cable)|Connected via dial-up (Modem)|Not connected to the internet"
LangString MUI_PAGE_OPTION2_FIELD2_LISTITEMS ${CHS} "总是连接(LAN, DSL, Cable)|通过拨号连接(Modem)|不连接到 Internet"

LangString MUI_PAGE_OPTION2_FIELD4_TEXT ${ENG} "(Optional) Specify HTTP proxy Server address: 'Server:Port'"
LangString MUI_PAGE_OPTION2_FIELD4_TEXT ${CHS} "(可选项)指定 HTTP 代理服务器地址: '服务器:端口'"

LangString MUI_PAGE_OPTION2_FIELD5_TEXT ${ENG} "Use proxy only for port 80 URLs"
LangString MUI_PAGE_OPTION2_FIELD5_TEXT ${CHS} "只对 80 端口 URL 使用代理"

LangString MUI_PAGE_OPTION2_FIELD6_TEXT ${ENG} "Display menus and dialog boxes in the following language:"
LangString MUI_PAGE_OPTION2_FIELD6_TEXT ${CHS} "使用下列语言显示菜单和对话框:"

LangString MUI_PAGE_OPTION2_FIELD7_STATE ${ENG} "English (US)"
LangString MUI_PAGE_OPTION2_FIELD7_STATE ${CHS} "English (US)"

LangString MUI_PAGE_OPTION2_FIELD7_LISTITEMS ${ENG} "English (US)"
LangString MUI_PAGE_OPTION2_FIELD7_LISTITEMS ${CHS} "English (US)"

LangString MUI_PAGE_OPTION3_HEADER_TEXT ${ENG} "Interface and Skin Selection"
LangString MUI_PAGE_OPTION3_HEADER_TEXT ${CHS} "界面和外观选择"

LangString MUI_PAGE_OPTION3_HEADER_SUBTEXT ${ENG} "Customize Winamp's interface to your preference."
LangString MUI_PAGE_OPTION3_HEADER_SUBTEXT ${CHS} "自定义适合你的品味的 Winamp 界面。"

LangString MUI_PAGE_OPTION3_FIELD1_TEXT ${ENG} "Select which skin you want Winamp to use once installed. You may change skins later using"
LangString MUI_PAGE_OPTION3_FIELD1_TEXT ${CHS} "选择安装后 Winamp 使用哪一个面板。以后可以通过配置更改它。"

LangString MUI_PAGE_OPTION3_FIELD2_TEXT ${ENG} "Classic skin - (Optimized for slower PCs and improved accessibility)"
LangString MUI_PAGE_OPTION3_FIELD2_TEXT ${CHS} "经典面板 - (用于较慢的 PC 优化并增加易用性)"

LangString MUI_PAGE_OPTION3_FIELD3_TEXT ${ENG} "Modern skin - (Optimized for larger screens and improved usability)"
LangString MUI_PAGE_OPTION3_FIELD3_TEXT ${CHS} "现代外观 - (对较大屏幕优化并增加适用性)"

LangString MUI_PAGE_OPTION3_FIELD4_TEXT ${ENG} "Other installed skin:"
LangString MUI_PAGE_OPTION3_FIELD4_TEXT ${CHS} "其它已安装的外观"

LangString MUI_PAGE_OPTION3_FIELD8_TEXT ${ENG} "the Winamp Preferences."
LangString MUI_PAGE_OPTION3_FIELD8_TEXT ${CHS} "Winamp 的配置"

LangString UNINST_DISPLAY_NAME ${ENG} "Winamp (remove only)"
LangString UNINST_DISPLAY_NAME ${CHS} "Winamp (仅做移除用)"

LangString REGISTRYING ${ENG} "Registrying..."
LangString REGISTRYING ${CHS} "正在注册..."

LangString REG_MEDIA_FILE ${ENG} "Winamp media file"
LangString REG_MEDIA_FILE ${CHS} "Winamp 媒体文件"

LangString REG_PLAY ${ENG} "&Play in Winamp"
LangString REG_PLAY ${CHS} "用 Winamp 播放(&P)"

LangString REG_ENQUEUE ${ENG} "&Enqueue in Winamp"
LangString REG_ENQUEUE ${CHS} "加入 Winamp 队列(&E)"

LangString REG_ADD_BOOKMARK ${ENG} "Add to Winamp's &Bookmark list"
LangString REG_ADD_BOOKMARK ${CHS} "加入 Winamp 书签列表(&B)"

LangString REG_PLAYLIST_FILE ${ENG} "Winamp playlist file"
LangString REG_PLAYLIST_FILE ${CHS} "Winamp 播放列表文件"

LangString REG_EXT_INST_FILE ${ENG} "Winamp extension installation file"
LangString REG_EXT_INST_FILE ${CHS} "Winamp 扩展安装文件"

LangString RESTORE_ASSOC ${ENG} "Restore association:"
LangString RESTORE_ASSOC ${CHS} "恢复文件关联:"

LangString REMOVE_ASSOC ${ENG} "Remove association:"
LangString REMOVE_ASSOC ${CHS} "移除文件关联:"

LangString START_MENU_UNINST ${ENG} "Uninstall Winamp"
LangString START_MENU_UNINST ${CHS} "卸载 Winamp"

LangString MB_REBOOT_REQUIRED ${ENG} 'A reboot is required to complete the installation. $\r$\nReboot now? (If you wish to reboot later, select "no")'
LangString MB_REBOOT_REQUIRED ${CHS} '你需要重启来完成本次安装。$\r$\n现在重启吗?(如果你希望稍后重启,选择"否"'

LangString MB_NOT_COMPLETE_REMOVE ${ENG} "Not all files in $INSTDIR were not removed.$\r$\nIf you wish to remove the files yourself, please do so."
LangString MB_NOT_COMPLETE_REMOVE ${CHS} "$INSTDIR 还留有未被移除的文件。$\r$\n如果你希望自己移除,请手动移除"

LangString MB_UNINST_FINISH ${ENG} "Uninstall complete"
LangString MB_UNINST_FINISH ${CHS} "卸载完成"

资源文件点击另存