最新消息:

蓝色网际winamp封装脚本

nsis 永恒心锁 1993浏览 0评论
# 编译: 必须使用 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           "$PROGRAMFILESWinamp"

InstallDirRegKey     HKCU "SoftwareWinamp" ""

Var HWND

Var INTERNET

ReserveFile          ".resource${GAYDATA}"

ReserveFile          ".resourceopt2page.ini"

ReserveFile          ".resourceopt3page.ini"

ReserveFile          ".resourceclassic256.bmp"

ReserveFile          ".resourcemodern256.bmp"

ReserveFile          "${NSISDIR}PluginsInstallOptions.dll"

!ifdef LANGUAGE_SELECT_SUPPORT

ReserveFile          "${NSISDIR}PluginsLangDLL.dll"

!endif

!include             "MUI2.nsh"

!include             "Sections.nsh"

!define              LOGICLIB_SECTIONCMP

!include             "LogicLib.nsh"

;----------------------------------包含多语言

!include             "Language.nsi"

;----------------------------------页面界面设置

!define MUI_ICON ".resourceinst.ico"

!define MUI_UNICON ".resourceuninst.ico"

!define MUI_HEADERIMAGE

!define MUI_HEADERIMAGE_BITMAP ".resourcemodern-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 ".resourceLicense.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 "$INSTDIRWinamp.exe"

${If} ${Errors}

Push "Winamp v1.x"

Call CloseProgram

${EndIf}

!ifdef LOG_SET_SUPPORT

Delete "$INSTDIRinstall.log"

LogSet on

!endif

SetOutPath $INSTDIR

#File ".includedemo.mp3"

#File ".includewhatsnew.txt"

#File ".includeWinamp.exe"

#File ".includewinamp.lks"

#File ".includeWinamp.q1"

#File ".includewinampmb.htm"

;写入 winamp.m3u

FileOpen $0 "$INSTDIRwinamp.m3u" w

FileWrite $0 "#EXTM3U$r$n"

FileWrite $0 "#EXTINF:5,demo$r$n"

FileWrite $0 "demo.mp3$r$n"

FileClose $0

SetOutPath "$INSTDIRPlugins"

#File ".includePluginsout_wave.dll"

#File ".includePluginsin_mp3.dll"

SectionEnd

Section "Winamp 代理" agent

SectionIn 1 2 3

Push "WinampAgentMain"

Call CloseProgram

StrCpy $0 "$INSTDIRwinampa.exe"

ClearErrors

Delete $0

${If} ${Errors}

GetTempFileName $1

StrCpy $0 $1

${EndIf}

#File /oname=$0 ".includewinampa.exe"

${IfThen} $0 == $1 ${|} Rename /REBOOTOK $0 "$INSTDIRwinampa.exe" ${|}

WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionRun" WinampAgent "$INSTDIRwinampa.exe"

SectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO

Section "Winamp 媒体库"

SectionIn 1 2

#File ".includePluginsgen_ml.dll"

SectionEnd

Section "现代外观" modern_skin

SectionIn 1 2

SetOutPath "$INSTDIRSkins"

#File /r ".includeSkinsWinamp Modern"

SetOutPath "$INSTDIRPlugins"

#File ".includePluginsgen_ff.dll"

#File /r ".includePluginsfreeform"

SectionEnd

!endif

SubSection "界面扩展"

Section "全局热键"

SectionIn 1 2 3

#File ".includePluginsgen_hotkeys.dll"

SectionEnd

Section "跳转到文件"

SectionIn 1 2 3

#File ".includePluginsgen_jumpex.dll"

SectionEnd

Section "托盘控制"

SectionIn 1 2 3

#File ".includePluginsgen_tray.dll"

SectionEnd

SubSectionEnd

SubSection "音频文件"

!ifdef INSTALLER_FULL | INSTALLER_PRO

Section "Windows Media Audio (WMA)" wma

SectionIn 1

#File ".includePluginsin_wm.dll"

#File ".includePluginswmahelp.dll"

!ifdef LOG_SET_SUPPORT

LogSet off

!endif

;如果已安装则跳过

ReadRegStr $0 HKLM "SOFTWAREMicrosoftWindows NTCurrentVersionDrivers32" "msacm.msaudio1"

ReadRegStr $1 HKLM "SystemCurrentControlSetControlMediaResourcesACMmsacm.msaudio1" "Driver"

${If} $0 != "msaud32.acm"

${AndIf} $1 != "msaud32.acm"

#File "/oname=$PLUGINSDIRwmaudioredist.exe" ".includewmaudioredist.exe"

ExecWait '"$PLUGINSDIRwmaudioredist.exe" /Q /R:N'

${EndIf}

!ifdef LOG_SET_SUPPORT

LogSet on

!endif

SectionEnd

Section "MIDI" midi

SectionIn 1 2

#File ".includePluginsin_midi.dll"

#File ".includePluginsread_file.dll"

SectionEnd

Section "MOD/XM/S3M/IT" mod

SectionIn 1 2

#File ".includePluginsin_mod.dll"

SectionEnd

Section "OGG Vorbis" ogg

SectionIn 1 2

#File ".includePluginsin_vorbis.dll"

SectionEnd

Section "AAC 编码"

SectionIn 1 2

#File ".includePluginsenc_aac.dll"

SectionEnd

Section "MP3 编码"

SectionIn 1 2

#File ".includePluginsenc_lame.dll"

#File ".includePluginslame_enc.dll"

SectionEnd

Section "MP4" mp4

SectionIn 1 2

#File ".includePluginsin_mp4.dll"

#File ".includePluginsenc_mp4.dll"

#File ".includePluginslibmp4v2.dll"

SectionEnd

!endif

Section "CD" cd

SectionIn 1 2 3

#File ".includePluginsin_cdda.dll"

SectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO

Section "Sonic Rip、烧录"

SectionIn 1 2

#File "/oname=$INSTDIRPXSDKPLS.dll" ".includePXSDKPLS.dll"

!ifdef LOG_SET_SUPPORT

LogSet off

!endif

;SetOutPath "$PLUGINSDIR"

;#File /r ".includeSonic Runtime*.*"

;unknown how to install the drivers

SetOutPath "$INSTDIRPlugins"

!ifdef LOG_SET_SUPPORT

LogSet on

!endif

SectionEnd

Section "CDDB" cddb

SectionIn 1 2

#File ".includePluginsCDDBControlWinamp.dll"

#File ".includePluginsCDDBUIWinamp.dll"

#File ".includePluginsin_cdda.dll"

SectionEnd

!endif ;end of INSTALLER_FULL | INSTALLER_PRO above

Section "WAV/VOC/AU/AIFF" wav

SectionIn 1 2 3

#File ".includePluginsin_wave.dll"

SectionEnd

SubSectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO

SubSection "视频文件" sub_video

Section "Nullsoft 视频 (NSV)" nsv

SectionIn 1 2

#File ".includePluginsin_nsv.dll"

#File ".includePluginsnsvdec_vp5.dll"

#File ".includePluginsnsvdec_vp6.dll"

SectionEnd

Section "AVI/MPG/ASF" avi

SectionIn 1 2

#File ".includePluginsin_dshow.dll"

SectionEnd

SubSectionEnd

!endif

SubSection "可视化"

Section "Nullsoft 微型全屏"

SectionIn 1 2 3

#File ".includePluginsvis_nsfs.dll"

SectionEnd

!ifdef INSTALLER_FULL | INSTALLER_PRO

Section "高级可视化"

SectionIn 1 2

#File ".includePluginsvis_avs.dll"

#File /r ".includePluginsavs"

SectionEnd

Section "Milkdrop"

SectionIn 1 2

#File ".includePluginsvms_desktop.dll"

#File ".includePluginsmilkdrop.html"

#File ".includePluginsvis_milk.dll"

#File /r ".includePluginsMilkdrop"

SectionEnd

!endif

SubSectionEnd

SubSection "特别的音频输出、效果支持"

!ifdef INSTALLER_FULL | INSTALLER_PRO

Section "信号处理器工作室插件"

SectionIn 1 2 3

#File ".includePluginsdsp_sps.dll"

#File /r ".includePluginsDSP_SPS"

SectionEnd

Section "写入 WAV 文件支持"

SectionIn 1 2

#File ".includePluginsout_disk.dll"

SectionEnd

!endif

Section "DirectSound 输出支持"

SectionIn 1 2 3

#File ".includePluginsout_ds.dll"

SectionEnd

SubSectionEnd

Section "" compon

SectionEnd

Section "" icon

SectionEnd

Section "开始菜单组"

SectionIn 1 2 3 4

SetOutPath "$SMPROGRAMSWinamp"

CreateShortCut "$SMPROGRAMSWinampWinamp.lnk" "$INSTDIRWinamp.exe"

CreateShortCut "$SMPROGRAMSWinampWhat's New.lnk" "$INSTDIRwhatsnew.txt"

CreateShortCut "$SMPROGRAMSWinamp$(START_MENU_UNINST).lnk" "$INSTDIRUninstWA.exe"

SectionEnd

Section "桌面图标"

SectionIn 1 2 3 4

SetOutPath $DESKTOP

CreateShortCut "$DESKTOPWinamp.lnk" "$INSTDIRWinamp.exe"

SectionEnd

Section "快速启动栏"

SectionIn 1 2 3 4

SetOutPath $QUICKLAUNCH

CreateShortCut "$QUICKLAUNCHWinamp.lnk" "$INSTDIRWinamp.exe"

SectionEnd

Section

!ifdef LOG_SET_SUPPORT

LogSet off

!endif

SectionEnd

Section "系统托盘图标/代理" run_agent

SectionIn 1 2 3 4

Exec "$INSTDIRwinampa.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 "SoftwareWinampin_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 "AudioCDshellplaycommand" ""

StrCpy $1 $0 "" 14

StrCmp $1 'Winamp.exe" %1' +3

WriteRegStr HKCR "AudioCDshellplaycommand" "Winamp_Back" $0

WriteRegStr HKCR "AudioCDshellplaycommand" "" '"$INSTDIRWinamp.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 "SoftwareWinamp" "" "$INSTDIR"

WriteRegStr HKCR "Winamp.File" "" "$(REG_MEDIA_FILE)"

WriteRegStr HKCR "Winamp.FileDefaultIcon" "" "$INSTDIRWinamp.exe,1"

WriteRegStr HKCR "Winamp.Fileshell" "" "Play"

WriteRegStr HKCR "Winamp.FileshellPlay" "" "$(REG_PLAY)"

WriteRegStr HKCR "Winamp.FileshellPlaycommand" "" "$"$INSTDIRWinamp.exe$" $"%1$""

WriteRegStr HKCR "Winamp.Fileshellopen" "" ""

WriteRegStr HKCR "Winamp.Fileshellopencommand" "" "$"$INSTDIRWinamp.exe$" $"%1$""

WriteRegStr HKCR "Winamp.FileshellEnqueue" "" "$(REG_ENQUEUE)"

WriteRegStr HKCR "Winamp.FileshellEnqueuecommand" "" "$"$INSTDIRWinamp.exe$" /ADD $"%1$""

WriteRegStr HKCR "Winamp.FileshellListBookmark" "" "$(REG_ADD_BOOKMARK)"

WriteRegStr HKCR "Winamp.FileshellListBookmarkcommand" "" "$"$INSTDIRWinamp.exe$" /BOOKMARK $"%1$""

WriteRegStr HKCR "Winamp.Playlist" "" "$(REG_PLAYLIST_FILE)"

WriteRegBin HKCR "Winamp.Playlist" "EditFlags" 00000100

WriteRegStr HKCR "Winamp.PlaylistDefaultIcon" "" "$INSTDIRWinamp.exe,1"

WriteRegStr HKCR "Winamp.Playlistshell" "" "Play"

WriteRegStr HKCR "Winamp.PlaylistshellPlay" "" "$(REG_PLAY)"

WriteRegStr HKCR "Winamp.PlaylistshellPlaycommand" "" "$"$INSTDIRWinamp.exe$" $"%1$""

WriteRegStr HKCR "Winamp.Playlistshellopen" "" ""

WriteRegStr HKCR "Winamp.Playlistshellopencommand" "" "$"$INSTDIRWinamp.exe$" $"%1$""

WriteRegStr HKCR "Winamp.PlaylistshellEnqueue" "" "$(REG_ENQUEUE)"

WriteRegStr HKCR "Winamp.PlaylistshellEnqueuecommand" "" "$"$INSTDIRWinamp.exe$" /ADD $"%1$""

WriteRegStr HKCR "Winamp.PlaylistshellListBookmark" "" "$(REG_ADD_BOOKMARK)"

WriteRegStr HKCR "Winamp.PlaylistshellListBookmarkcommand" "" "$"$INSTDIRWinamp.exe$" /BOOKMARK $"%1$""

WriteRegStr HKCR "Winamp.SkinZip" "" "$(REG_EXT_INST_FILE)"

WriteRegBin HKCR "Winamp.SkinZip" "EditFlags" 00000100

WriteRegStr HKCR "Winamp.SkinZipDefaultIcon" "" "$INSTDIRWinamp.exe,1"

WriteRegStr HKCR "Winamp.SkinZipshell" "" "Install"

WriteRegStr HKCR "Winamp.SkinZipshellinstall" "" ""

WriteRegStr HKCR "Winamp.SkinZipshellinstallcommand" "" "$"$INSTDIRWinamp.exe$" $"%1$""

WriteRegStr HKCR "DirectoryshellWinamp.Play" "" "$(REG_PLAY)"

WriteRegStr HKCR "DirectoryshellWinamp.Playcommand" "" "$"$INSTDIRWinamp.exe$" $"%1$""

WriteRegStr HKCR "DirectoryshellWinamp.Enqueue" "" "$(REG_ENQUEUE)"

WriteRegStr HKCR "DirectoryshellWinamp.Enqueuecommand" "" "$"$INSTDIRWinamp.exe$" /ADD $"%1$""

WriteRegStr HKCR "DirectoryshellWinamp.Bookmark" "" "$(REG_ADD_BOOKMARK)"

WriteRegStr HKCR "DirectoryshellWinamp.Bookmarkcommand" "" "$"$INSTDIRWinamp.exe$" /BOOKMARK $"%1$""

StrCmp $INTERNET "" +2

WriteINIStr "$INSTDIRWinamp.ini" Winamp inet_mode $INTERNET

ReadINIStr $0 "$PLUGINSDIRopt2page.ini" "Field 7" State

StrCmp $0 "" +3

StrCmp $0 "$(MUI_PAGE_OPTION2_FIELD7_STATE)" +2

WriteINIStr "$INSTDIRWinamp.ini" Winamp langpack "$0.lng"

ReadINIStr $0 "$PLUGINSDIRopt2page.ini" "Field 3" State

StrCmp $0 "" +2

WriteINIStr "$INSTDIRWinamp.ini" Winamp Proxy $0

ReadINIStr $0 "$PLUGINSDIRopt2page.ini" "Field 5" State

StrCmp $0 "" +2

WriteINIStr "$INSTDIRWinamp.ini" Winamp proxyonly80 $0

ReadINIStr $0 "$PLUGINSDIRopt3page.ini" "Field 2" State ;经典界面

ReadINIStr $1 "$PLUGINSDIRopt3page.ini" "Field 3" State ;Modern 界面

ReadINIStr $2 "$PLUGINSDIRopt3page.ini" "Field 4" State ;其他界面

${If} $0 == "1"

WriteINIStr "$INSTDIRWinamp.ini" winamp skin ""

${ElseIf} $1 == "1"

WriteINIStr "$INSTDIRWinamp.ini" winamp skin "Winamp Modern"

${ElseIf} $2 == "1"

ReadINIStr $0 "$PLUGINSDIRopt3page.ini" "Field 5" State ;其他界面

${If} ${FileExists} "$INSTDIRSkins$0.wsz"

WriteINIStr "$INSTDIRWinamp.ini" winamp skin "$0.wsz"

${ElseIf} ${FileExists} "$INSTDIRSkins$0.wal"

WriteINIStr "$INSTDIRWinamp.ini" winamp skin "$0.wal"

${EndIf}

${EndIf}

WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstallWinamp" "DisplayName" "$(UNINST_DISPLAY_NAME)"

WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstallWinamp" "UninstallString" "$"$INSTDIRUninstWA.exe$""

WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstallWinamp" "Installer Language" "$LANGUAGE"

WriteUninstaller "$INSTDIRUninstWA.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 '"$INSTDIRWinamp.exe" /NEW "$INSTDIRWinamp.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=$PLUGINSDIRgaydata.ini" ".resource${GAYDATA}"

#File "/oname=$PLUGINSDIRopt2page.ini" ".resourceopt2page.ini"

#File "/oname=$PLUGINSDIRopt3page.ini" ".resourceopt3page.ini"

#File "/oname=$PLUGINSDIRclassic256.bmp" ".resourceclassic256.bmp"

#File "/oname=$PLUGINSDIRmodern256.bmp" ".resourcemodern256.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 "$PLUGINSDIRgaydata.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 "$PLUGINSDIRgaydata.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 "$PLUGINSDIRgaydata.ini" "$(MUI_COMPONENTSPAGE_SECTION_NAME)" "sec$R1"

${If} $R0 == ""

SectionSetText $R1 ""

${Else}

SectionSetText $R1 " "

${EndIf}

${Next}

Pop $R1

Pop $R0

FunctionEnd

Function SetCustom2

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 1" Text "$(MUI_PAGE_OPTION2_FIELD1_TEXT)"

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 2" ListItems "$(MUI_PAGE_OPTION2_FIELD2_LISTITEMS)"

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 4" Text "$(MUI_PAGE_OPTION2_FIELD4_TEXT)"

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 5" Text "$(MUI_PAGE_OPTION2_FIELD5_TEXT)"

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 6" Text "$(MUI_PAGE_OPTION2_FIELD6_TEXT)"

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 7" ListItems "$(MUI_PAGE_OPTION2_FIELD7_LISTITEMS)"

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 2" State "$(MUI_PAGE_OPTION2_FIELD2_STATE)"

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 7" State "$(MUI_PAGE_OPTION2_FIELD7_STATE)"

ReadINIStr $0 "$INSTDIRWinamp.ini" Winamp Proxy

StrCmp $0 "" +2

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 3" State $0

ReadINIStr $0 "$INSTDIRWinamp.ini" Winamp proxyonly80

StrCmp $0 "" +2

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 5" State $0

Push $INSTDIR

Call SearchLanguages

InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIRopt2page.ini"

Pop $HWND

!insertmacro MUI_HEADER_TEXT "$(MUI_PAGE_OPTION2_HEADER_TEXT)" "$(MUI_PAGE_OPTION2_HEADER_SUBTEXT)"

ReadINIStr $0 "$INSTDIRWinamp.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 "$PLUGINSDIRopt3page.ini" "Field 1" Text "$(MUI_PAGE_OPTION3_FIELD1_TEXT)"

WriteINIStr "$PLUGINSDIRopt3page.ini" "Field 2" Text "$(MUI_PAGE_OPTION3_FIELD2_TEXT)"

WriteINIStr "$PLUGINSDIRopt3page.ini" "Field 3" Text "$(MUI_PAGE_OPTION3_FIELD3_TEXT)"

WriteINIStr "$PLUGINSDIRopt3page.ini" "Field 4" Text "$(MUI_PAGE_OPTION3_FIELD4_TEXT)"

WriteINIStr "$PLUGINSDIRopt3page.ini" "Field 6" Text "$PLUGINSDIRclassic256.bmp"

WriteINIStr "$PLUGINSDIRopt3page.ini" "Field 7" Text "$PLUGINSDIRmodern256.bmp"

WriteINIStr "$PLUGINSDIRopt3page.ini" "Field 8" Text "$(MUI_PAGE_OPTION3_FIELD8_TEXT)"

!ifdef INSTALLER_FULL | INSTALLER_PRO

;检测是否安装了现代外观 Field 3 = modern_skin

${If} ${SectionIsSelected} ${modern_skin}

WriteINIStr $PLUGINSDIRopt3page.ini "Field 3" State 1

WriteINIStr $PLUGINSDIRopt3page.ini "Field 3" Flags "NOTABSTOP|NOTIFY"

WriteINIStr $PLUGINSDIRopt3page.ini "Field 2" State ""

WriteINIStr $PLUGINSDIRopt3page.ini "Field 4" State ""

${Else}

!endif

WriteINIStr $PLUGINSDIRopt3page.ini "Field 3" State ""

WriteINIStr $PLUGINSDIRopt3page.ini "Field 3" Flags "NOTABSTOP|DISABLED|NOTIFY"

WriteINIStr $PLUGINSDIRopt3page.ini "Field 2" State 1

WriteINIStr $PLUGINSDIRopt3page.ini "Field 4" State ""

!ifdef INSTALLER_FULL | INSTALLER_PRO

${EndIf}

!endif

;查找安装目录下的其它外观

Push "$INSTDIRSkins"

Call SearchSkins

InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIRopt3page.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 "$PLUGINSDIRopt3page.ini" "Field 5" State

StrCmp $0 "" 0 +3

GetDlgItem $0 $HWND 1203

EnableWindow $0 0

InstallOptions::show

FunctionEnd

Function LeaveCustom3

ReadINIStr $0 "$PLUGINSDIRopt3page.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 "$PLUGINSDIRopt3page.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 "$PLUGINSDIRopt3page.ini" "Field 5" ListItems

WriteINIStr "$PLUGINSDIRopt3page.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 "$PLUGINSDIRopt3page.ini" "Field 5" ListItems

StrCpy $R2 "$R2|$R1" -4 ;不带扩展名

WriteINIStr "$PLUGINSDIRopt3page.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 "$PLUGINSDIRopt3page.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 "$PLUGINSDIRopt2page.ini" "Field 7" ListItems

StrCpy $R2 "$R2|$R1" -4

WriteINIStr "$PLUGINSDIRopt2page.ini" "Field 7" ListItems $R2

${EndIf}

${EndIf}

${EndSelect}

FindNext $R0 $R1

${LoopUntil} ${Errors}

FindClose $R0

${EndUnless}

ReadINIStr $R0 "$INSTDIRWinamp.ini" Winamp langpack

${If} $R0 != ""

${If} ${FileExists} "$INSTDIR$R0"

StrCpy $R0 $R0 -4

WriteINIStr "$PLUGINSDIRopt2page.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 '"$INSTDIRWinamp.exe" /UNREG'

Call un.Restore

DeleteRegKey HKCR "Winamp.File"

DeleteRegKey HKCR "Winamp.Playlist"

DeleteRegKey HKCR "Winamp.SkinZip"

DeleteRegKey HKCR "DirectoryshellWinamp.Play"

DeleteRegKey HKCR "DirectoryshellWinamp.Enqueue"

DeleteRegKey HKCR "DirectoryshellWinamp.Bookmark"

DeleteRegKey HKCU "SoftwareWinamp"

DeleteRegKey HKLM "SOFTWARENullsoftWinamp"

DeleteRegKey HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstallWinamp"

Push "WinampAgentMain"

Call un.CloseProgram

;必删除的文件或使用过程中产生的文件

Delete /REBOOTOK "$INSTDIRWinamp.m3u"

Delete /REBOOTOK "$INSTDIRWinamp.ini"

Delete /REBOOTOK "$INSTDIRUninstWA.exe"

Delete /REBOOTOK "$INSTDIRPluginsvis_avs.dat"

Delete /REBOOTOK "$INSTDIRstudio.xnf"

Delete /REBOOTOK "$INSTDIRPluginsgen_ml.ini"

RMDir /r "$INSTDIRPluginsml"

!ifdef LOG_SET_SUPPORT

Push "$INSTDIRinstall.log"

Call un.DelFileByLog

Push "$INSTDIRinstall.log"

Call un.RMDirByLog

Delete "$INSTDIRinstall.log"

!else

;桌面图标

Delete /REBOOTOK "$DESKTOPWinamp.lnk"

;快速启动栏图标

Delete /REBOOTOK "$QUICKLAUNCHWinamp.lnk"

;开始菜单组

RMDir /r "$SMPROGRAMSWinamp"

;主程序文件

Delete /REBOOTOK "$INSTDIRwhatsnew.txt"

Delete /REBOOTOK "$INSTDIRdemo.mp3"

Delete /REBOOTOK "$INSTDIRwinamp.exe"

Delete /REBOOTOK "$INSTDIRwinamp.lks"

Delete /REBOOTOK "$INSTDIRWinamp.q1"

Delete /REBOOTOK "$INSTDIRwinampmb.htm"

Delete /REBOOTOK "$INSTDIRPluginsout_wave.dll"

Delete /REBOOTOK "$INSTDIRPluginsin_mp3.dll"

;Winamp 代理

Delete /REBOOTOK "$INSTDIRwinampa.exe"

;媒体库

Delete /REBOOTOK "$INSTDIRPluginsgen_ml.dll"

;现代外观文件

RMDir /r "$INSTDIRSkinsWinamp Modern"

Delete /REBOOTOK "$INSTDIRPluginsgen_ff.dll"

RMDir /r "$INSTDIRPluginsfreeform"

;全局热键

Delete /REBOOTOK "$INSTDIRPluginsgen_hotkeys.dll"

;跳转到文件

Delete /REBOOTOK "$INSTDIRPluginsgen_jumpex.dll"

;托盘控制

Delete /REBOOTOK "$INSTDIRPluginsgen_tray.dll"

;Windows Media Audio (WMA)

Delete /REBOOTOK "$INSTDIRPluginsin_wm.dll"

Delete /REBOOTOK "$INSTDIRPluginswmahelp.dll"

;MIDI

Delete /REBOOTOK "$INSTDIRPluginsin_midi.dll"

Delete /REBOOTOK "$INSTDIRPluginsread_file.dll"

;MOD/XM/S3M/IT

Delete /REBOOTOK "$INSTDIRPluginsin_mod.dll"

;OGG Vorbis

Delete /REBOOTOK "$INSTDIRPluginsin_vorbis.dll"

;AAC 编码

Delete /REBOOTOK "$INSTDIRPluginsenc_aac.dll"

;MP3 编码

Delete /REBOOTOK "$INSTDIRPluginsenc_lame.dll"

Delete /REBOOTOK "$INSTDIRePluginslame_enc.dll"

;MP4

Delete /REBOOTOK "$INSTDIRPluginsin_mp4.dll"

Delete /REBOOTOK "$INSTDIRPluginsenc_mp4.dll"

Delete /REBOOTOK "$INSTDIRPluginslibmp4v2.dll"

;CD

Delete /REBOOTOK "$INSTDIRPluginsin_cdda.dll"

;Sonic Rip、烧录

Delete /REBOOTOK "$INSTDIRPXSDKPLS.dll"

;CDDB

Delete /REBOOTOK "$INSTDIRPluginsCDDBControlWinamp.dll"

Delete /REBOOTOK "$INSTDIRPluginsCDDBUIWinamp.dll"

Delete /REBOOTOK "$INSTDIRPluginsin_cdda.dll"

;WAV/VOC/AU/AIFF

Delete /REBOOTOK "$INSTDIRPluginsin_wave.dll"

;Nullsoft 视频 (NSV)

Delete /REBOOTOK "$INSTDIRPluginsin_nsv.dll"

Delete /REBOOTOK "$INSTDIRPluginsnsvdec_vp5.dll"

Delete /REBOOTOK "$INSTDIRPluginsnsvdec_vp6.dll"

;AVI/MPG/ASF

Delete /REBOOTOK "$INSTDIRPluginsin_dshow.dll"

;Nullsoft 微型全屏

Delete /REBOOTOK "$INSTDIRPluginsvis_nsfs.dll"

;高级可视化

Delete /REBOOTOK "$INSTDIRPluginsvis_avs.dll"

RMDir /r "$INSTDIRPluginsavs"

;Milkdrop

Delete /REBOOTOK "$INSTDIRPluginsvms_desktop.dll"

Delete /REBOOTOK "$INSTDIRPluginsmilkdrop.html"

Delete /REBOOTOK "$INSTDIRPluginsvis_milk.dll"

RMDir /r "$INSTDIRPluginsMilkdrop"

;信号处理器工作室插件

Delete /REBOOTOK "$INSTDIRPluginsdsp_sps.dll"

RMDir /r "$INSTDIRPluginsDSP_SPS"

;写入 WAV 文件支持

Delete /REBOOTOK "$INSTDIRPluginsout_disk.dll"

;DirectSound 输出支持

Delete /REBOOTOK "$INSTDIRPluginsout_ds.dll"

!endif;end of LOG_SET_SUPPORT

;如果目录为空则删除

RMDir "$INSTDIRPlugins"

RMDir "$INSTDIRSkins"

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 "SOFTWAREMicrosoftWindowsCurrentVersionUninstallWinamp" "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 "SOFTWAREClasses" $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.Filetemp" $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.Filetemp"

StrCpy $R1 0

StrCpy $R2 0

${Do}

EnumRegValue $R0 HKCU "SoftwareNetscapeNetscape NavigatorViewers" $R1

${If} $R0 == ""

IntOp $R2 $R2 + 1

${Else}

StrCpy $R3 $R0 "" -10

${IfThen} $R3 == "Winamp.exe" ${|} DeleteRegValue HKCU "SoftwareNetscapeNetscape NavigatorViewers" $R0 ${|}

${EndIf}

IntOp $R1 $R1 + 1

${LoopUntil} $R2 > 2

ReadRegStr $R0 HKCR "AudioCDshellplaycommand" "Winamp_Back"

${IfThen} $R0 != "" ${|} WriteRegStr HKCR "AudioCDshellplaycommand" "" $R0 ${|}

DeleteRegValue HKCR "AudioCDshellplaycommand" "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 "SOFTWAREClasses$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.Filetemp" $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
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 蓝色网际winamp封装脚本

您必须 登录 才能发表评论!