最新消息:

蓝色网际mpcassoc脚本链接提示对话框

nsis 永恒心锁 2592浏览 0评论
;脚本编写: 蓝色网际

;需要格外的插件: InstallOptionsEx.dll

!define              DISABLE_PRE_BUTTON

Name                 "Media Player Classic 设置程序"

SetCompress          auto

SetCompressor        lzma

AutoCloseWindow      true

ShowInstDetails      nevershow

BrandingText         "$(^NameDA) ${__DATE__}"

SpaceTexts           none

Caption              "$(^NameDA)"

SubCaption           1 " "

InstallButtonText    "确定"

ComponentText        "选中你需要关联的文件格式,取消你不想要的文件格式,点下一步继续." "关联 MPC 到:" "----------------------"

OutFile              "mpcassoc.exe"

ReserveFile          ".resourcempcassoc.ini"

ReserveFile          ".resourcereal.ini"

ReserveFile          ".resourcemp4.ini"

ReserveFile          "${NSISDIR}PluginsInstallOptionsEx.dll"

ReserveFile          "${NSISDIR}PluginsInstallOptions.dll"

ReserveFile          "${NSISDIR}PluginsSystem.dll"

ReserveFile          "${NSISDIR}PluginsnsExec.dll"

Var                  FAST    ;快速启动参数变量

#Var                  EXEFILE ;自定义可执行文件名

; --------------------------------------

!include MUI2.nsh

!include Sections.nsh

!include LogicLib.nsh

!define MUI_ICON ".resourceico-assoc.ico"

!define MUI_HEADERIMAGE

!define MUI_HEADERIMAGE_BITMAP ".resourceBlackCDPastelGreenArrow.bmp"

!define MUI_WELCOMEFINISHPAGE_BITMAP ".resourceBlueCdArrow1.bmp"

!define MUI_COMPONENTSPAGE_CHECKBITMAP ".resourceChecks_Sajal_3D.bmp"

Page custom SetCustom LeaveCustom

!define MUI_PAGE_HEADER_TEXT "选择文件格式"

!define MUI_PAGE_HEADER_SUBTEXT "选择 $(^NameDA) 当中你需要的选项"

!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPage

!insertmacro MUI_PAGE_COMPONENTS

Page custom RealSetCustom RealLeaveCustom

Page custom Mp4SetCustom Mp4LeaveCustom

Page custom BakSetCustom BakLeaveCustom

!define MUI_PAGE_HEADER_TEXT "正在执行"

!define MUI_PAGE_HEADER_SUBTEXT "正在执行预定的任务..."

!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "SimpChinese"

ChangeUI IDD_SELCOM ".resourcemyui_nodesc.exe"

;----------------------------------------------------------------------------------------

;全局定义

!define ioA $PLUGINSDIRmpcassoc.ini

!define ioB $PLUGINSDIRreal.ini

!define ioC $PLUGINSDIRmp4.ini

!define ioD $PLUGINSDIRbak.ini

!define G_EXE_KEY "HKCR mplayerc.fileExeFile"

!define G_SETTING_KEY "HKCR mplayerc.file"

!define FIELD_SETASSOC "Field 8"   ;设置文件关联

!define FIELD_ASSOC "Field 2"      ;设置文件关联

!define FIELD_UNASSOC "Field 3"    ;文件关联卸载

!define FIELD_LINK "Field 4"       ;文件关联卸载

!define FIELD_BAK "Field 17"       ;备份个人设置

!define FIELD_MP4 "Field 7"        ;设置解码器切换

!define FIELD_REAL "Field 9"       ;设置 Real

!define FIELD_APP "Field 16"       ;设置 Real

;----------------------------------------------------------------------------------------

!macro SetSectionBold SECTION_INDEX

Push $0

SectionGetFlags "${SECTION_INDEX}" $0

IntOp $0 $0 | 8

SectionSetFlags "${SECTION_INDEX}" $0

Pop $0

!macroend

!macro assoc EXT DESC KEYWORD

Push '${EXT}'

Push '${DESC}'

Push '${KEYWORD}'

Call DoReg

!macroend

!macro ChkPre EXT

Push $0

ReadRegStr $0 HKCR ".${EXT}" ""

StrCpy $0 $0 8

StrCmp $0 mplayerc 0 +4

SectionGetInstTypes "${${EXT}}" $0

IntOp $0 $0 | ${INSTTYPE_6}

SectionSetInstTypes "${${EXT}}" $0

Pop $0

!macroend

!macro ChkWarning SECTION

SectionGetFlags ${SECTION} $0

IntOp $0 $0 & 1

IntOp $1 $0 || $1

!macroend

!macro ClearSection SECTION

Push $0

Push $1

SectionGetFlags ${SECTION} $0

IntOp $1 1 ~

IntOp $0 $0 & $1

SectionSetFlags ${SECTION} $0

SectionSetInstTypes ${SECTION} 0

SectionGetFlags ${SECTION} $0

IntOp $0 $0 | 8

SectionSetFlags ${SECTION} $0

Pop $1

Pop $0

!macroend

!macro DumpReg FIELD KEY

!define Line ${__LINE__}

ReadINIStr $1 ${ioD} "${FIELD}" State

StrCmp $1 1 0 end_${Line}

IfFileExists $0 exist_${Line}

nsExec::Exec 'regedit /e "$0" "${KEY}"'

Goto end_${Line}

exist_${Line}:

nsExec::Exec 'regedit /e "$PLUGINSDIRtemp.reg" "${KEY}"'

Push "$PLUGINSDIRtemp.reg"

Push $0

Call CopyText

Delete "$PLUGINSDIRtemp.reg"

end_${Line}:

!undef Line

!macroend

;----------------------------------------------------------------------------------------

Function GetEXEFile

Push $R0

Push $R1

;读取自定义的文件名

ReadINIStr $R0 ${ioA} "${FIELD_SETASSOC}" State

ReadINIStr $R1 ${ioA} "${FIELD_ASSOC}" State

IntOp $R1 $R0 && $R1

StrCmp $R1 1 0 end

ReadINIStr $R0 ${ioA} "${FIELD_APP}" State

IfFileExists "$EXEDIR$R0" 0 +3

StrCpy $R0 "$EXEDIR$R0"

Goto end

IfFileExists $R0 end

Push $R0

Call ChangeVar

Pop $R0

end:

Pop $R1

Exch $R0

FunctionEnd

Function CopyText

Exch $R0 ;目标

Exch

Exch $R1 ;源

Push $R2 ;源文件句柄

Push $R3 ;目标文件句柄

Push $R4 ;临时

Push $R5 ;临时

StrCpy $R5 0

FileOpen $R2 $R1 r

FileOpen $R3 $R0 a

FileReadByte $R2 $R4

StrCmp $R4 "" eof

FileReadByte $R2 $R5

StrCmp $R5 "" eof

StrCpy $R4 $R4$R5

StrCmp $R4 255254 +3

StrCpy $R4 12

Goto +2

StrCpy $R4 82

FileSeek $R2 $R4

FileReadByte $R2 $R4

StrCmp $R4 "" eof

FileSeek $R3 0 END

FileWriteByte $R3 $R4

Goto -4

eof:

FileClose $R3

FileClose $R2

Pop $R5

Pop $R4

Pop $R3

Pop $R2

Pop $R1

Pop $R0

FunctionEnd

;----------------------------------------------------------------------------------------

Function GetCurrentTime

Push $R0

Push $R1

Push $R2

System::Call '*(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) i .R0'

System::Call 'kernel32::GetLocalTime(i) i(R0)'

System::Call '*$R0(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2)(,.R0,,,,,,)'

StrCpy $R1 $R0

System::Call '*(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) i .R0'

System::Call 'kernel32::GetLocalTime(i) i(R0)'

System::Call '*$R0(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2)(,,,.R0,,,,)'

StrCpy $R1 $R1$R0

System::Call '*(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) i .R0'

System::Call 'kernel32::GetLocalTime(i) i(R0)'

System::Call '*$R0(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2)(,,,,.R0,,,)'

StrCpy $R1 $R1$R0

System::Call '*(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) i .R0'

System::Call 'kernel32::GetLocalTime(i) i(R0)'

System::Call '*$R0(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2)(,,,,,.R0,,)'

StrCpy $R1 $R1$R0

System::Call '*(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) i .R0'

System::Call 'kernel32::GetLocalTime(i) i(R0)'

System::Call '*$R0(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2)(,,,,,,.R0,)'

StrCpy $R0 $R1$R0

Pop $R2

Pop $R1

Exch $R0

FunctionEnd

;----------------------------------------------------------------------------------------

Function UnRegWinDVD

ClearErrors

ReadRegStr $0 HKLM SOFTWAREInterVideoDVD6 Path

SetOutPath $0

UnRegDLL $0MP4VDEC.ax

Push $0

Call GetParent

Pop $0

SetOutPath $0CommonBin

UnRegDLL $0CommonBinMP4VDEC.ax

IfErrors +2

MessageBox MB_OK|MB_ICONINFORMATION "反注册成功"

FunctionEnd

;----------------------------------------------------------------------------------------

Function GetParent

Exch $R0

Push $R1

Push $R2

Push $R3

StrCpy $R1 1

StrLen $R2 $R0

loop:

StrCpy $R3 $R0 1 -$R1

StrCmp $R3 "" loop_quit

IntCmp $R1 $R2 loop_quit 0 loop_quit

IntOp $R1 $R1 + 1

Goto loop

loop_quit:

IntOp $R1 $R2 - $R1

StrCpy $R0 $R0 $R1

Pop $R3

Pop $R2

Pop $R1

Exch $R0

FunctionEnd

;----------------------------------------------------------------------------------------

Function GetFileName

Exch $R0

Push $R1

Push $R2

Push $R3

StrCpy $R1 1

StrLen $R2 $R0

loop:

StrCpy $R3 $R0 1 -$R1

StrCmp $R3 "" loop_quit

IntCmp $R1 $R2 loop_quit 0 loop_quit

IntOp $R1 $R1 + 1

Goto loop

loop_quit:

IntOp $R1 $R1 - 1

StrCpy $R0 $R0 "" -$R1

Pop $R3

Pop $R2

Pop $R1

Exch $R0

FunctionEnd

;----------------------------------------------------------------------------------------

Function GetBandwidthListItems

Exch $R0

StrCmp $R0 28800 0 +3

StrCpy $R0 1

Goto end

StrCmp $R0 33600 0 +3

StrCpy $R0 2

Goto end

StrCmp $R0 57600 0 +3

StrCpy $R0 3

Goto end

StrCmp $R0 65536 0 +3

StrCpy $R0 4

Goto end

StrCmp $R0 115200 0 +3

StrCpy $R0 5

Goto end

StrCmp $R0 262200 0 +3

StrCpy $R0 6

Goto end

StrCmp $R0 393216 0 +3

StrCpy $R0 7

Goto end

StrCmp $R0 524300 0 +3

StrCpy $R0 8

Goto end

StrCmp $R0 786432 0 +3

StrCpy $R0 9

Goto end

StrCmp $R0 1544000 0 +3

StrCpy $R0 10

Goto end

StrCmp $R0 10485800 0 +3

StrCpy $R0 11

Goto end

StrCpy $R0 11

end:

Exch $R0

FunctionEnd

;----------------------------------------------------------------------------------------

Function GetBandwidth

Exch $R0

StrCmp $R0 1 0 +3

StrCpy $R0 28800

Goto end

StrCmp $R0 2 0 +3

StrCpy $R0 33600

Goto end

StrCmp $R0 3 0 +3

StrCpy $R0 57600

Goto end

StrCmp $R0 4 0 +3

StrCpy $R0 65536

Goto end

StrCmp $R0 5 0 +3

StrCpy $R0 115200

Goto end

StrCmp $R0 6 0 +3

StrCpy $R0 262200

Goto end

StrCmp $R0 7 0 +3

StrCpy $R0 393216

Goto end

StrCmp $R0 8 0 +3

StrCpy $R0 524300

Goto end

StrCmp $R0 9 0 +3

StrCpy $R0 786432

Goto end

StrCmp $R0 10 0 +3

StrCpy $R0 1544000

Goto end

StrCmp $R0 11 0 +3

StrCpy $R0 10485800

Goto end

end:

Exch $R0

FunctionEnd

;----------------------------------------------------------------------------------------

Function GetParameters

Push $R0

Push $R1

Push $R2

Push $R3

Push $R4

StrCpy $R0 "$CMDLINE/"

StrCpy $R1 0

StrLen $R3 $R0

loop:

StrCpy $R2 $R0 1 $R1

StrCmp $R2 '/' loop_quit

IntCmp $R1 $R3 the_end

IntOp $R1 $R1 + 1

Goto loop

loop_quit:

StrCpy $R4 $R1

IntOp $R4 $R4 + 1

loop2:

StrCpy $R2 $R0 1 $R4

StrCmp $R2 '/' loop2_quit

IntCmp $R4 $R3 the_end

IntOp $R4 $R4 + 1

Goto loop2

loop2_quit:

IntOp $R2 $R4 - $R1

StrCpy $R2 $R0 $R2 $R1

StrCpy $R1 $R4

;检测参数后面是否有空格

cut:

StrCpy $R4 $R2 "" -1

StrCmp $R4 " " 0 cut_end

StrCpy $R2 $R2 -1

Goto cut

cut_end:

;中间禁止使用 $R1

StrCmp $R2 '/fast' fast

StrCmp $R2 '/u' uninst

StrCmp $R2 '/?' help

StrCmp $R2 '/help' help

Goto cout

fast:

StrCpy $FAST 1

WriteINIStr "${ioA}" "${FIELD_SETASSOC}" State 1

Goto cout

uninst:

WriteINIStr "${ioA}" "${FIELD_SETASSOC}" State 1

WriteINIStr "${ioA}" "${FIELD_ASSOC}" State 0

WriteINIStr "${ioA}" "${FIELD_UNASSOC}" State 1

Goto cout

help:

MessageBox MB_OK|MB_ICONINFORMATION '有效参数:$r$n$r$n/fast$t$t跳过欢迎界面快速启动$r$n/u$t$t卸载$r$n/S$t$t静默运行(NSIS 固有)$r$n$r$n/? /help$t$t显示命令行的帮助(本对话框)   '

Quit

cout:

StrCpy $R4 $R1

IntOp $R4 $R4 + 1

Goto loop2

the_end:

Pop $R4

Pop $R3

Pop $R2

Pop $R1

Pop $R0

FunctionEnd

; ------------------------------------------------------------------------------------------

Function ChkRM

Push $R0

IfFileExists "$SYSDIRpncrt.dll" 0 no_real

IfFileExists "$SYSDIRpndx5016.dll" 0 no_real

IfFileExists "$SYSDIRpndx5032.dll" 0 no_real

IfFileExists "$SYSDIRrmoc3260.dll" 0 no_real

IfFileExists "$COMMONFILESRealCodecs" 0 no_real

IfFileExists "$COMMONFILESRealCommon" 0 no_real

IfFileExists "$COMMONFILESRealPlugins" 0 no_real

ReadRegStr $R0 HKCR "SoftwareRealNetworksPreferencesDT_Codecs" ""

StrCmp $R0 "" no_real

ReadRegStr $R0 HKCR "SoftwareRealNetworksPreferencesDT_Common" ""

StrCmp $R0 "" no_real

ReadRegStr $R0 HKCR "SoftwareRealNetworksPreferencesDT_Plugins" ""

StrCmp $R0 "" no_real

Goto +3

no_real:

StrCpy $R0 0

Goto +2

StrCpy $R0 1

Exch $R0

FunctionEnd

; ------------------------------------------------------------------------------------------

Function DoReg

Exch $R2     ;关键字

Exch

Exch $R1     ;文件类型描述

Exch 2

Exch $R0     ;扩展名

Push $R3

WriteRegStr HKCR mplayerc.file "" "MPC 关联文件"

ReadRegStr $R3 HKCR ".$R0" ""   ;写入备份

StrCpy $R4 $R3 8

StrCmp $R4 "mplayerc" +2

WriteRegStr HKCR "mplayerc.file" "$R0" "$R3"

DeleteRegKey HKCU "SoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.$R0"

WriteRegStr HKCR ".$R0" "" "mplayerc.$R0"     ;文件关联写入注册表

WriteRegStr HKCR mplayerc.$R0 "" "$R1"

WriteRegStr HKCR mplayerc.$R0DefaultIcon "" "$EXEFILE"

WriteRegStr HKCR mplayerc.$R0shell "" open

WriteRegStr HKCR mplayerc.$R0shellopencommand "" '"$EXEFILE" "%1"'

StrLen $R4 $EXEFILE

IntOp $R4 $R4 - 12

StrCpy $R4 $EXEFILE "" $R4

StrCmp $R4 mplayerc.exe +3

WriteRegStr HKCR mplayerc.$R0shellopen "" "播放(&P)"

Goto +4

WriteRegStr HKCR mplayerc.$R0shellopen "" "用 Media Player Classic 播放"

WriteRegStr HKCR mplayerc.$R0shellplay_enqueue "" "加入 Media Player Classic 队列"

WriteRegStr HKCR mplayerc.$R0shellplay_enqueuecommand "" '"$EXEFILE" /open /add "%1"'

ReadINIStr $R4 "$EXEDIRmpcassoc.txt" Icon $R2     ;检测是否有自定义图标

StrCmp $R4 "" custom_end

Push $R4

Call ChangeVar

Pop $R4

Push $R4

StrLen $R3 $R4

StrCpy $R1 0

loop:        ;检测是否有索引

StrCpy $R2 $R4 1 $R1

StrCmp $R2 '?' have_index

IntOp $R1 $R1 + 1

IntCmp $R1 $R3 no_index

Goto loop

no_index:

SearchPath $R4 $R4   ;检测文件的正确性

StrCmp $R4 "" custom_end

WriteRegStr HKCR mplayerc.$R0DefaultIcon "" "$R4"

Goto custom_end

have_index:

StrCpy $R2 $R4 $R1

IntOp $R1 $R1 + 1

StrCpy $R3 $R4 "" $R1

SearchPath $R2 $R2    ;检测文件的正确性

StrCmp $R2 "" custom_end

WriteRegStr HKCR mplayerc.$R0DefaultIcon "" "$R2,$R3"

custom_end:

Pop $R4

Pop $R3

Pop $R0

Pop $R1

Pop $R2

FunctionEnd

; --------------------------------------

Function ChangeVar     ;把 $........$ 之间代表的变量转换为实际值

Exch $R0

Push $R1

Push $R2

Push $R3

Push $R4

Push $R5

StrCpy $R1 0

StrLen $R5 $R0

loop:

StrCpy $R3 $R0 1 $R1

StrCmp $R3 $$ loop_quit

IntCmp $R1 $R5 no_var

IntOp $R1 $R1 + 1

Goto loop

loop_quit:

StrCpy $R2 $R1

IntOp $R2 $R2 + 1

loop2:

StrCpy $R3 $R0 1 $R2

StrCmp $R3 $$ loop2_quit

IntCmp $R2 $R5 error

IntOp $R2 $R2 + 1

Goto loop2

error:

MessageBox MB_OK|MB_ICONSTOP "变量语法错误"

Quit

loop2_quit:

IntOp $R4 $R2 - $R1

IntOp $R1 $R1 + 1

IntOp $R4 $R4 - 1

StrCpy $R5 $R0 $R4 $R1

StrCmp $R5 PROGRAMFILES 0 +3

StrCpy $R5 "$PROGRAMFILES"

Goto var_end

StrCmp $R5 COMMONFILES 0 +3

StrCpy $R5 "$COMMONFILES"

Goto var_end

StrCmp $R5 DESKTOP 0 +3

StrCpy $R5 "$DESKTOP"

Goto var_end

StrCmp $R5 WINDIR 0 +3

StrCpy $R5 "$WINDIR"

Goto var_end

StrCmp $R5 SYSDIR 0 +3

StrCpy $R5 "$SYSDIR"

Goto var_end

StrCmp $R5 TEMP 0 +3

StrCpy $R5 "$TEMP"

Goto var_end

StrCmp $R5 STARTMENU 0 +3

StrCpy $R5 "$STARTMENU"

Goto var_end

StrCmp $R5 SMPROGRAMS 0 +3

StrCpy $R5 "$SMPROGRAMS"

Goto var_end

StrCmp $R5 SMSTARTUP 0 +3

StrCpy $R5 "$SMSTARTUP"

Goto var_end

StrCmp $R5 QUICKLAUNCH 0 +3

StrCpy $R5 "$QUICKLAUNCH"

Goto var_end

StrCmp $R5 DOCUMENTS 0 +3

StrCpy $R5 "$DOCUMENTS"

Goto var_end

StrCmp $R5 SENDTO 0 +3

StrCpy $R5 "$SENDTO"

Goto var_end

StrCmp $R5 RECENT 0 +3

StrCpy $R5 "$RECENT"

Goto var_end

StrCmp $R5 RECENT 0 +3

StrCpy $R5 "$RECENT"

Goto var_end

StrCmp $R5 FAVORITES 0 +3

StrCpy $R5 "$FAVORITES"

Goto var_end

StrCmp $R5 MUSIC 0 +3

StrCpy $R5 "$MUSIC"

Goto var_end

StrCmp $R5 PICTURES 0 +3

StrCpy $R5 "$PICTURES"

Goto var_end

StrCmp $R5 VIDEOS 0 +3

StrCpy $R5 "$VIDEOS"

Goto var_end

StrCmp $R5 NETHOOD 0 +3

StrCpy $R5 "$NETHOOD"

Goto var_end

StrCmp $R5 FONTS 0 +3

StrCpy $R5 "$FONTS"

Goto var_end

StrCmp $R5 TEMPLATES 0 +3

StrCpy $R5 "$TEMPLATES"

Goto var_end

StrCmp $R5 APPDATA 0 +3

StrCpy $R5 "$APPDATA"

Goto var_end

StrCmp $R5 PRINTHOOD 0 +3

StrCpy $R5 "$PRINTHOOD"

Goto var_end

StrCmp $R5 INTERNET_CACHE 0 +3

StrCpy $R5 "$INTERNET_CACHE"

Goto var_end

StrCmp $R5 COOKIES 0 +3

StrCpy $R5 "$COOKIES"

Goto var_end

StrCmp $R5 HISTORY 0 +3

StrCpy $R5 "$HISTORY"

Goto var_end

StrCmp $R5 PROFILE 0 +3

StrCpy $R5 "$PROFILE"

Goto var_end

StrCmp $R5 ADMINTOOLS 0 +3

StrCpy $R5 "$ADMINTOOLS"

Goto var_end

StrCmp $R5 RESOURCES 0 +3

StrCpy $R5 "$RESOURCES"

Goto var_end

StrCmp $R5 RESOURCES_LOCALIZED 0 +3

StrCpy $R5 "$RESOURCES_LOCALIZED"

Goto var_end

StrCmp $R5 CDBURN_AREA 0 +3

StrCpy $R5 "$CDBURN_AREA"

Goto var_end

StrCmp $R5 HWNDPARENT 0 +3

StrCpy $R5 "$HWNDPARENT"

var_end:

IntOp $R1 $R1 - 1

StrCpy $R3 $R0 $R1

IntOp $R2 $R2 + 1

StrCpy $R4 $R0 "" $R2

StrCpy $R0 "$R3$R5$R4"

no_var:

Pop $R5

Pop $R4

Pop $R3

Pop $R2

Pop $R1

Exch $R0

FunctionEnd

; --------------------------------------

Function RefreshShellIcons

System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)'

FunctionEnd

; --------------------------------------

InstType "推荐关联格式"

InstType "所有视频格式"

InstType "所有音频格式"

InstType "所有文件格式"

InstType "不关联任何文件"

InstType "以前安装的组件"

Section "-first" first

SetDetailsPrint none

;不选设置文件关联时清除 ${first} 到 ${post} 之间的区段

ReadINIStr $0 ${ioA} "${FIELD_SETASSOC}" State

StrCmp $0 1 +3

Call ClearSection

Goto end

;卸载时

ReadINIStr $0 ${ioA} "${FIELD_UNASSOC}" State

StrCmp $0 1 0 +5

Call ClearSection

Call Restore

Call RefreshShellIcons

Goto end

;文件关联时

ReadINIStr $0 ${ioA} "${FIELD_ASSOC}" State

StrCmp $0 1 0 end

StrCmp $EXEFILE "" 0 end

Call GetEXEFile

Pop $0

;判断是否存在 $EXEFILE

IfFileExists $0 +3

MessageBox MB_OK|MB_ICONEXCLAMATION "没有找到要关联的应用程序。"

Quit

#StrCpy $EXEFILE $0

end:

SectionEnd

Section "视频剪辑(AVI)" avi

SectionIn 1 2 4

!insertmacro assoc avi "视频剪辑" AVI

SectionEnd

SubSection "电影剪辑"

Section ".mpg" mpg

SectionIn 2 4

!insertmacro assoc mpg "电影剪辑(MPG)" MPEG

SectionEnd

Section ".mpeg" mpeg

SectionIn 2 4

!insertmacro assoc mpeg "电影剪辑(MPEG)" MPEG

SectionEnd

Section ".mpe" mpe

SectionIn 2 4

!insertmacro assoc mpe "电影剪辑(MPE)" MPEG

SectionEnd

Section ".m1v" m1v

SectionIn 2 4

!insertmacro assoc m1v "电影剪辑(M1V)" MPEG

SectionEnd

Section ".m2v" m2v

SectionIn 2 4

!insertmacro assoc m2v "电影剪辑(M2V)" MPEG

SectionEnd

Section ".mpv2" mpv2

SectionIn 2 4

!insertmacro assoc mpv2 "电影剪辑(MPV2)" MPEG

SectionEnd

Section ".mp2v" mp2v

SectionIn 2 4

!insertmacro assoc mp2v "电影剪辑(MP2V)" MPEG

SectionEnd

Section ".dat" dat

SectionIn 2 4

!insertmacro assoc dat "电影剪辑(DAT)" MPEG

WriteRegStr HKCR mplayerc.dat AlwaysShowExt ""

SectionEnd

SubSectionEnd

SubSection "QuickTime" sub_qt

Section ".mov" mov

SectionIn 1 2 4

!insertmacro assoc mov "QuickTime 影片(MOV)" QuickTime

SectionEnd

Section ".qt" qt

SectionIn 1 2 4

!insertmacro assoc qt "QuickTime 影片(QT)" QuickTime

SectionEnd

Section ".3gp" 3gp

SectionIn 1 2 3 4

!insertmacro assoc 3gp "手机视频(3GP)" QuickTime

SectionEnd

Section ".3gpp" 3gpp

SectionIn 1 2 3 4

!insertmacro assoc 3gpp "手机视频(3GPP)" QuickTime

SectionEnd

Section ".3g2" 3g2

SectionIn 1 2 3 4

!insertmacro assoc 3g2 "手机视频(3G2)" QuickTime

SectionEnd

Section ".3gp2" 3gp2

SectionIn 1 2 3 4

!insertmacro assoc 3gp2 "手机视频(3GP2)" QuickTime

SectionEnd

Section ".amr" amr  ;Adaptive Multi-Rate

SectionIn 1 3 4

!insertmacro assoc amr "多位率自适应音频(AMR)" QuickTime

SectionEnd

SubSectionEnd

SubSection "Real 脚本" sub_rt

Section ".rt" rt

SectionIn 1 2 4

!insertmacro assoc rt "RealText、RealText 3D" Real

WriteRegDWORD HKCR "mplayerc.rt" EditFlags 65536

SectionEnd

Section ".rp" rp

SectionIn 1 2 4

!insertmacro assoc rp "RealPix" Real

WriteRegDWORD HKCR "mplayerc.rp" EditFlags 65536

SectionEnd

Section ".smi" smi

SectionIn 1 2 4

!insertmacro assoc smi "SMIL 多媒体演示" Real

WriteRegDWORD HKCR "mplayerc.smi" EditFlags 65536

SectionEnd

Section ".smil" smil

SectionIn 1 2 4

!insertmacro assoc smil "SMIL 多媒体演示" Real

WriteRegDWORD HKCR "mplayerc.smil" EditFlags 65536

SectionEnd

Section ".sdp" sdp

SectionIn 1 2 4

!insertmacro assoc sdp "Real 脚本文件(SDP)" Real

WriteRegDWORD HKCR "mplayerc.sdp" EditFlags 65536

SectionEnd

Section ".ssm" ssm

SectionIn 1 2 4

!insertmacro assoc ssm "Real 脚本文件(SSM)" Real

WriteRegDWORD HKCR "mplayerc.ssm" EditFlags 65536

SectionEnd

SubSectionEnd

SubSection "Real 媒体" sub_rm

Section ".rm" rm

SectionIn 1 2 4

!insertmacro assoc rm "RealMedia" Real

SectionEnd

Section ".ram" ram

SectionIn 1 2 4

!insertmacro assoc ram "RealPlayer 演示" Real

WriteRegDWORD HKCR "mplayerc.ram" EditFlags 65536

SectionEnd

Section ".rmvb" rmvb

SectionIn 1 2 4

!insertmacro assoc rmvb "RealVideo VBR" Real

SectionEnd

Section ".rpm" rpm

SectionIn 1 2 4

!insertmacro assoc rpm "Real 媒体(RPM)" Real

SectionEnd

Section ".rmx" rmx

SectionIn 1 2 4

!insertmacro assoc rmx "Real 媒体(RMX)" Real

SectionEnd

SubSectionEnd

SubSection "Real 音频" sub_ra

Section ".ra" ra

SectionIn 1 3 4

!insertmacro assoc ra "RealAudio" Real

SectionEnd

SubSectionEnd

SubSection "DVD 文件"

Section ".vob" vob

SectionIn 1 2 4

!insertmacro assoc vob "DVD 文件(VOB)" DVD

SectionEnd

Section ".ifo" ifo

SectionIn 2 4

!insertmacro assoc ifo "DVD 文件(IFO)" DVD

SectionEnd

SubSectionEnd

Section "Matroska 媒体文件" mkv

SectionIn 1 2 4

!insertmacro assoc mkv "Matroska 媒体" MKV

SectionEnd

Section "MPEG-4 媒体文件" mp4

SectionIn 1 2 4

!insertmacro assoc mp4 "MPEG-4 媒体" MP4

SectionEnd

Section "Ogg 媒体文件" ogm

SectionIn 1 2 4

!insertmacro assoc ogm "Ogg 媒体" OGM

SectionEnd

Section "RoQ 媒体文件" roq

SectionIn 1 2 4

!insertmacro assoc roq "RoQ 媒体" RoQ

SectionEnd

Section "VP6 影片" vp6

SectionIn 1 2 4

!insertmacro assoc vp6 "VP6 影片" VP6

SectionEnd

Section "XVD 视频" vg2

SectionIn 1 2 4

!insertmacro assoc vg2 "XVD 视频" XVD

SectionEnd

Section "Shockwave Flash" swf

SectionIn 2 4

!insertmacro assoc swf "Shockwave Flash" SWF

SectionEnd

SubSection "Windows 媒体文件"

Section ".wmv" wmv

SectionIn 2 4

!insertmacro assoc wmv "Windows 媒体文件(WMV)" WMV

SectionEnd

Section ".wmp" wmp

SectionIn 2 4

!insertmacro assoc wmp "Windows 媒体文件(WMP)" WMV

SectionEnd

Section ".wm" wm

SectionIn 2 4

!insertmacro assoc wm "Windows 媒体文件(WM)" WMV

SectionEnd

Section ".asf" asf

SectionIn 2 4

!insertmacro assoc asf "Windows 媒体文件(ASF)" WMV

SectionEnd

SubSectionEnd

Section "DVD2AVI 工程文件(d2v)" d2v

SectionIn 1 2 4

!insertmacro assoc d2v "DVD2AVI 工程文件" D2V

SectionEnd

SubSection "Autodesk FLIC 动画"

Section ".fli" fli

SectionIn 1 2 4

!insertmacro assoc fli "Autodesk FLIC 动画(FLI)" FLIC

SectionEnd

Section ".flc" flc

SectionIn 1 2 4

!insertmacro assoc flc "Autodesk FLIC 动画(FLC)" FLIC

SectionEnd

Section ".flic" flic

SectionIn 1 2 4

!insertmacro assoc flic "Autodesk FLIC 动画(FLIC)" FLIC

SectionEnd

SubSectionEnd

Section "Indeo 视频文件(ivf)" ivf

SectionIn 1 2 4

!insertmacro assoc ivf "Indeo 视频文件" IVF

SectionEnd

Section "Divx Player 文件(divx)" divx

SectionIn 2 4

!insertmacro assoc divx "视频文件(DIVX)" DivX

SectionEnd

SubSection "AIFF 音乐格式"

Section ".aif" aif

SectionIn 3 4

!insertmacro assoc aif "音频文件(AIF)" Audio

SectionEnd

Section ".aifc" aifc

SectionIn 3 4

!insertmacro assoc aifc "音频文件(AIFC)" Audio

SectionEnd

Section ".aiff" aiff

SectionIn 3 4

!insertmacro assoc aiff "音频文件(AIFF)" Audio

SectionEnd

SubSectionEnd

SubSection "AU 音乐格式"

Section ".au" au

SectionIn 3 4

!insertmacro assoc au "音频文件(AU)" Audio

SectionEnd

Section ".snd" snd

SectionIn 3 4

!insertmacro assoc snd "音频文件(SND)" Audio

SectionEnd

SubSectionEnd

SubSection "DVD 音频文件"

Section ".ac3" ac3

SectionIn 3 4

!insertmacro assoc ac3 "DVD 音频(AC3)" DVDA

SectionEnd

Section ".dts" dts

SectionIn 3 4

!insertmacro assoc dts "DVD 音频(DTS)" DVDA

SectionEnd

SubSectionEnd

SubSection "FLAC 音频文件" sub_flac

Section ".flac" flac

SectionIn 3 4

!insertmacro assoc flac "FLAC 音频文件" Lossless

SectionEnd

Section ".fla" fla

SectionIn 3 4

!insertmacro assoc fla "FLAC 音频文件" Lossless

SectionEnd

SubSectionEnd

SubSection "Monkey's Audio" sub_ape

Section ".ape" ape

SectionIn 3 4

!insertmacro assoc ape "Monkey‘s Audio" Lossless

SectionEnd

Section ".mac" mac

SectionIn 3 4

!insertmacro assoc mac "Monkey‘s Audio" Lossless

SectionEnd

Section ".apl" apl

SectionIn 3 4

!insertmacro assoc apl "Monkey’s Audio 链接文件" Lossless

SectionEnd

SubSectionEnd

Section "TTA" tta

SectionIn 3 4

!insertmacro assoc tta "TTA 音频文件" Lossless

SectionEnd

Section "Matroska 音频文件" mka

SectionIn 1 3 4

!insertmacro assoc mka "Matroska 音频文件" Audio

SectionEnd

SubSection "MIDI 文件"

Section ".mid" mid

SectionIn 3 4

!insertmacro assoc mid "MIDI 文件" Audio

SectionEnd

Section ".midi" midi

SectionIn 3 4

!insertmacro assoc midi "MIDI 文件" Audio

SectionEnd

Section ".rmi" rmi

SectionIn 3 4

!insertmacro assoc rmi "MIDI 文件" Audio

SectionEnd

SubSectionEnd

Section "MP3 音乐格式" mp3

SectionIn 3 4

!insertmacro assoc mp3 "MP3 音乐格式" Audio

SectionEnd

SubSection "MPEG4 音频文件"

Section ".aac" aac

SectionIn 3 4

!insertmacro assoc aac "MPEG4 音频(AAC)" Audio

SectionEnd

Section ".m4a" m4a

SectionIn 3 4

!insertmacro assoc m4a "MPEG4 音频(M4A)" Audio

SectionEnd

SubSectionEnd

SubSection "Musepack 音频文件"

Section ".mpc" mpc

SectionIn 3 4

!insertmacro assoc mpc "Musepack 音频文件(MPC)" Audio

SectionEnd

Section ".mp+" mp+

SectionIn 3 4

!insertmacro assoc mp+ "Musepack 音频文件(MP+)" Audio

SectionEnd

Section ".mpp" mpp

SectionIn 3 4

!insertmacro assoc mpp "Musepack 音频文件(MPP)" Audio

SectionEnd

SubSectionEnd

Section "Ogg Vorbis 音频文件" ogg

SectionIn 3 4

!insertmacro assoc ogg "Ogg Vorbis 音频" Audio

SectionEnd

Section "Windows 媒体音频文件(wma)" wma

SectionIn 3 4

!insertmacro assoc wma "Windows 媒体音频" WMA

SectionEnd

Section "波形文件" wav

SectionIn 3 4

!insertmacro assoc wav "波形文件" Audio

SectionEnd

SubSection "影片音频文件(MPEG)"

Section ".mpa" mpa

SectionIn 3 4

!insertmacro assoc mpa "影片音频文件(MPA)" Audio

SectionEnd

Section ".mp2" mp2

SectionIn 3 4

!insertmacro assoc mp2 "影片音频文件(MP2)" Audio

SectionEnd

Section ".m1a" m1a

SectionIn 3 4

!insertmacro assoc m1a "影片音频文件(M1A)" Audio

SectionEnd

Section ".m2a" m2a

SectionIn 3 4

!insertmacro assoc m2a "影片音频文件(M2A)" Audio

SectionEnd

SubSectionEnd

Section "音频 CD" cda

SectionIn 3 4

!insertmacro assoc cda "CD 音轨" CD

SectionEnd

SubSection "播放列表文件"

Section ".asx" asx

SectionIn 4

!insertmacro assoc asx "播放列表文件(ASX)" PlayList

WriteRegDWORD HKCR "mplayerc.asx" EditFlags 65536

SectionEnd

Section ".m3u" m3u

SectionIn 4

!insertmacro assoc m3u "播放列表文件(M3U)" PlayList

WriteRegDWORD HKCR "mplayerc.m3u" EditFlags 65536

SectionEnd

Section ".pls" pls

SectionIn 4

!insertmacro assoc pls "播放列表文件(PLS)" PlayList

WriteRegDWORD HKCR "mplayerc.pls" EditFlags 65536

SectionEnd

Section ".wvx" wvx

SectionIn 4

!insertmacro assoc wvx "播放列表文件(WVX)" PlayList

WriteRegDWORD HKCR "mplayerc.wvx" EditFlags 65536

SectionEnd

Section ".wax" wax

SectionIn 4

!insertmacro assoc wax "播放列表文件(WAX)" PlayList

WriteRegDWORD HKCR "mplayerc.wax" EditFlags 65536

SectionEnd

Section ".wmx" wmx

SectionIn 4

!insertmacro assoc wmx "播放列表文件(WMX)" PlayList

WriteRegDWORD HKCR "mplayerc.wmx" EditFlags 65536

SectionEnd

SubSectionEnd

Section "流媒体协议 mms://" mms

ReadRegStr $0 HKCR "MMSshellopencommand" ""

WriteRegStr HKCR "mplayerc.fileProtocol" "MMS" "$0"

WriteRegStr HKCR "MMSshellopencommand" "" '"$EXEFILE" "%L"'

SectionEnd

Section "实时流协议(rtsp://)" rtsp

ReadRegStr $0 HKCR "rtspshellopencommand" ""

WriteRegStr HKCR "mplayerc.fileProtocol" "rtsp" "$0"

WriteRegStr HKCR "rtspshellopencommand" "" '"$EXEFILE" "%L"'

SectionEnd

Section "RealNetworks 流协议(pnm://)" pnm

ReadRegStr $0 HKCR "pnmshellopencommand" ""

WriteRegStr HKCR "mplayerc.fileProtocol" "pnm" "$0"

WriteRegStr HKCR "pnmshellopencommand" "" '"$EXEFILE" "%L"'

SectionEnd

Section "-post" post

Push $EXEFILE

Call GetParent

Pop $0

Push $EXEFILE

Call GetFileName

Pop $1

WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionApp Paths$1" "" "$0$1"

WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionApp Paths$1" Path $0

ReadINIStr $0 ${ioA} "${FIELD_APP}" State

WriteRegStr ${G_EXE_KEY} ExeFile $0

;备份个人设置

;------------------------

ReadINIStr $0 ${ioA} "${FIELD_BAK}" State

StrCmp $0 1 0 bak_end

ReadINIStr $0 ${ioD} "Field 6" State

Call GetCurrentTime

Pop $1

StrCpy $0 "$0MpcBak$1.reg"

IfFileExists $0 0 +2

Delete $0

!insertmacro DumpReg "Field 1" "HKEY_CURRENT_USERSoftwareGabestMedia Player Classic"

!insertmacro DumpReg "Field 2" "HKEY_CURRENT_USERSoftwareGabestvsfilter"

!insertmacro DumpReg "Field 3" "HKEY_LOCAL_MACHINESOFTWAREGNUffdshow"

!insertmacro DumpReg "Field 3" "HKEY_LOCAL_MACHINESOFTWAREGNUffdshow_audio"

!insertmacro DumpReg "Field 3" "HKEY_LOCAL_MACHINESOFTWAREGNUffdshow_enc"

!insertmacro DumpReg "Field 3" "HKEY_LOCAL_MACHINESOFTWAREGNUffdshow_vfw"

!insertmacro DumpReg "Field 3" "HKEY_CURRENT_USERSOFTWAREGNUffdshow"

!insertmacro DumpReg "Field 3" "HKEY_CURRENT_USERSOFTWAREGNUffdshow_audio"

!insertmacro DumpReg "Field 3" "HKEY_CURRENT_USERSOFTWAREGNUffdshow_enc"

!insertmacro DumpReg "Field 3" "HKEY_CURRENT_USERSOFTWAREGNUffdshow_vfw"

!insertmacro DumpReg "Field 4" "HKEY_CURRENT_USERSoftwareAC3Filter"

bak_end:

;------------------------

Call RefreshShellIcons

SectionEnd

; --------------------------------------

Function .onInit

System::Call 'kernel32::CreateMutexA(i 0, i 0, t "mpcassoc") i .r1 ?e'

Pop $0

StrCmp $0 0 +2

Quit

InitPluginsDir

File /oname=${ioA} .resourcempcassoc.ini

File /oname=${ioB} .resourcereal.ini

File /oname=${ioC} .resourcemp4.ini

File /oname=${ioD} .resourcebak.ini

;获取参数

Call GetParameters

;判断是否选择卸载

ReadINIStr $0 ${ioA} "${FIELD_UNASSOC}" State

StrCmp $0 1 the_end

ReadRegStr $0 HKCR "mplayerc.file" ""

StrCmp $0 "" skip

!insertmacro ChkPre 3g2

!insertmacro ChkPre 3gp

!insertmacro ChkPre 3gp2

!insertmacro ChkPre 3gpp

!insertmacro ChkPre aac

!insertmacro ChkPre ac3

!insertmacro ChkPre aif

!insertmacro ChkPre aifc

!insertmacro ChkPre aiff

!insertmacro ChkPre amr

!insertmacro ChkPre ape

!insertmacro ChkPre apl

!insertmacro ChkPre asf

!insertmacro ChkPre asx

!insertmacro ChkPre au

!insertmacro ChkPre avi

!insertmacro ChkPre cda

!insertmacro ChkPre d2v

!insertmacro ChkPre dat

!insertmacro ChkPre divx

!insertmacro ChkPre dts

!insertmacro ChkPre fla

!insertmacro ChkPre flac

!insertmacro ChkPre flc

!insertmacro ChkPre fli

!insertmacro ChkPre flic

!insertmacro ChkPre ifo

!insertmacro ChkPre ivf

!insertmacro ChkPre m1a

!insertmacro ChkPre m1v

!insertmacro ChkPre m2a

!insertmacro ChkPre m2v

!insertmacro ChkPre m3u

!insertmacro ChkPre m4a

!insertmacro ChkPre mac

!insertmacro ChkPre mid

!insertmacro ChkPre midi

!insertmacro ChkPre mka

!insertmacro ChkPre mkv

!insertmacro ChkPre mov

!insertmacro ChkPre mp+

!insertmacro ChkPre mp2

!insertmacro ChkPre mp2v

!insertmacro ChkPre mp3

!insertmacro ChkPre mp4

!insertmacro ChkPre mpa

!insertmacro ChkPre mpc

!insertmacro ChkPre mpe

!insertmacro ChkPre mpeg

!insertmacro ChkPre mpg

!insertmacro ChkPre mpp

!insertmacro ChkPre mpv2

!insertmacro ChkPre ogg

!insertmacro ChkPre ogm

!insertmacro ChkPre pls

!insertmacro ChkPre qt

!insertmacro ChkPre ra

!insertmacro ChkPre ram

!insertmacro ChkPre rm

!insertmacro ChkPre rmi

!insertmacro ChkPre rmvb

!insertmacro ChkPre rmx

!insertmacro ChkPre roq

!insertmacro ChkPre rp

!insertmacro ChkPre rpm

!insertmacro ChkPre rt

!insertmacro ChkPre sdp

!insertmacro ChkPre smi

!insertmacro ChkPre smil

!insertmacro ChkPre snd

!insertmacro ChkPre ssm

!insertmacro ChkPre swf

!insertmacro ChkPre vg2

!insertmacro ChkPre vob

!insertmacro ChkPre vp6

!insertmacro ChkPre wav

!insertmacro ChkPre wax

!insertmacro ChkPre wm

!insertmacro ChkPre wma

!insertmacro ChkPre wmp

!insertmacro ChkPre wmv

!insertmacro ChkPre wmx

!insertmacro ChkPre wvx

SetCurInstType 5

Goto no_skip

skip:

InstTypeSetText 5 ""

no_skip:

;检测是否有Real解码器

Call ChkRM

Pop $0

StrCmp $0 1 not_cr_rm_sec

!insertmacro ClearSection ${sub_rt}

!insertmacro ClearSection ${sub_rm}

!insertmacro ClearSection ${sub_ra}

!insertmacro ClearSection ${rm}

!insertmacro ClearSection ${rmvb}

!insertmacro ClearSection ${ram}

!insertmacro ClearSection ${rpm}

!insertmacro ClearSection ${rt}

!insertmacro ClearSection ${rp}

!insertmacro ClearSection ${smi}

!insertmacro ClearSection ${smil}

!insertmacro ClearSection ${ra}

!insertmacro ClearSection ${sdp}

!insertmacro ClearSection ${ssm}

!insertmacro ClearSection ${rmx}

SectionSetText ${sub_rt} "Real 脚本 (没有安装解码器)"

SectionSetText ${sub_rm} "Real 媒体 (没有安装解码器)"

SectionSetText ${sub_ra} "Real 音频 (没有安装解码器)"

SectionSetText ${rm} ".rm (没有安装解码器)"

SectionSetText ${rmvb} ".rmvb (没有安装解码器)"

SectionSetText ${ram} ".ram (没有安装解码器)"

SectionSetText ${rpm} ".rpm (没有安装解码器)"

SectionSetText ${rt} ".rt (没有安装解码器)"

SectionSetText ${rp} ".rp (没有安装解码器)"

SectionSetText ${smi} ".smi (没有安装解码器)"

SectionSetText ${smil} ".smil (没有安装解码器)"

SectionSetText ${ra} ".ra (没有安装解码器)"

SectionSetText ${sdp} ".sdp (没有安装解码器)"

SectionSetText ${ssm} ".ssm (没有安装解码器)"

SectionSetText ${rmx} ".rmx (没有安装解码器)"

not_cr_rm_sec:

;检测是否有QuickTime解码器

IfFileExists ".QuickTime.qts" not_cr_qt_sec

IfFileExists "$SYSDIRQuickTime.qts" not_cr_qt_sec

!insertmacro ClearSection ${sub_qt}

!insertmacro ClearSection ${mov}

!insertmacro ClearSection ${qt}

!insertmacro ClearSection ${3gp}

!insertmacro ClearSection ${3gpp}

!insertmacro ClearSection ${3g2}

!insertmacro ClearSection ${3gp2}

!insertmacro ClearSection ${amr}

SectionSetText ${sub_qt} "QuickTime (没有安装解码器)"

SectionSetText ${mov} ".mov (没有安装解码器)"

SectionSetText ${qt} ".qt (没有安装解码器)"

SectionSetText ${3gp} ".3gp (没有安装解码器)"

SectionSetText ${3gpp} ".3gpp (没有安装解码器)"

SectionSetText ${3g2} ".3g2 (没有安装解码器)"

SectionSetText ${3gp2} ".3gp2 (没有安装解码器)"

SectionSetText ${amr} ".amr (没有安装解码器)"

not_cr_qt_sec:

;检测是否有 Flash 控件

IfFileExists "$SYSDIRMacromedFlashFlash.ocx" not_cr_flash_sec

!insertmacro ClearSection ${swf}

SectionSetText ${swf} "Shockwave Flash (没有安装解码器)"

not_cr_flash_sec:

the_end:

ReadRegStr $0 ${G_EXE_KEY} ExeFile

StrCmp $0 "" +2

WriteINIStr ${ioA} "${FIELD_APP}" State $0

FunctionEnd

; -----------------------------------------------------------------------------------------

Function .onSelChange

SectionGetFlags ${mms} $R0

StrCmp $R0 0 0 +2

StrCpy $R9 0

StrCmp $R9 1 +4

StrCmp $R0 1 0 +3

StrCpy $R9 1

MessageBox MB_OK|MB_ICONEXCLAMATION  "MMS 的嵌套和加密现象很普遍,这些 MPC 都处理不了,请自行承担风险"

FunctionEnd

;-------------------------------------------------

Var HWND

;Windows Messages

#!define CB_GETCURSEL                0x0147

#!define CB_SETCURSEL                0x014E

#!define BM_GETSTATE 0x00F2

#!define BM_SETCHECK 0x00F1

Function SetCustom

StrCmp $FAST 1 0 +2

Abort

InstallOptionsEx::initDialog /NOUNLOAD ${ioA}

Pop $HWND

!insertmacro MUI_HEADER_TEXT "选择任务选项" "选择所需的任务,去掉不需要的任务"

;如果没有 Real 解码器,仅用 Real 设置项

Call ChkRM

Pop $0

StrCmp $0 1 +3

GetDlgItem $0 $HWND 1208

EnableWindow $0 0

;检测是否安装了 WInDVD 6

ReadRegStr $0 HKLM "SOFTWAREInterVideoDVD6" Path

StrCmp $0 "" 0 +3

GetDlgItem $0 $HWND 1209

EnableWindow $0 0

;如果没有 FFDShow 则禁用

IfFileExists "$SYSDIRffdshow.ax" +3

GetDlgItem $0 $HWND 1210

EnableWindow $0 0

;如果没有 AC3Filter 则禁用

IfFileExists "$SYSDIRac3filter.cpl" +3

GetDlgItem $0 $HWND 1211

EnableWindow $0 0

;如果没有 VSFilter 则禁用

IfFileExists "$EXEDIRCodecsvsfilter.dll" +4

IfFileExists "$SYSDIRvsfilter.dll" +3

GetDlgItem $0 $HWND 1212

EnableWindow $0 0

;是否启用了文件关联

ReadINIStr $R0 ${ioA} "${FIELD_SETASSOC}" State

StrCmp $R0 1 +2

StrCpy $R0 0

GetDlgItem $R1 $HWND 1201

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1202

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1203

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1204

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1214

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1215

EnableWindow $R1 $R0

InstallOptionsEx::show

FunctionEnd

; ------------------------------------------------------------------------------------------

Function LeaveCustom

ReadINIStr $0 ${ioA} "Settings" "State"

${Switch} $0

${Default}

Abort

${Case} 2

GetDlgItem $R1 $HWND 1215

EnableWindow $R1 1

Abort

${Case} 3

GetDlgItem $R1 $HWND 1215

EnableWindow $R1 0

Abort

${Case} 4

ExecShell open $EXEDIRmpcassoc.txt

Abort

${Case} 8

ReadINIStr $R0 ${ioA} "${FIELD_SETASSOC}" State

StrCmp $R0 1 +2

StrCpy $R0 0

GetDlgItem $R1 $HWND 1201

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1202

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1203

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1204

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1214

EnableWindow $R1 $R0

GetDlgItem $R1 $HWND 1215

EnableWindow $R1 $R0

Abort

${Case} 10

Call UnRegWinDVD

Abort

${Case} 11

Exec "rundll32 ffdshow.ax,configure"

Abort

${Case} 12

Exec "rundll32 shell32.dll,Control_RunDLL ac3filter.cpl"

Abort

${Case} 13

SetOutPath "$EXEDIRCodecs"

Exec "rundll32 vsfilter.dll,DirectVobSub"

Abort

${Case} 14

IfFileExists "$EXEDIRliveupdate.exe" 0 +5

CopyFiles /SILENT "$EXEDIRliveupdate.exe" "$TEMP"

Exec '"$TEMPliveupdate.exe" /storm /auto'

Sleep 500

Quit

Abort

${Case} 0

${EndSwitch}

;卸载时跳过

ReadINIStr $0 ${ioA} "${FIELD_ASSOC}" State

ReadINIStr $1 ${ioA} "${FIELD_SETASSOC}" State

IntOp $0 $0 && $1

StrCmp $0 1 0 end

Call GetEXEFile

Pop $R0

;判断是否存在 $EXEFILE

IfFileExists $R0 +3

MessageBox MB_OK|MB_ICONEXCLAMATION "没有找到要关联的应用程序。"

Abort

#StrCpy $EXEFILE $R0

end:

FunctionEnd

; -----------------------------------------------------------------------------------------

Function RealSetCustom

!ifdef DISABLE_PRE_BUTTON

;禁止上一步按钮

GetDlgItem $R0 $HWNDPARENT 3

ShowWindow $R0 0

!endif

;如果是最后一步则修改下一步按钮文本

ReadINIStr $R0 ${ioA} "${FIELD_MP4}" State

ReadINIStr $R1 ${ioA} "${FIELD_BAK}" State

IntOp $R0 $R0 || $R1

StrCmp $R0 1 +3

GetDlgItem $R0 $HWNDPARENT 1

SendMessage $R0 ${WM_SETTEXT} 0 "STR:确定"

;不选 Real 媒体设置时退出

ReadINIStr $R0 ${ioA} "${FIELD_REAL}" State

StrCmp $R0 1 +2

Abort

;没有 Real 解码器时退出

Call ChkRM

Pop $0

StrCmp $0 1 +2

Abort

;读取 Real 音量设置

ReadRegStr $0 HKCU "SoftwareRealNetworksRealMediaSDK10.0PreferencesVolume" ""

WriteINIStr ${ioB} "Field 5" State $0

;检测当前的 Real 视频渲染模式

ReadINIStr $0 $EXEDIRmplayerc.ini FileFormats "Real 媒体文件"

StrCmp $0 "" 0 +3

ReadRegStr $0 HKCU "SoftwareGabestMedia Player ClassicFileFormats" "Real 媒体文件"

StrCmp $0 "" render_setting_end

StrCpy $0 $0 1 -1

StrCmp $0 0 0 +4

WriteINIStr ${ioB} "${FIELD_ASSOC}" State 1

WriteINIStr ${ioB} "${FIELD_UNASSOC}" State 0

Goto render_setting_end

StrCmp $0 1 0 render_setting_end

WriteINIStr ${ioB} "${FIELD_ASSOC}" State 0

WriteINIStr ${ioB} "${FIELD_UNASSOC}" State 1

render_setting_end:

;检测当前的 Real 音频渲染模式

ReadINIStr $0 $EXEDIRmplayerc.ini FileFormats "Real 音频文件"

StrCmp $0 "" 0 +3

ReadRegStr $0 HKCU "SoftwareGabestMedia Player ClassicFileFormats" "Real 音频文件"

StrCmp $0 "" ra_render_setting_end

StrCpy $0 $0 1 -1

StrCmp $0 0 0 +4

WriteINIStr ${ioB} "Field 14" State 1

WriteINIStr ${ioB} "Field 15" State 0

Goto ra_render_setting_end

StrCmp $0 1 0 ra_render_setting_end

WriteINIStr ${ioB} "Field 14" State 0

WriteINIStr ${ioB} "Field 15" State 1

ra_render_setting_end:

;检测“立即播放”是否选中

ReadRegStr $0 HKCU "SoftwareRealNetworksRealPlayer6.0PreferencesEnableInstantPlayback" ""

StrCmp $0 1 0 +3

WriteINIStr ${ioB} "Field 11" State 1

Goto +2

WriteINIStr ${ioB} "Field 11" State 0

;检测“假定我在线”是否选中

ReadRegStr $0 HKCU "SoftwareRealNetworksRealPlayer6.0PreferencesNetdetectOptions" ""

StrCmp $0 1 0 +3

WriteINIStr ${ioB} "Field 12" State 1

Goto +2

WriteINIStr ${ioB} "Field 12" State 0

;初始化 InstallOptions

InstallOptionsEx::initDialog /NOUNLOAD ${ioB}

Pop $HWND

!insertmacro MUI_HEADER_TEXT "选择 Real 选项" "选择所需的选项,去掉不需要的选项"

;检测带宽设置

GetDlgItem $0 $HWND 1208

GetDlgItem $1 $HWND 1209

ReadRegStr $2 HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidthNotKnown" ""

StrCmp $2 1 +3

ReadRegStr $2 HKCR "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidthNotKnown" ""

StrCmp $2 1 0 +4

SendMessage $0 ${CB_SETCURSEL} 0 0

SendMessage $1 ${CB_SETCURSEL} 0 0

Goto check_bandwidth_end

ReadRegStr $2 HKCR "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidth" ""

StrCmp $2 "" 0 +3

ReadRegStr $2 HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidth" ""

StrCmp $2 "" check_bandwidth_end

ReadRegStr $3 HKCR "SoftwareRealNetworksRealMediaSDK6.0PreferencesMaxBandwidth" ""

StrCmp $3 "" 0 +3

ReadRegStr $3 HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesMaxBandwidth" ""

StrCmp $3 "" check_bandwidth_end

Push $2

Call GetBandwidthListItems

Pop $2

Push $3

Call GetBandwidthListItems

Pop $3

SendMessage $0 ${CB_SETCURSEL} $2 0

SendMessage $1 ${CB_SETCURSEL} $3 0

check_bandwidth_end:

InstallOptionsEx::show

FunctionEnd

; ------------------------------------------------------------------------------------------

Function RealLeaveCustom

ReadINIStr $0 ${ioB} Settings State

StrCmp $0 0 validate

StrCmp $0 9 norbw

StrCmp $0 10 maxbw

Abort

norbw:

GetDlgItem $0 $HWND 1208

GetDlgItem $1 $HWND 1209

SendMessage $0 ${CB_GETCURSEL} -1 0 $2 ;$2 保存Field 9 项序号

SendMessage $1 ${CB_GETCURSEL} -1 0 $3 ;$3 保存Field 20 项序号

IntCmp $2 $3 +2 +2                     ;检测是否 $2 <= $3

SendMessage $1 ${CB_SETCURSEL} $2 0

StrCmp $2 0 0 +2 ;选 0 项时,最大带宽也选 0

SendMessage $1 ${CB_SETCURSEL} 0 0

Abort

maxbw:

GetDlgItem $0 $HWND 1208

GetDlgItem $1 $HWND 1209

SendMessage $0 ${CB_GETCURSEL} -1 0 $2 ;$2 保存Field 9 项序号

SendMessage $1 ${CB_GETCURSEL} -1 0 $3 ;$3 保存Field 20 项序号

IntCmp $2 $3 +2 +2                     ;检测是否 $2 <= $3

SendMessage $0 ${CB_SETCURSEL} $3 0

StrCmp $2 0 0 +2 ;选 0 项时,正常带宽也选 0

SendMessage $0 ${CB_SETCURSEL} 0 0

Abort

validate:

;写入 Real 音量设置

ReadINIStr $0 ${ioB} "Field 5" State

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK10.0PreferencesEmbededVolume" "" $0

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK10.0PreferencesVolume" "" $0

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesEmbededVolume" "" $0

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesVolume" "" $0

WriteRegStr HKLM "SoftwareCLASSESSoftwareRealNetworksRealMediaSDK6.0PreferencesEmbededVolume" "" $0

WriteRegStr HKLM "SoftwareCLASSESSoftwareRealNetworksRealMediaSDK6.0PreferencesVolume" "" $0

;写入 Real 视频渲染模式

ReadINIStr $1 ${ioB} "${FIELD_UNASSOC}" State

StrCmp $1 1 +2

StrCpy $1 0

IfFileExists $EXEDIRmplayerc.ini 0 +5

ReadINIStr $0 $EXEDIRmplayerc.ini FileFormats "Real 媒体文件"

StrCpy $0 $0 -1

WriteINIStr $EXEDIRmplayerc.ini FileFormats "Real 媒体文件" "$0$1"

Goto +4

ReadRegStr $0 HKCU "SoftwareGabestMedia Player ClassicFileFormats" "Real 媒体文件"

StrCpy $0 $0 -1

WriteRegStr HKCU "SoftwareGabestMedia Player ClassicFileFormats" "Real 媒体文件" "$0$1"

;写入 Real 音频渲染模式

ReadINIStr $1 ${ioB} "Field 15" State

StrCmp $1 1 +2

StrCpy $1 0

IfFileExists $EXEDIRmplayerc.ini 0 +5

ReadINIStr $0 $EXEDIRmplayerc.ini FileFormats "Real 音频文件"

StrCpy $0 $0 -1

WriteINIStr $EXEDIRmplayerc.ini FileFormats "Real 音频文件" "$0$1"

Goto +4

ReadRegStr $0 HKCU "SoftwareGabestMedia Player ClassicFileFormats" "Real 音频文件"

StrCpy $0 $0 -1

WriteRegStr HKCU "SoftwareGabestMedia Player ClassicFileFormats" "Real 音频文件" "$0$1"

;带宽

GetDlgItem $0 $HWND 1208

GetDlgItem $1 $HWND 1209

SendMessage $0 ${CB_GETCURSEL} -1 0 $2 ;$2 保存Field 9 项序号

SendMessage $1 ${CB_GETCURSEL} -1 0 $3 ;$3 保存Field 20 项序号

StrCmp $2 0 0 +4

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidthNotKnown" "" 1

WriteRegStr HKCR "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidthNotKnown" "" 1

Goto +3

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidthNotKnown" "" 0

WriteRegStr HKCR "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidthNotKnown" "" 0

Push $2

Call GetBandwidth

Pop $2

Push $3

Call GetBandwidth

Pop $3

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidth" "" $2

WriteRegStr HKCU "SoftwareRealNetworksRealMediaSDK6.0PreferencesMaxBandwidth" "" $3

WriteRegStr HKCR "SoftwareRealNetworksRealMediaSDK6.0PreferencesBandwidth" "" $2

WriteRegStr HKCR "SoftwareRealNetworksRealMediaSDK6.0PreferencesMaxBandwidth" "" $3

;立即播放

ReadINIStr $0 ${ioB} "Field 11" State

StrCmp $0 1 0 +2

WriteRegStr HKCU "SoftwareRealNetworksRealPlayer6.0PreferencesEnableInstantPlayback" "" 1

StrCmp $0 0 0 +2

WriteRegStr HKCU "SoftwareRealNetworksRealPlayer6.0PreferencesEnableInstantPlayback" "" 0

;假定我在线

ReadINIStr $0 ${ioB} "Field 12" State

StrCmp $0 1 0 +2

WriteRegStr HKCU "SoftwareRealNetworksRealPlayer6.0PreferencesNetdetectOptions" "" 1

StrCmp $0 0 0 +2

WriteRegStr HKCU "SoftwareRealNetworksRealPlayer6.0PreferencesNetdetectOptions" "" 0

FunctionEnd

; -----------------------------------------------------------------------------------------

Function Mp4SetCustom

!ifdef DISABLE_PRE_BUTTON

;禁止上一步按钮

GetDlgItem $R0 $HWNDPARENT 3

ShowWindow $R0 0

!endif

;不选 Mp4 设置时退出

ReadINIStr $R0 ${ioA} "${FIELD_MP4}" State

StrCmp $R0 1 +2

Abort

;如果是最后一步则修改下一步按钮文本

ReadINIStr $R0 ${ioA} "${FIELD_BAK}" State

StrCmp $R0 1 +3

GetDlgItem $R0 $HWNDPARENT 1

SendMessage $R0 ${WM_SETTEXT} 0 "STR:确定"

;检测当前设置

ReadRegStr $0 HKLM SOFTWAREGNUffdshow xvid

StrCmp $0 1 0 +3

WriteINIStr ${ioC} "Field 2" State 1

WriteINIStr ${ioC} "Field 3" State 0

ReadRegStr $0 HKLM SOFTWAREGNUffdshow _3iv

StrCmp $0 9 0 +3

WriteINIStr ${ioC} "Field 5" State 0

WriteINIStr ${ioC} "Field 6" State 1

ReadRegStr $0 HKLM SOFTWAREGNUffdshow dx50

StrCmp $0 9 0 +3

WriteINIStr ${ioC} "Field 8" State 0

WriteINIStr ${ioC} "Field 9" State 1

ReadRegStr $0 HKLM SOFTWAREGNUffdshow divx

StrCmp $0 1 0 +3

WriteINIStr ${ioC} "Field 11" State 1

WriteINIStr ${ioC} "Field 12" State 0

ReadRegStr $0 HKLM SOFTWAREGNUffdshow div3

StrCmp $0 1 0 +3

WriteINIStr ${ioC} "Field 14" State 0

WriteINIStr ${ioC} "Field 15" State 1

ReadRegStr $0 HKLM SOFTWAREGNUffdshow_audio ac3

StrCmp $0 15 0 +7

ReadRegStr $0 HKLM SOFTWAREGNUffdshow_audio dts

StrCmp $0 17 0 +5

ReadRegStr $0 HKLM SOFTWAREGNUffdshow_audio lpcm

StrCmp $0 4 0 +3

WriteINIStr ${ioC} "Field 17" State 0

WriteINIStr ${ioC} "Field 18" State 1

;检测当前的 QuickTime 渲染模式

ReadINIStr $0 $EXEDIRmplayerc.ini FileFormats "MPEG4 文件"

StrCmp $0 "" 0 +3

ReadRegStr $0 HKCU "SoftwareGabestMedia Player ClassicFileFormats" "MPEG4 文件"

StrCmp $0 "" qt_render_setting_end

StrCpy $0 $0 1 -1

StrCmp $0 0 0 +4

WriteINIStr ${ioC} "Field 20" State 1

WriteINIStr ${ioC} "Field 21" State 0

Goto qt_render_setting_end

StrCmp $0 2 0 qt_render_setting_end

WriteINIStr ${ioC} "Field 20" State 0

WriteINIStr ${ioC} "Field 21" State 1

qt_render_setting_end:

InstallOptions::initDialog /NOUNLOAD ${ioC}

Pop $HWND

;没有 ffdshow 解码器时禁用下列组件

IfFileExists $SYSDIRffdshow.ax exist_ffdshow

GetDlgItem $0 $HWND 1201

EnableWindow $0 0

GetDlgItem $0 $HWND 1202

EnableWindow $0 0

GetDlgItem $0 $HWND 1204

EnableWindow $0 0

GetDlgItem $0 $HWND 1205

EnableWindow $0 0

GetDlgItem $0 $HWND 1207

EnableWindow $0 0

GetDlgItem $0 $HWND 1208

EnableWindow $0 0

GetDlgItem $0 $HWND 1210

EnableWindow $0 0

GetDlgItem $0 $HWND 1211

EnableWindow $0 0

GetDlgItem $0 $HWND 1214

EnableWindow $0 0

GetDlgItem $0 $HWND 1217

EnableWindow $0 0

exist_ffdshow:

;没有 XviD 解码器时禁用下列组件

IfFileExists $SYSDIRxvidcore.dll exist_xvid

GetDlgItem $0 $HWND 1202

EnableWindow $0 0

GetDlgItem $0 $HWND 1205

EnableWindow $0 0

GetDlgItem $0 $HWND 1208

EnableWindow $0 0

GetDlgItem $0 $HWND 1211

EnableWindow $0 0

exist_xvid:

;没有 DivX 3.11 解码器时禁用下列组件

IfFileExists $SYSDIRdivx_c32.ax +3

GetDlgItem $0 $HWND 1213

EnableWindow $0 0

;没有 AC3Filter 时禁用下列组件

IfFileExists $SYSDIRac3filter.cpl +3

GetDlgItem $0 $HWND 1216

EnableWindow $0 0

!insertmacro MUI_HEADER_TEXT "选择解码器选项" "给每种编码格式设置一个主解码器"

InstallOptions::show

FunctionEnd

; ------------------------------------------------------------------------------------------

Function Mp4LeaveCustom

;Xvid

ReadINIStr $0 ${ioC} "${FIELD_ASSOC}" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow xvid 1

ReadINIStr $0 ${ioC} "${FIELD_UNASSOC}" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow xvid 9

;3ivx

ReadINIStr $0 ${ioC} "Field 5" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow _3iv 1

ReadINIStr $0 ${ioC} "Field 6" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow _3iv 9

;DivX 5

ReadINIStr $0 ${ioC} "${FIELD_SETASSOC}" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow dx50 1

ReadINIStr $0 ${ioC} "Field 9" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow dx50 9

;DivX 4

ReadINIStr $0 ${ioC} "Field 11" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow divx 1

ReadINIStr $0 ${ioC} "Field 12" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow divx 9

;Divx 3

ReadINIStr $0 ${ioC} "Field 14" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow div3 0

ReadINIStr $0 ${ioC} "Field 15" State

StrCmp $0 1 0 +2

WriteRegDWORD HKLM SOFTWAREGNUffdshow div3 1

;AC3 & DTS

ReadINIStr $0 ${ioC} "Field 17" State

StrCmp $0 1 0 +4

WriteRegDWORD HKLM SOFTWAREGNUffdshow_audio ac3 0

WriteRegDWORD HKLM SOFTWAREGNUffdshow_audio dts 0

WriteRegDWORD HKLM SOFTWAREGNUffdshow_audio lpcm 0

ReadINIStr $0 ${ioC} "Field 18" State

StrCmp $0 1 0 +5

WriteRegBin HKLM "SOFTWAREClassesCLSID{083863F1-70DE-11d0-BD40-00A0C911CE86}Instance{A753A1EC-973E-4718-AF8E-A3F554D45C44}" "FilterData" 020000000000400002000000000000003070693300000000000000000f000000000000000000000030747933000000004001000050010000317479330000000040010000600100003274793300000000400100007001000033747933000000004001000080010000347479330000000040010000900100003574793300000000a0010000500100003674793300000000a0010000600100003774793300000000a0010000700100003874793300000000a0010000800100003974793300000000a0010000900100003a74793300000000b0010000c00100003b74793300000000b0010000d00100003c74793300000000b0010000e00100003d74793300000000b0010000500100003e74793300000000b0010000700100003170693308000000000000000100000000000000000000003074793300000000b0010000c001000020806de046dbcf11b4d100805f6cbbe

WriteRegDWORD HKLM SOFTWAREGNUffdshow_audio ac3 15

WriteRegDWORD HKLM SOFTWAREGNUffdshow_audio dts 17

WriteRegDWORD HKLM SOFTWAREGNUffdshow_audio lpcm 4

;MP4 & QuickTime

ReadINIStr $1 ${ioC} "Field 21" State

StrCmp $1 1 0 +3

StrCpy $1 2

Goto +2

StrCpy $1 0

IfFileExists $EXEDIRmplayerc.ini 0 +5

ReadINIStr $0 $EXEDIRmplayerc.ini FileFormats "MPEG4 文件"

StrCpy $0 $0 -1

WriteINIStr $EXEDIRmplayerc.ini FileFormats "MPEG4 文件" "$0$1"

Goto +4

ReadRegStr $0 HKCU "SoftwareGabestMedia Player ClassicFileFormats" "MPEG4 文件"

StrCpy $0 $0 -1

WriteRegStr HKCU "SoftwareGabestMedia Player ClassicFileFormats" "MPEG4 文件" "$0$1"

FunctionEnd

; -----------------------------------------------------------------------------------------

Function BakSetCustom

!ifdef DISABLE_PRE_BUTTON

;禁止上一步按钮

GetDlgItem $R0 $HWNDPARENT 3

ShowWindow $R0 0

!endif

;不选 Mp4 设置时退出

ReadINIStr $R0 ${ioA} "${FIELD_BAK}" State

StrCmp $R0 1 +2

Abort

StrCpy $1 1

ReadRegStr $0 ${G_SETTING_KEY}SettingBakPage "Field $1"

StrCmp $0 "" +2

WriteINIStr ${ioD} "Field $1" State $0

IntOp $1 $1 + 1

StrCmp $1 5 +2

Goto -5

ReadRegStr $0 ${G_SETTING_KEY}SettingBakPage BakPath

IfFileExists $0 0 +2

WriteINIStr ${ioD} "Field 6" State $0

;检测当前设置

InstallOptions::initDialog /NOUNLOAD ${ioD}

Pop $HWND

;如果没有 VSFilter 则禁用

IfFileExists "$EXEDIRCodecsvsfilter.dll" +5

IfFileExists "$SYSDIRvsfilter.dll" +4

GetDlgItem $0 $HWND 1201

SendMessage $0 ${BM_SETCHECK} 0 0

EnableWindow $0 0

;如果没有 FFDShow 则禁用

IfFileExists $SYSDIRffdshow.ax +4

GetDlgItem $0 $HWND 1202

SendMessage $0 ${BM_SETCHECK} 0 0

EnableWindow $0 0

;如果没有 AC3Filter 则禁用

IfFileExists "$SYSDIRac3filter.cpl" +4

GetDlgItem $0 $HWND 1203

SendMessage $0 ${BM_SETCHECK} 0 0

EnableWindow $0 0

!insertmacro MUI_HEADER_TEXT "选择备份选项" "在需要备份的项目前打钩"

InstallOptions::show

FunctionEnd

; ------------------------------------------------------------------------------------------

Function BakLeaveCustom

ReadINIStr $0 ${ioD} "Field 6" State

IfFileExists $0 +2

CreateDirectory $0

WriteRegStr ${G_SETTING_KEY}SettingBakPage BakPath $0

StrCpy $1 1

ReadINIStr $0 ${ioD} "Field $1" State

WriteRegStr ${G_SETTING_KEY}SettingBakPage "Field $1" $0

IntOp $1 $1 + 1

StrCmp $1 5 +2

Goto -4

FunctionEnd

; ------------------------------------------------------------------------------------------

Function ComponentsPage

;不选文件关联时跳过

ReadINIStr $R0 ${ioA} "${FIELD_SETASSOC}" State

StrCmp $R0 1 +2

Abort

;选择卸载时跳过

ReadINIStr $R0 ${ioA} "${FIELD_UNASSOC}" "State"

StrCmp $R0 1 0 +2

Abort

!ifdef DISABLE_PRE_BUTTON

;禁止上一步按钮

GetDlgItem $R0 $HWNDPARENT 3

ShowWindow $R0 0

!endif

;如果是最后一步则修改下一步按钮文本

ReadINIStr $R0 ${ioA} "${FIELD_MP4}" State

ReadINIStr $R1 ${ioA} "${FIELD_REAL}" State

IntOp $R0 $R0 || $R1

ReadINIStr $R1 ${ioA} "${FIELD_BAK}" State

IntOp $R0 $R0 || $R1

StrCmp $R0 1 +3

GetDlgItem $R0 $HWNDPARENT 1

SendMessage $R0 ${WM_SETTEXT} 0 "STR:确定"

FunctionEnd

Function ClearSection

Push $R0

StrCpy $R0 ${first}

loop:

IntCmp $R0 ${post} loop_quit 0 loop_quit

SectionSetFlags $R0 0

IntOp $R0 $R0 + 1

Goto loop

loop_quit:

Pop $R0

FunctionEnd

;-------------------------------------------------

;卸载段

;-------------------------------------------------

Function Restore

Push $R0

Push $R1

Push $R2

StrCpy $R0 1

loop:

EnumRegValue $R1 HKCR "mplayerc.file" $R0

StrCmp $R1 "" loop_quit

ReadRegStr $R2 HKCR "mplayerc.file" "$R1"

WriteRegStr HKCR ".$R1" "" "$R2"

DeleteRegKey HKCR "mplayerc.$R1"

IntOp $R0 $R0 + 1

Goto loop

loop_quit:

StrCpy $R0 1

loop2:

EnumRegValue $R1 HKCR "mplayerc.fileProtocol" $R0

StrCmp $R1 "" loop2_quit

ReadRegStr $R2 HKCR "mplayerc.fileProtocol" "$R1"

WriteRegStr HKCR "$R1shellopencommand" "" "$R2"

IntOp $R0 $R0 + 1

Goto loop2

loop2_quit:

ReadRegStr $R0 ${G_EXE_KEY} ExeFile

DeleteRegKey HKLM "SOFTWAREMicrosoftWindowsCurrentVersionApp Paths$R0"

DeleteRegKey HKCR "mplayerc.file"

Pop $R2

Pop $R1

Pop $R0

FunctionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 蓝色网际mpcassoc脚本链接提示对话框

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