设置文件关联

#文件关联器
#脚本说明:编译脚本前将Stream.nsh复制到%NSIS%ContribModern UILanguage files目录中
#脚本功能: 实现mplayerc.exe与其所支持的文件格式的关联,
#并在关联过程中自动备份原有关联信息以便恢复!
#通过带参数“/restore”运行程序可恢复原有关联
#并删除所有由该程序创建的注册表信息!

Name  “KMPlayer”
SetCompressor lzma
CRCCheck off
InstallColors /windows
AutoCloseWindow true
ShowInstDetails nevershow
SilentInstall normal
BrandingText “$(^NameDA) 文件关联向导”
SpaceTexts “none”
Caption “$(^NameDA) 文件关联向导”
SubCaption 1 ” ”
InstallButtonText “关联(&A)”
ComponentText “” “$(^NameDA) 文件关联设置:” “———————-”
OutFile “Assoc.exe”
;设置字体
SetFont /LANG=2052 “tahoma” 8
;!include “Sections.nsh” ;——-ansifa删除
!include “LogicLib.nsh”
!include “MUI.nsh”
!include “UsefulLib.nsh”       ;——-ansifa修改
!define MUI_ICON “.icon.ico”
!define MUI_HEADERIMAGE
;!define MUI_COMPONENTSPAGE_CHECKBITMAP “Checks_Sajal_3D.bmp” ;——-ansifa删除
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT “设置完成”
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT “设置已经生效!点击“关闭”退出!”
;!define MUI_HEADERIMAGE_RIGHT
;!define MUI_HEADERIMAGE_BITMAP .header.bmp
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE “SimpChinese”       ;——-ansifa修改
ChangeUI ALL “myui.exe”
VIProductVersion “2.0.0.1”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “ProductName” “KMPlayer 文件关联设置”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “Comments” “KMPlayer 文件关联设置”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “CompanyName” “yhxs3344”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “LegalTrademarks” “yhxs3344.net”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “LegalCopyright” “版权所有 (C) (${__DATE__}) 保留所有权利”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “FileDescription” “KMPlayer 文件关联设置”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “OriginalFilename” “Assoc.exe”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “InternalName” “Assoc.exe”
VIAddVersionKey /LANG=${LANG_SIMPCHINESE} “FileVersion” “2.0.0.1”
;定义文件关联宏(扩展名、文件描述、文件图标)
;如果ico为空则使用默认图标
;原有关联信息备份在HKCRKMPlayer.filebackup
;Backup origin assoc info at HKCRKMPlayer.filebackup
!macro assoc ext desc ico
Push $0
Push $1
Push $2
ReadRegStr $2 HKCR “KMPlayer.file” “”
StrCmp $2 “” 0 +2
WriteRegStr HKCR “KMPlayer.file” “” “KMPlayer 媒体文件”
ReadRegStr $0 HKCR “.${ext}” “”  ;备份关联
StrCpy $1 $0 8        ;———–重点改了这里10->8,是在.${EXT}截取KMPlayer字样的意思.
StrCmp $1 “KMPlayer” +2          ;如果已经进行过 KMPlayer 关联设置则跳过备份
WriteRegStr HKCR “KMPlayer.filebackup” “${ext}” “$0”
DeleteRegKey HKCU “SoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.${ext}”
WriteRegStr HKCR “.${ext}” “” “KMPlayer.${ext}”
WriteRegStr HKCR KMPlayer.${ext} “” “${desc}”  ;写入注册表           —–这里你没改好
WriteRegStr HKCR KMPlayer.${ext}shell “” open
WriteRegStr HKCR KMPlayer.${ext}shellopen “” “播放(&P)”
WriteRegStr HKCR KMPlayer.${ext}shellopencommand “” ‘”$EXEDIRKMPlayer.exe” “%1″‘
${if} “${ico}” == “” ;如果不指定图标则使用默认图标
WriteRegStr HKCR KMPlayer.${ext}DefaultIcon “” “$EXEDIRKMPlayer.exe”
${Else}
WriteRegStr HKCR KMPlayer.${ext}DefaultIcon “” “${ico}”
${EndIf}
Pop $2
Pop $1
Pop $0
!macroend
;文件关联恢复宏,用于恢复原有文件关联
!macro CheckSection SECTION_NAME EXT
Push $0
ReadRegStr $0 HKCR “.${EXT}” “”
StrCpy $0 $0 8           ;———–重点改了这里10->8,是在.${EXT}截取KMPlayer字样的意思.
StrCmp $0 “KMPlayer” 0 +5  ;如果当前已经关联,则设置在”当前关联”安装类型中选中
SectionGetInstTypes “${SECTION_NAME}” $0
IntOp $0 $0 | 8       ;  —2|8=11 3|8=11
SectionSetInstTypes “${SECTION_NAME}” $0
Goto +4
SectionGetInstTypes “${SECTION_NAME}” $0
IntOp $0 $0 & 7       ;  —2&7=2 3&7=3
SectionSetInstTypes “${SECTION_NAME}” $0
Pop $0
!macroend
;文件关联恢复宏,用于恢复原有文件关联
Function Restore
Push $R0
Push $R1
Push $R2
Push $R3
Push $R4
StrCpy $R0 0
loop:
EnumRegValue $R1 HKCR “KMPlayer.filebackup” $R0
ReadRegStr $R3 HKCR “KMPlayer.filebackup” $R1
StrCmp $R1 “” loop_quit
StrCpy $R2 $R3 8        ;———–重点改了这里10->8,是截取KMPlayer字样的意思.
StrCmp $R2 “KMPlayer” +2             ;检测当前的关联是否 KMPlayer
StrCmp $R3 “” +1 restore                ;如果备份的是空值则直接删除
DeleteRegKey HKCR “.$R1”
DeleteRegKey HKCR “KMPlayer.$R1”
Goto no_restore
restore:
ReadRegStr $R4 HKCR “.$R1” “”
StrCpy $R2 $R4 8        ;———–重点改了这里10->8,是截取KMPlayer字样的意思.
StrCmp $R2 “KMPlayer” 0 no_restore   ;检测当前的关联是否 KMPlayer
WriteRegStr HKCR “.$R1” “” “$R3”
DeleteRegKey HKCR “KMPlayer.$R1”
no_restore:
IntOp $R0 $R0 + 1
Goto loop
loop_quit:
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
#———————————————-
# Realization funtion & sction
;Define assoc macro(ext、dis、ico)
InstType “推荐关联”
InstType “全部关联”
InstType “取消关联”
InstType “当前关联”
;检测命令行参数函数
Function CMD_PAR
Push $R0
Push $R1
Push $R2
Push $R3
StrCpy $R1 1
StrCpy $R0 0
StrLen $R3 $CMDLINE
loop:
StrCpy $R2 $CMDLINE 8 $R1
StrCmp $R2 “/restore” loop_quit
IntCmp $R1 $R3 end 0 end
IntOp $R1 $R1 + 1
Goto loop
loop_quit:
StrCpy $R0 1
end:
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
Section “”
Call Restore
DeleteRegKey /ifempty HKCR “KMPlayer.Filebackup”
DeleteRegValue HKCR “KMPlayer.File” “”
DeleteRegKey /ifempty HKCR “KMPlayer.File”
System::Call ‘Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)’ ;刷新屏幕用
SectionEnd
SectionGroup “Real 媒体”
SectionGroup “Real 视频”
Section “.ram” ram
SectionIn 1 2
!insertmacro assoc ram “Real 视频” “$EXEDIRKIconLib.dll,25”
SectionEnd
Section “.rm” rm
SectionIn 1 2
!insertmacro assoc rm “Real 视频” “$EXEDIRKIconLib.dll,22”
SectionEnd
Section “.rmvb” rmvb
SectionIn 1 2
!insertmacro assoc rmvb “Real 视频” “$EXEDIRKIconLib.dll,27”
SectionEnd
SectionGroupEnd
SectionGroup “Real 音频”
Section “.ra” ra
SectionIn 1 2
!insertmacro assoc ra “Real 音频” “$EXEDIRKIconLib.dll,21”
SectionEnd
Section “.rpm” rpm
SectionIn 1 2
!insertmacro assoc rpm “Real 音频” “$EXEDIRReal Playerreal1.ico”
SectionEnd
SectionGroupEnd
SectionGroup “Real 脚本”
Section “.rp” rp
SectionIn 1 2
!insertmacro assoc rp “Real 脚本” “$EXEDIRReal Playerreal1.ico”
SectionEnd
Section “.rt” rt
SectionIn 1 2
!insertmacro assoc rt “Real 脚本” “$EXEDIRKIconLib.dll,31”
SectionEnd
Section “.smi” smi
SectionIn 1 2
!insertmacro assoc smi “Real 脚本” “$EXEDIRKIconLib.dll,18”
SectionEnd
Section “.smil” smil
SectionIn 1 2
!insertmacro assoc smil “Real 脚本” “$EXEDIRReal Playerreal1.ico”
SectionEnd
SectionGroupEnd
SectionGroupEnd
SectionGroup “QuickTime 媒体”
SectionGroup “Quicktime 视频”
Section “.mov” mov
SectionIn 1 2
!insertmacro assoc mov “Quicktime 视频” “$EXEDIRKIconLib.dll,8”
SectionEnd
Section “.qt” qt
SectionIn 1 2
!insertmacro assoc qt “Quicktime 视频” “$EXEDIRKIconLib.dll,13”
SectionEnd
Section “.qtm” qtm
SectionIn 1 2
!insertmacro assoc qtm “Quicktime 视频” “”
SectionEnd
SectionGroupEnd
SectionGroup “QuickTime 音频”
Section “.amr” amr
SectionIn 1 2
!insertmacro assoc amr “QuickTime 音频” “”
SectionEnd
SectionGroupEnd
SectionGroupEnd
SectionGroup “Windows 媒体”
SectionGroup “Windows Media 视频”
Section “.asf” asf
SectionIn 2
!insertmacro assoc asf “Windows Media 视频” “$EXEDIRKIconLib.dll,0”
SectionEnd
Section “.wmv” wmv
SectionIn 2
!insertmacro assoc wmv “Windows Media 视频” “$EXEDIRKIconLib.dll,17”
SectionEnd
Section “.wm” wm
SectionIn 2
!insertmacro assoc wm “Windows Media 视频” “”
SectionEnd
SectionGroupEnd
SectionGroup “Windows Media 音频”
Section “.wma” wma
SectionIn 2
!insertmacro assoc wma “Windows Media 音频” “$EXEDIRKIconLib.dll,16”
SectionEnd
Section “.wax” wax
SectionIn 2
!insertmacro assoc wax “Windows Media 音频” “$EXEDIRKIconLib.dll,102”
SectionEnd
SectionGroupEnd
SectionGroupEnd
SectionGroup “常规 DVDRIP”
Section “.avi-Windows 视频” avi
SectionIn 1 2
!insertmacro assoc avi “Windows 视频” “$EXEDIRKIconLib.dll,2”
SectionEnd
Section “.mkv-Matroska 媒体” mkv
SectionIn 1 2
!insertmacro assoc mkv “Matroska 媒体” “”
SectionEnd
Section “.ogm-OGG 媒体” ogm
SectionIn 1 2
!insertmacro assoc ogm “OGG 媒体” “$EXEDIRKIconLib.dll,28”
SectionEnd
SectionGroupEnd
SectionGroup “MPEG 视频”
Section “.dat-VCD 视频” dat
SectionIn 2
!insertmacro assoc dat “VCD 视频” “$EXEDIRKIconLib.dll,3”
SectionEnd
Section “.vob-DVD 视频” vob
SectionIn 1 2
!insertmacro assoc vob “DVD 视频” “$EXEDIRKIconLib.dll,14”
SectionEnd
SectionGroup “MPEG-1 视频”
Section “.mpg” mpg
SectionIn 1 2
!insertmacro assoc mpg “MPEG 视频” “$EXEDIRKIconLib.dll,12”
SectionEnd
Section “.mpeg” mpeg
SectionIn 1 2
!insertmacro assoc mpeg “MPEG 视频” “$EXEDIRKIconLib.dll,11”
SectionEnd
Section “.mpe” mpe
SectionIn 2
!insertmacro assoc mpe “MPEG 视频” “$EXEDIRKIconLib.dll,10”
SectionEnd
Section “.mpv2” mpv2
SectionIn 2
!insertmacro assoc mpv2 “MPEG 视频” “”
SectionEnd
Section “.mp2v” mp2v
SectionIn 2
!insertmacro assoc mp2v “MPEG 视频” “”
SectionEnd
Section “.tpr” tpr
SectionIn 2
!insertmacro assoc tpr “MPEG 视频” “”
SectionEnd
Section “.pva” pva
SectionIn 2
!insertmacro assoc pva “MPEG 视频” “”
SectionEnd
Section “.pss” pss
SectionIn 2
!insertmacro assoc pss “MPEG 视频” “”
SectionEnd
Section “.m1v” m1v
SectionIn 2
!insertmacro assoc m1v “MPEG 视频” “$EXEDIRKIconLib.dll,4”
SectionEnd
Section “.m2v” m2v
SectionIn 2
!insertmacro assoc m2v “MPEG 视频” “$EXEDIRKIconLib.dll,5”
SectionEnd
Section “.ifo” ifo
SectionIn 2
!insertmacro assoc ifo “DVD 字幕” “$EXEDIRKIconLib.dll,40”
SectionEnd
SectionGroupEnd
SectionGroup “MPEG-2 视频”
Section “.ts” ts
SectionIn 1 2
!insertmacro assoc ts “MPEG-2 视频” “$EXEDIRKIconLib.dll,99”
SectionEnd
Section “.tp” tp
SectionIn 1 2
!insertmacro assoc tp “MPEG-2 视频” “$EXEDIRKIconLib.dll,97”
SectionEnd
SectionGroupEnd
SectionGroup “MPEG-4 视频”
Section “.mp4” mp4
SectionIn 1 2
!insertmacro assoc mp4 “MPEG-4 视频” “$EXEDIRKIconLib.dll,43”
SectionEnd
Section “.3gp” 3gp
SectionIn 1 2
!insertmacro assoc 3gp “MPEG-4 视频” “$EXEDIRKIconLib.dll,48”
SectionEnd
Section “.3g2” 3g2
SectionIn 1 2
!insertmacro assoc 3g2 “MPEG-4 视频” “”
SectionEnd
Section “.3gp2” 3gp2
SectionIn 2
!insertmacro assoc 3gp2 “MPEG-4 视频” “”
SectionEnd
Section “.3gpp” 3gpp
SectionIn 2
!insertmacro assoc 3gpp “MPEG-4 视频” “”
SectionEnd
Section “.m4v” m4v
SectionIn 2
!insertmacro assoc m4v “MPEG-4 视频” “$EXEDIRKIconLib.dll,70”
SectionEnd
Section “.m4p” m4p
SectionIn 2
!insertmacro assoc m4p “MPEG-4 视频” “”
SectionEnd
Section “.m4b” m4b
SectionIn 2
!insertmacro assoc m4b “MPEG-4 视频” “”
SectionEnd
SectionGroupEnd
SectionGroupEnd
SectionGroup “其它格式视频”
Section “.drc-Dirac 视频” drc
SectionIn 1 2
!insertmacro assoc drc “Dirac 视频” “”
SectionEnd
Section “.vg2-XVD 视频” vg2
SectionIn 1 2
!insertmacro assoc vg2 “XVD 视频” “”
SectionEnd
Section “.ivf-Indeo 视频” ivf
SectionIn 1 2
!insertmacro assoc ivf “Indeo 视频” “”
SectionEnd
Section “.vp6-VP6 视频” vp6
SectionIn 1 2
!insertmacro assoc vp6 “VP6 视频” “$EXEDIRKIconLib.dll,101”
SectionEnd
Section “.vp7-VP7 视频” vp7
SectionIn 1 2
!insertmacro assoc vp7 “VP7 视频” “”
SectionEnd
Section “.roq-RoQ 媒体” roq
SectionIn 1 2
!insertmacro assoc roq “RoQ 媒体” “”
SectionEnd
Section “.smk-Smacker 媒体” smk
SectionIn 1 2
!insertmacro assoc smk “Smacker 媒体” “”
SectionEnd
Section “.bik-Bink 媒体” bik
SectionIn 1 2
!insertmacro assoc bik “Bink 媒体” “”
SectionEnd
Section “.d2v-DVD2AVI 工程” d2v
SectionIn 1 2
!insertmacro assoc d2v “DVD2AVI 工程” “”
SectionEnd
Section “.divx-DivX 视频” divx
SectionIn 1 2
!insertmacro assoc divx “DivX 视频” “$EXEDIRKIconLib.dll,56”
SectionEnd
SectionGroup “DirectShow 媒体”
Section “.dsm” dsm
SectionIn 1 2
!insertmacro assoc dsm “DirectShow 媒体” “”
SectionEnd
Section “.dsv” dsv
SectionIn 1 2
!insertmacro assoc dsv “DirectShow 媒体” “”
SectionEnd
Section “.dsa” dsa
SectionIn 1 2
!insertmacro assoc dsa “DirectShow 媒体” “”
SectionEnd
Section “.dss” dss
SectionIn 1 2
!insertmacro assoc dss “DirectShow 媒体” “”
SectionEnd
SectionGroupEnd
SectionGroup “FLIC 动画”
Section “.fli” fli
SectionIn 1 2
!insertmacro assoc fli “FLIC 动画” “”
SectionEnd
Section “.flc” flc
SectionIn 1 2
!insertmacro assoc flc “FLIC 动画” “$EXEDIRKIconLib.dll,59”
SectionEnd
Section “.flic” flic
SectionIn 1 2
!insertmacro assoc flic “FLIC 动画” “”
SectionEnd
SectionGroupEnd
SectionGroupEnd
Section “ShockWave Flash” swf
SectionIn 2
!insertmacro assoc swf “ShockWave Flash” “$EXEDIRKIconLib.dll,96”
SectionEnd
SectionGroup “未压缩音频”
Section “.wav” wav
SectionIn 2
!insertmacro assoc wav “Windows 音频” “$EXEDIRKIconLib.dll,15”
SectionEnd
Section “.aif” aif
SectionIn 2
!insertmacro assoc aif “音频文件” “”
SectionEnd
Section “.aifc” aifc
SectionIn 2
!insertmacro assoc aifc “音频文件” “”
SectionEnd
Section “.aiff” aiff
SectionIn 2
!insertmacro assoc aiff “音频文件” “”
SectionEnd
Section “.au” au
SectionIn 2
!insertmacro assoc au “音频文件” “”
SectionEnd
Section “.snd” snd
SectionIn 2
!insertmacro assoc snd “音频文件” “”
SectionEnd
Section “.cda” cda
SectionIn 2
!insertmacro assoc cda “CD 音轨” “$EXEDIRKIconLib.dll,54”
SectionEnd
SectionGroupEnd
SectionGroup “压缩音频”
SectionGroup “无损压缩音频”
Section “.fla” fla
SectionIn 2
!insertmacro assoc fla “FLAC 音频” “”
SectionEnd
Section “.flac” flac
SectionIn 2
!insertmacro assoc flac “FLAC 音频” “$EXEDIRKIconLib.dll,41”
SectionEnd
Section “.ape” ape
SectionIn 2
!insertmacro assoc ape “Monkey 音频” “$EXEDIRKIconLib.dll,44”
SectionEnd
Section “.mac” mac
SectionIn 2
!insertmacro assoc mac “Monkey 音频” “”
SectionEnd
Section “.tta” tta
SectionIn 2
!insertmacro assoc tta “TTA 音频” “”
SectionEnd
Section “.shn” shn
SectionIn 2
!insertmacro assoc shn “Shorten 音频” “”
SectionEnd
SectionGroupEnd
SectionGroup “MPEG 音频”
Section “.mp3” mp3
SectionIn 2
!insertmacro assoc mp3 “MP3 音频” “$EXEDIRKIconLib.dll,9”
SectionEnd
Section “.ac3” ac3
SectionIn 2
!insertmacro assoc ac3 “DVD 音频” “$EXEDIRKIconLib.dll,46”
SectionEnd
Section “.dts” dts
SectionIn 2
!insertmacro assoc dts “DVD 音频” “$EXEDIRKIconLib.dll,58”
SectionEnd
Section “.mpa” mpa
SectionIn 2
!insertmacro assoc mpa “MPEG 音频” “$EXEDIRKIconLib.dll,79”
SectionEnd
Section “.mp2” mp2
SectionIn 2
!insertmacro assoc mp2 “MPEG 音频” “$EXEDIRKIconLib.dll,77”
SectionEnd
Section “.m1a” m1a
SectionIn 2
!insertmacro assoc m1a “MPEG 音频” “”
SectionEnd
Section “.m2a” m2a
SectionIn 2
!insertmacro assoc m2a “MPEG 音频” “”
SectionEnd
Section “.m4a” m4a
SectionIn 2
!insertmacro assoc m4a “MPEG-4 音频” “$EXEDIRKIconLib.dll,69”
SectionEnd
Section “.aac” aac
SectionIn 2
!insertmacro assoc aac “MPEG-4 音频” “$EXEDIRKIconLib.dll,42”
SectionEnd
SectionGroupEnd
SectionGroup “其它格式音频”
Section “.ogg” ogg
SectionIn 2
!insertmacro assoc ogg “OGG 音频” “$EXEDIRKIconLib.dll,28”
SectionEnd
Section “.mka” mka
SectionIn 2
!insertmacro assoc mka “Matroska 音频” “$EXEDIRKIconLib.dll,72”
SectionEnd
Section “.mpc” mpc
SectionIn 2
!insertmacro assoc mpc “MusePack 音频” “$EXEDIRKIconLib.dll,45”
SectionEnd
Section “.mp+” mp+
SectionIn 2
!insertmacro assoc mp+ “MusePack 音频” “$EXEDIRICONMPC.ico”
SectionEnd
Section “.mpp” mpp
SectionIn 2
!insertmacro assoc mpp “MusePack 音频” “$EXEDIRICONMPC.ico”
SectionEnd
Section “.mod” mod
SectionIn 2
!insertmacro assoc mod “MOD 音频” “”
SectionEnd
Section “.xm” xm
SectionIn 2
!insertmacro assoc xm “MOD 音频” “”
SectionEnd
SectionGroupEnd
SectionGroupEnd
SectionGroup “MIDI 文件”
Section “.mid” mid
SectionIn 2
!insertmacro assoc mid “MIDI 文件” “$EXEDIRKIconLib.dll,6”
SectionEnd
Section “.midi” midi
SectionIn 2
!insertmacro assoc midi “MIDI 文件” “”
SectionEnd
Section “.rmi” rmi
SectionIn 2
!insertmacro assoc rmi “MIDI 文件” “”
SectionEnd
SectionGroupEnd
SectionGroup “常规播放列表”
Section “.m3u” m3u
SectionIn 2
!insertmacro assoc m3u “播放列表” “$EXEDIRKIconLib.dll,20”
SectionEnd
Section “.pls” pls
SectionIn 2
!insertmacro assoc pls “播放列表” “$EXEDIRKIconLib.dll,19”
SectionEnd
Section “.asx” asx
SectionIn 2
!insertmacro assoc asx “播放列表” “$EXEDIRKIconLib.dll,1”
SectionEnd
Section “.wpl” wpl
SectionIn 2
!insertmacro assoc wpl “播放列表” “”
SectionEnd
Section “.wmx” wmx
SectionIn 2
!insertmacro assoc wmx “播放列表” “$EXEDIRKIconLib.dll,105”
SectionEnd
Section “.wvx” wvx
SectionIn 2
!insertmacro assoc wvx “播放列表” “”
SectionEnd
Section “.mpcpl” mpcpl
SectionIn 2
!insertmacro assoc mpcpl “播放列表” “”
SectionEnd
SectionGroupEnd
;区段描述信息,默认显示当前文件类型关联情况(此功能还未实现,唉!)!
/*Function .onMouseOverSection
!insertmacro MUI_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${ram} “${des_ram}”
!insertmacro MUI_DESCRIPTION_END
FunctionEnd

*/

Function .onInit
;检查是否在KMPlayer目录
IfFileExists “$ExedirKMPlayer.exe” +3
MessageBox MB_OK|MB_ICONSTOP “不能运行设置程序!$n您未安装 KMPlayer 或本程序未放置在 KMPlayer 安装目录!”
Abort
Location_ok:
;检查是否重复运行
System::Call ‘kernel32::CreateMutexA(i 0, i 0, t “myMutex”) i .r1 ?e’
Pop $0
StrCmp $0 0 +2
Quit
;判断程序是否带“/restore”参数运行,带参数运行时恢复备份并清除注册信息!
Call CMD_PAR
Pop $0
StrCmp $0 1 0 no_par
Call Restore
DeleteRegKey /ifempty HKCR “KMPlayer.Filebackup”
DeleteRegValue HKCR “KMPlayer.File” “”
DeleteRegKey /ifempty HKCR “KMPlayer.File”
Quit
InitPluginsDir
no_par:
;判断程序是否为第一次运行,否则检测当前格式关联
ReadRegStr $0 HKCR “KMPlayer.file” “”
StrCmp $0 “” check_skip 0
InstTypeSetText 3 “当前关联”
!insertmacro CheckSection ${3g2} 3g2
!insertmacro CheckSection ${3gp} 3gp
!insertmacro CheckSection ${3gp2} 3gp2
!insertmacro CheckSection ${3gpp} 3gpp
!insertmacro CheckSection ${aac} aac
!insertmacro CheckSection ${au} au
!insertmacro CheckSection ${bik} bik
!insertmacro CheckSection ${cda} cda
!insertmacro CheckSection ${d2v} d2v
!insertmacro CheckSection ${divx} divx
!insertmacro CheckSection ${m2a} m2a
!insertmacro CheckSection ${m4a} m4a
!insertmacro CheckSection ${m4b} m4b
!insertmacro CheckSection ${m4p} m4p
!insertmacro CheckSection ${mp2} mp2
!insertmacro CheckSection ${roq} roq
!insertmacro CheckSection ${smk} smk
!insertmacro CheckSection ${snd} snd
!insertmacro CheckSection ${tta} tta
!insertmacro CheckSection ${vp7} vp7
!insertmacro CheckSection ${ac3} ac3
!insertmacro CheckSection ${aif} aif
!insertmacro CheckSection ${aifc} aifc
!insertmacro CheckSection ${aiff} aiff
!insertmacro CheckSection ${amr} amr
!insertmacro CheckSection ${ape} ape
!insertmacro CheckSection ${asf} asf
!insertmacro CheckSection ${asx} asx
!insertmacro CheckSection ${avi} avi
!insertmacro CheckSection ${dat} dat
!insertmacro CheckSection ${drc} drc
!insertmacro CheckSection ${dsa} dsa
!insertmacro CheckSection ${dsm} dsm
!insertmacro CheckSection ${dss} dss
!insertmacro CheckSection ${dsv} dsv
!insertmacro CheckSection ${dts} dts
!insertmacro CheckSection ${fla} fla
!insertmacro CheckSection ${flac} flac
!insertmacro CheckSection ${flc} flc
!insertmacro CheckSection ${fli} fli
!insertmacro CheckSection ${flic} flic
!insertmacro CheckSection ${ifo} ifo
!insertmacro CheckSection ${ivf} ivf
!insertmacro CheckSection ${m1a} m1a
!insertmacro CheckSection ${m1v} m1v
!insertmacro CheckSection ${m2v} m2v
!insertmacro CheckSection ${m3u} m3u
!insertmacro CheckSection ${m4v} m4v
!insertmacro CheckSection ${mac} mac
!insertmacro CheckSection ${mid} mid
!insertmacro CheckSection ${midi} midi
!insertmacro CheckSection ${mka} mka
!insertmacro CheckSection ${mkv} mkv
!insertmacro CheckSection ${mod} mod
!insertmacro CheckSection ${mov} mov
!insertmacro CheckSection ${mp+} mp+
!insertmacro CheckSection ${mp2v} mp2v
!insertmacro CheckSection ${mp3} mp3
!insertmacro CheckSection ${mp4} mp4
!insertmacro CheckSection ${mpa} mpa
!insertmacro CheckSection ${mpc} mpc
!insertmacro CheckSection ${mpcpl} mpcpl
!insertmacro CheckSection ${mpe} mpe
!insertmacro CheckSection ${mpeg} mpeg
!insertmacro CheckSection ${mpg} mpg
!insertmacro CheckSection ${mpp} mpp
!insertmacro CheckSection ${mpv2} mpv2
!insertmacro CheckSection ${ogg} ogg
!insertmacro CheckSection ${ogm} ogm
!insertmacro CheckSection ${pls} pls
!insertmacro CheckSection ${pss} pss
!insertmacro CheckSection ${pva} pva
!insertmacro CheckSection ${qt} qt
!insertmacro CheckSection ${qtm} qtm
!insertmacro CheckSection ${ra} ra
!insertmacro CheckSection ${ram} ram
!insertmacro CheckSection ${rm} rm
!insertmacro CheckSection ${rmi} rmi
!insertmacro CheckSection ${rmvb} rmvb
!insertmacro CheckSection ${rp} rp
!insertmacro CheckSection ${rpm} rpm
!insertmacro CheckSection ${rt} rt
!insertmacro CheckSection ${shn} shn
!insertmacro CheckSection ${smi} smi
!insertmacro CheckSection ${smil} smil
!insertmacro CheckSection ${tp} tp
!insertmacro CheckSection ${tpr} tpr
!insertmacro CheckSection ${ts} ts
!insertmacro CheckSection ${vg2} vg2
!insertmacro CheckSection ${vob} vob
!insertmacro CheckSection ${vp6} vp6
!insertmacro CheckSection ${wav} wav
!insertmacro CheckSection ${wax} wax
!insertmacro CheckSection ${wm} wm
!insertmacro CheckSection ${wma} wma
!insertmacro CheckSection ${wmv} wmv
!insertmacro CheckSection ${wmx} wmx
!insertmacro CheckSection ${wpl} wpl
!insertmacro CheckSection ${wvx} wvx
!insertmacro CheckSection ${xm} xm
SetCurInstType 3
goto init_end
check_skip:
InstTypeSetText 3 “”
SetCurInstType 0
init_end:
FunctionEnd
© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容