脚本:具有多语言特性的操作系统美化包
优质
小牛编辑
132浏览
2023-12-01
使用说明:
以 shell32.dll 为例,要替换 ID 为 1010 的图标资源,你只需要用 Resource Hacker 把它导出到 .\include\Resources\shell32.dll\1010.ico即可,安装程序会自动搜索并替换。
Resource Hacker 的文件名为 ResHacker.exe 放在 include 下面,最好使用英文版的 Resource Hacker 以保持最高稳定性。
filelist.txt 不是必需的文件,只是作为脚本参考的帮助。
当运行 WindowsUpdate 后如果有系统文件被替换了只需要运行安装程序并选择“更新”即可。
这个脚本使用多语言特性,您只需要添加了相应的语言就可以把自己做的美化包发给老外用。
引用PixOS.nsi的内容:
;************************************************************ ;脚本编写: 蓝色网际 ;编译: 必须使用 NSIS v2.09 简体中文增强版或更新版本 ;************************************************************ !define VER_MAJOR "1.0" !define VER_MINOR "1" !define /date VER_BUILD "%#m%d" !define /date TIME "%Y%m%d" !define /date SPECIALBUILD "%Y-%#m-%#d" !define VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}" !define THIS_NAME "PixOS ShellPack" ;全名 !define THIS_NAME_LITE "PixOS" ;简称 !define THIS_FLDR "PixOS" ;要创建的文件夹名称 ;IO page !define ioA "$PLUGINSDIR\ioA.ini" !define IDC_UNINSTALL `"Field 1"` !define IDC_UPDATE `"Field 2"` !define IDC_STATIC_UNINSTALL `"Field 3"` !define IDC_STATIC_UPDATE `"Field 4"` !define WALLPAPER_TYPE bmp ;墙纸的后缀名 Name "${THIS_NAME}" OutFile "${THIS_NAME_LITE}.exe" SetCompressor /FINAL /SOLID lzma SpaceTexts none ShowInstDetails show ShowUninstDetails show Caption "$(^NameDA)" UninstallCaption "$(^NameDA) $(UNINSTALLER)" Var HWND Var UPDATE Var NBACKUP ReserveFile ".\ioA.ini" ReserveFile "${NSISDIR}\Plugins\System.dll" ReserveFile "${NSISDIR}\Plugins\DisplaySettings.dll" !include MUIXP.nsh !include UsefulLib.nsh !include Language.nsh ${ForEachFile} ${GetChild} ${GetFileExt} ${VerCmp} ${TrimLine} ${GetVarValue} ${FindI} ${ReadRegMultiStr} ${un.GetChild} ${un.TrimLine} !define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeFont !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "$(license)" Page custom SetCustomA LeaveCustomA !define MUI_PAGE_CUSTOMFUNCTION_PRE CheckAbort !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES !define MUI_PAGE_CUSTOMFUNCTION_SHOW ChangeFont !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_LANGUAGE "SimpChinese" !insertmacro MUI_LANGUAGE "TradChinese" !insertmacro MUI_LANGUAGE "English" ;版本信息 VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${THIS_NAME}" VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "This installer was written using Nullsoft Scriptable Install System$\r$\n(http://nsis.sourceforge.net)" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyleft (C) bluenet" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${THIS_NAME} Setup Program" VIAddVersionKey /LANG=${LANG_ENGLISH} "SpecialBuild" "${THIS_NAME} Setup, built on ${SPECIALBUILD}" !verbose 3 !macro Patch FILE ${If} ${FileExists} `${FILE}` Push `${FILE}` ${If} $UPDATE = ${TRUE} Call Update ${Else} Call Patch ${EndIf} ${EndIf} !macroend !macro DisableSection SECTION Push `${SECTION}` Exch $R0 Push $R1 SectionGetFlags $R0 $R1 IntOp $R1 $R1 & ${SECTION_OFF} IntOp $R1 $R1 | ${SF_RO} SectionSetFlags $R0 $R1 Pop $R1 Pop $R0 !macroend Section `-First` sec_first SectionEnd Section "-File" sec_file DetailPrint $(PrepareFiles) SetOutPath "$WINDIR\${THIS_FLDR}" ;SetFileAttributes "$WINDIR\${THIS_FLDR}" HIDDEN File ".\include\ResHacker.exe" SetOutPath "$WINDIR\${THIS_FLDR}\Resources" File /r ".\include\Resources\*" SetDetailsPrint none CreateDirectory "$WINDIR\${THIS_FLDR}\Backup" CreateDirectory "$WINDIR\${THIS_FLDR}\Backup\pchealth" CreateDirectory "$WINDIR\${THIS_FLDR}\NewFiles" CreateDirectory "$WINDIR\${THIS_FLDR}\Logs" ;${ClearDetail} SectionEnd Section $(CorePatch) sec_core ${If} $UPDATE = ${TRUE} DetailPrint $(ScanUpdate) ${EndIf} !insertmacro Patch `$WINDIR\explorer.exe` !insertmacro Patch `$WINDIR\hh.exe` !insertmacro Patch `$WINDIR\regedit.exe` !insertmacro Patch `$WINDIR\oobe\msobmain.dll` !insertmacro Patch `$WINDIR\oobe\msoobe.exe` !insertmacro Patch `$WINDIR\oobe\oobebaln.exe` !insertmacro Patch `$WINDIR\Setup\ntoc.dll` !insertmacro Patch `$WINDIR\srchasst\srchui.dll` !insertmacro Patch `$WINDIR\pchealth\helpctr\binaries\HelpCtr.exe` !insertmacro Patch `$SYSDIR\access.cpl` !insertmacro Patch `$SYSDIR\ahui.exe` !insertmacro Patch `$SYSDIR\appwiz.cpl` !insertmacro Patch `$SYSDIR\asctrls.ocx` !insertmacro Patch `$SYSDIR\Audiodev.dll` !insertmacro Patch `$SYSDIR\batt.dll` !insertmacro Patch `$SYSDIR\browseui.dll` !insertmacro Patch `$SYSDIR\cabview.dll` !insertmacro Patch `$SYSDIR\cdfview.dll` !insertmacro Patch `$SYSDIR\charmap.exe` !insertmacro Patch `$SYSDIR\cmprops.dll` !insertmacro Patch `$SYSDIR\comctl32.dll` !insertmacro Patch `$SYSDIR\comdlg32.dll` !insertmacro Patch `$SYSDIR\compatUI.dll` !insertmacro Patch `$SYSDIR\compstui.dll` !insertmacro Patch `$SYSDIR\credui.dll` !insertmacro Patch `$SYSDIR\cscui.dll.dll` !insertmacro Patch `$SYSDIR\desk.cpl` !insertmacro Patch `$SYSDIR\deskadp.dll` !insertmacro Patch `$SYSDIR\deskmon.dll` !insertmacro Patch `$SYSDIR\deskperf.dll` !insertmacro Patch `$SYSDIR\devmgr.dll` !insertmacro Patch `$SYSDIR\dskquoui.dll` !insertmacro Patch `$SYSDIR\dsuiext.dll` !insertmacro Patch `$SYSDIR\filemgmt.dll` !insertmacro Patch `$SYSDIR\fldrclnr.dll` !insertmacro Patch `$SYSDIR\fontext.dll` !insertmacro Patch `$SYSDIR\gcdef.dll` !insertmacro Patch `$SYSDIR\hdwwiz.cpl` !insertmacro Patch `$SYSDIR\HHActiveX.dll` !insertmacro Patch `$SYSDIR\hhctrl.ocx` !insertmacro Patch `$SYSDIR\hnetcfg.dll` !insertmacro Patch `$SYSDIR\hnetwiz.dll` !insertmacro Patch `$SYSDIR\ieaksie.dll` !insertmacro Patch `$SYSDIR\ieakui.dll` !insertmacro Patch `$SYSDIR\iepeers.dll` !insertmacro Patch `$SYSDIR\inetcfg.dll` !insertmacro Patch `$SYSDIR\inetcpl.cpl` !insertmacro Patch `$SYSDIR\inetcplc.dll` !insertmacro Patch `$SYSDIR\inetppui.dll` !insertmacro Patch `$SYSDIR\intl.cpl` !insertmacro Patch `$SYSDIR\irftp.exe` !insertmacro Patch `$SYSDIR\irprops.cpl` !insertmacro Patch `$SYSDIR\jobexec.dll` !insertmacro Patch `$SYSDIR\joy.cpl` !insertmacro Patch `$SYSDIR\localsec.dll` !insertmacro Patch `$SYSDIR\logonui.exe` !insertmacro Patch `$SYSDIR\magnify.exe` !insertmacro Patch `$SYSDIR\main.cpl` !insertmacro Patch `$SYSDIR\mdminst.dll` !insertmacro Patch `$SYSDIR\mmsys.cpl` !insertmacro Patch `$SYSDIR\mobsync.exe` !insertmacro Patch `$SYSDIR\mobsync.dll` !insertmacro Patch `$SYSDIR\modemui.dll` !insertmacro Patch `$SYSDIR\moricons.dll` !insertmacro Patch `$SYSDIR\mplay32.exe` !insertmacro Patch `$SYSDIR\msdxm.ocx` !insertmacro Patch `$SYSDIR\msgina.dll` !insertmacro Patch `$SYSDIR\mshtml.dll` !insertmacro Patch `$SYSDIR\msident.dll` !insertmacro Patch `$SYSDIR\msieftp.dll` !insertmacro Patch `$SYSDIR\mspaint.exe` !insertmacro Patch `$SYSDIR\msratelc.dll` !insertmacro Patch `$SYSDIR\msrating.dll` !insertmacro Patch `$SYSDIR\mstask.dll` !insertmacro Patch `$SYSDIR\mstsc.exe` !insertmacro Patch `$SYSDIR\mstscax.dll` !insertmacro Patch `$SYSDIR\mycomput.dll` !insertmacro Patch `$SYSDIR\mydocs.dll` !insertmacro Patch `$SYSDIR\narrator.exe` !insertmacro Patch `$SYSDIR\ncpa.cpl` !insertmacro Patch `$SYSDIR\netid.dll` !insertmacro Patch `$SYSDIR\netplwiz.dll` !insertmacro Patch `$SYSDIR\netshell.dll` !insertmacro Patch `$SYSDIR\newdev.dll` !insertmacro Patch `$SYSDIR\notepad.exe` !insertmacro Patch `$SYSDIR\ntbackup.exe` !insertmacro Patch `$SYSDIR\ntlanui2.dll` !insertmacro Patch `$SYSDIR\ntshrui.dll` !insertmacro Patch `$SYSDIR\nusrmgr.cpl` !insertmacro Patch `$SYSDIR\nwprovau.dll` !insertmacro Patch `$SYSDIR\objsel.dll` !insertmacro Patch `$SYSDIR\occache.dll` !insertmacro Patch `$SYSDIR\oleprn.dll` !insertmacro Patch `$SYSDIR\osk.exe` !insertmacro Patch `$SYSDIR\photowiz.dll` !insertmacro Patch `$SYSDIR\powercfg.cpl` !insertmacro Patch `$SYSDIR\printui.dll` !insertmacro Patch `$SYSDIR\rasdlg.dll` !insertmacro Patch `$SYSDIR\rasphone.exe` !insertmacro Patch `$SYSDIR\rcimlby.exe` !insertmacro Patch `$SYSDIR\regwizc.dll` !insertmacro Patch `$SYSDIR\remotepg.dll` !insertmacro Patch `$SYSDIR\servdeps.dll` !insertmacro Patch `$SYSDIR\setupapi.dll` !insertmacro Patch `$SYSDIR\sfc_os.dll` !insertmacro Patch `$SYSDIR\shdoclc.dll` !insertmacro Patch `$SYSDIR\shdocvw.dll` !insertmacro Patch `$SYSDIR\shell32.dll` !insertmacro Patch `$SYSDIR\shimgvw.dll` !insertmacro Patch `$SYSDIR\shlwapi.dll` !insertmacro Patch `$SYSDIR\shrpubw.exe` !insertmacro Patch `$SYSDIR\sndrec32.exe` !insertmacro Patch `$SYSDIR\sndvol32.exe` !insertmacro Patch `$SYSDIR\srclient.dll` !insertmacro Patch `$SYSDIR\srrstr.dll` !insertmacro Patch `$SYSDIR\sti_ci.dll` !insertmacro Patch `$SYSDIR\stimon.exe` !insertmacro Patch `$SYSDIR\stobject.dll` !insertmacro Patch `$SYSDIR\storprop.dll` !insertmacro Patch `$SYSDIR\sxs.dll` !insertmacro Patch `$SYSDIR\syncapp.exe` !insertmacro Patch `$SYSDIR\syncui.dll` !insertmacro Patch `$SYSDIR\sysdm.cpl` !insertmacro Patch `$SYSDIR\sysocmgr.exe` !insertmacro Patch `$SYSDIR\syssetup.dll` !insertmacro Patch `$SYSDIR\tapiui.dll` !insertmacro Patch `$SYSDIR\tcpmonui.dll` !insertmacro Patch `$SYSDIR\telephon.cpl` !insertmacro Patch `$SYSDIR\timedate.cpl` !insertmacro Patch `$SYSDIR\upnpui.dll` !insertmacro Patch `$SYSDIR\url.dll` !insertmacro Patch `$SYSDIR\urlmon.dll` !insertmacro Patch `$SYSDIR\user32.dll` !insertmacro Patch `$SYSDIR\utilman.exe` !insertmacro Patch `$SYSDIR\webcheck.dll` !insertmacro Patch `$SYSDIR\wextract.exe` !insertmacro Patch `$SYSDIR\wiaacmgr.exe` !insertmacro Patch `$SYSDIR\wiadefui.dll` !insertmacro Patch `$SYSDIR\wiaservc.dll` !insertmacro Patch `$SYSDIR\wiashext.dll` !insertmacro Patch `$SYSDIR\winhlp32.exe` !insertmacro Patch `$SYSDIR\wininet.dll` !insertmacro Patch `$SYSDIR\wscui.cpl` !insertmacro Patch `$SYSDIR\wuapi.dll` !insertmacro Patch `$SYSDIR\wuauclt.exe` !insertmacro Patch `$SYSDIR\wuaucpl.cpl` !insertmacro Patch `$SYSDIR\wupdmgr.exe` !insertmacro Patch `$SYSDIR\xpsp1res.dll` !insertmacro Patch `$SYSDIR\xpsp2res.dll` !insertmacro Patch `$SYSDIR\zipfldr.dll` !insertmacro Patch `$SYSDIR\Restore\rstrui.exe` !insertmacro Patch `$SYSDIR\usmt\migload.exe` !insertmacro Patch `$SYSDIR\usmt\migwiz.exe` !insertmacro Patch `$SYSDIR\usmt\migwiz_a.exe` !insertmacro Patch `$PROGRAMFILES\Internet Explorer\IEXPLORE.exe` !insertmacro Patch `$PROGRAMFILES\Outlook Express\msimn.exe` !insertmacro Patch `$PROGRAMFILES\Outlook Express\msoeres.dll` !insertmacro Patch `$PROGRAMFILES\Outlook Express\wab.exe` !insertmacro Patch `$PROGRAMFILES\Windows NT\Accessories\wordpad.exe` !insertmacro Patch `$COMMONFILES\Microsoft Shared\MSInfo\msinfo32.exe` !insertmacro Patch `$COMMONFILES\Microsoft Shared\Speech\sapi.cpl` !insertmacro Patch `$COMMONFILES\Microsoft Shared\Speech\$LANGUAGE\spcplui.dll` !insertmacro Patch `$COMMONFILES\Microsoft Shared\Web Folders\MSONSEXT.DLL` !insertmacro Patch `$COMMONFILES\System\MSMAPI\$LANGUAGE\MLCFG32.cpl` ${If} ${FileExists} `$WINDIR\${THIS_FLDR}\update.txt` ;如果存在 update.txt 则强制更新 Call ForceUpdate Delete `$WINDIR\${THIS_FLDR}\update.txt` ${EndIf} ${If} ${RebootFlag} ${SHRegGetPath} $0 ${HKCU} "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" "Local AppData" FileOpen $1 `$0\IconCache.db` a ;强制在重启后删除 Delete /REBOOTOK `$0\IconCache.db` FileClose $1 WriteRegDWORD HKLM `SYSTEM\CurrentControlSet\Control\Session Manager` "AllowProtectedRenames" 1 ${EndIf} SetDetailsPrint both ${If} $UPDATE = ${TRUE} ${Unless} ${RebootFlag} SetAutoClose false DetailPrint $(NoUpdate) ${EndUnless} ${EndIf} SectionEnd Section `-File Replace` sec_replace ;直接覆盖 CopyFiles /SILENT `$WINDIR\pchealth\helpctr\System\images\*` `$WINDIR\${THIS_FLDR}\Backup\pchealth` SetOutPath `$WINDIR\pchealth` File /r `.\include\pchealth\*` SectionEnd Section $(Cursor) sec_cursor !define CSDIR `%SystemRoot%\${THIS_FLDR}\Cursor` SetOutPath `$WINDIR\${THIS_FLDR}\Cursor` File /r `.\include\Cursor\*` WriteRegExpandStr HKCU `Control Panel\Cursors\Schemes` `${THIS_NAME_LITE}` `${CSDIR}\Arrow.cur,\ ${CSDIR}\Help.cur,${CSDIR}\AppStarting.ani,${CSDIR}\Wait.ani,${CSDIR}\Cross.cur,\ ${CSDIR}\IBeam.cur,${CSDIR}\Handwriting.cur,${CSDIR}\NO.cur,${CSDIR}\SizeNS.cur,\ ${CSDIR}\SizeWE.cur,${CSDIR}\SizeNWSE.cur,${CSDIR}\SizeNESW.cur,${CSDIR}\SizeAll.cur,\ ${CSDIR}\UpArrow.cur,${CSDIR}\Hand.cur` WriteRegStr HKCU `Control Panel\Cursors` `` `${THIS_NAME_LITE}` WriteRegExpandStr HKCU "Control Panel\Cursors" "Arrow" "${CSDIR}\Arrow.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "Help" "${CSDIR}\Help.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "AppStarting" "${CSDIR}\AppStarting.ani" WriteRegExpandStr HKCU "Control Panel\Cursors" "Wait" "${CSDIR}\Wait.ani" WriteRegExpandStr HKCU "Control Panel\Cursors" "Crosshair" "${CSDIR}\Cross.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "IBeam" "${CSDIR}\IBeam.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "NWPen" "${CSDIR}\Handwriting.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "No" "${CSDIR}\NO.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeNS" "${CSDIR}\SizeNS.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeWE" "${CSDIR}\SizeWE.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeNWSE" "${CSDIR}\SizeNWSE.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeNESW" "${CSDIR}\SizeNESW.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeAll" "${CSDIR}\SizeAll.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "UpArrow" "${CSDIR}\UpArrow.cur" WriteRegExpandStr HKCU "Control Panel\Cursors" "Hand" "${CSDIR}\Hand.cur" WriteRegExpandStr HKCU "Control Panel\Cursors\Schemes" "${THIS_NAME_LITE}" "${CSDIR}\Arrow.cur,${CSDIR}\Help.cur,${CSDIR}\AppStarting.ani,${CSDIR}\Wait.ani,${CSDIR}\Cross.cur,${CSDIR}\IBeam.cur,${CSDIR}\Handwriting.cur,${CSDIR}\NO.cur,${CSDIR}\SizeNS.cur,${CSDIR}\SizeWE.cur,${CSDIR}\SizeNWSE.cur,${CSDIR}\SizeNESW.cur,${CSDIR}\SizeAll.cur,${CSDIR}\UpArrow.cur,${CSDIR}\Hand.cur" SectionEnd Section $(Wallpaper) sec_wallpaper DisplaySettings::EnumSettings PelsWidth Pop $0 DisplaySettings::EnumSettings PelsHeight Pop $1 ${If} $0 >= 1280 ${AndIf} $1 >= 1024 ;判断屏幕分辨率来应用墙纸 File `/oname=$WINDIR\${THIS_FLDR}\${THIS_NAME_LITE}.${WALLPAPER_TYPE}` `.\include\Wallpapers\PixOS(1280).${WALLPAPER_TYPE}` ${Else} File `/oname=$WINDIR\${THIS_FLDR}\${THIS_NAME_LITE}.${WALLPAPER_TYPE}` `.\include\Wallpapers\PixOS(1024).${WALLPAPER_TYPE}` ${EndIf} ReadRegStr $0 HKCU `Control Panel\Desktop` WallpaperStyle WriteRegStr HKCU `Control Panel\Desktop` PrevWallpaperStyle $0 WriteRegStr HKCU `Control Panel\Desktop` WallpaperStyle 0 ReadRegStr $0 HKCU `Control Panel\Desktop` Wallpaper WriteRegStr HKCU `Control Panel\Desktop` PrevWallpaper $0 WriteRegStr HKCU `Control Panel\Desktop` Wallpaper `$WINDIR\${THIS_FLDR}\${THIS_NAME_LITE}.${WALLPAPER_TYPE}` WriteRegStr HKCU `Control Panel\Desktop` ConvertedWallpaper `$WINDIR\${THIS_FLDR}\${THIS_NAME_LITE}.${WALLPAPER_TYPE}` SectionEnd Section $(VisualStyle) sec_visualstyle SetOutPath `$WINDIR\resources\Themes\${THIS_FLDR}` File /r `.\include\VS\*` WriteRegExpandStr HKCU `Software\Microsoft\Windows\CurrentVersion\ThemeManager` DllName `%SystemRoot%\resources\Themes\${THIS_FLDR}\${THIS_NAME_LITE}.msstyles` WriteRegStr HKCU `Software\Microsoft\Windows\CurrentVersion\ThemeManager` LoadedBefore 1 WriteRegStr HKCU `Software\Microsoft\Windows\CurrentVersion\ThemeManager` ThemeActive 1 WriteRegStr HKCU `Software\Microsoft\Windows\CurrentVersion\ThemeManager` ColorName NormalColor WriteRegStr HKCU `Software\Microsoft\Windows\CurrentVersion\ThemeManager` SizeName NormalSize ;WriteRegStr HKCU "Control Panel\Appearance" "Current" "" ;WriteRegStr HKCU "Control Panel\Appearance" "NewCurrent" "" WriteRegStr HKCU "Control Panel\Colors" "ActiveTitle" "31 96 163" WriteRegStr HKCU "Control Panel\Colors" "Background" "47 112 188" WriteRegStr HKCU "Control Panel\Colors" "ButtonDkShadow" "93 106 125" WriteRegStr HKCU "Control Panel\Colors" "ButtonFace" "230 235 243" WriteRegStr HKCU "Control Panel\Colors" "ButtonLight" "245 247 250" WriteRegStr HKCU "Control Panel\Colors" "ButtonShadow" "189 204 224" WriteRegStr HKCU "Control Panel\Colors" "GradientActiveTitle" "31 96 163" WriteRegStr HKCU "Control Panel\Colors" "GradientInactiveTitle" "185 200 222" WriteRegStr HKCU "Control Panel\Colors" "GrayText" "152 176 201" WriteRegStr HKCU "Control Panel\Colors" "Hilight" "62 128 202" WriteRegStr HKCU "Control Panel\Colors" "HilightText" "250 250 250" WriteRegStr HKCU "Control Panel\Colors" "HotTrackingColor" "100 139 203" WriteRegStr HKCU "Control Panel\Colors" "InactiveTitle" "185 200 222" WriteRegStr HKCU "Control Panel\Colors" "InactiveTitleText" "105 119 137" WriteRegStr HKCU "Control Panel\Colors" "InfoText" "105 119 137" WriteRegStr HKCU "Control Panel\Colors" "InfoWindow" "255 255 255" WriteRegStr HKCU "Control Panel\Colors" "Menu" "230 235 243" WriteRegStr HKCU "Control Panel\Colors" "TitleText" "0 0 0" WriteRegStr HKCU "Control Panel\Colors" "MenuHilight" "71 135 207" WriteRegStr HKCU "Control Panel\Colors" "MenuBar" "207 218 234" WriteRegBin HKCU "Control Panel\Desktop" "UserPreferencesMask" b0120380 WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "CaptionHeight" "-390" WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "MenuHeight" "-285" WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "SmCaptionHeight" "-255" WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "SmCaptionWidth" "-255" SectionEnd Section `-Spec` sec_spec SectionEnd SectionGroup /e "$(Application)" sec_application Section /o "WinRAR" sec_winrar SetOutPath "$WINDIR\${THIS_FLDR}\Resources\WinRAR.exe" File /r `.\include\App Resources\WinRAR.exe\*` ReadRegStr $0 HKLM `SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe` Path !insertmacro Patch `$0\WinRAR.exe` SectionEnd Section /o "Maxthon" sec_maxthon ReadRegStr $0 HKCU `Software\Maxthon` Folder SetOutPath "$0\Skin" File /r `.\include\App Resources\Maxthon\*` WriteINIStr `$0\Config\config.ini` Settings SkinFile `$0\skin\${THIS_NAME_LITE}\skin.ini` SectionEnd SectionGroupEnd Section "-post" sec_post WriteRegDWORD HKCU `Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced` ListviewShadow 1 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" "DisplayName" "${THIS_NAME} v${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" "UninstallString" '"$WINDIR\${THIS_FLDR}\uninst.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" "DisplayIcon" '"$WINDIR\${THIS_FLDR}\uninst.exe"' ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" "Publisher" 'FTPDOWN' ; WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" "URLInfoAbout" 'http://www.ftpdown.com' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" "DisplayVersion" '${VER_MAJOR}.${VER_MINOR}' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" "InstallDir" "$WINDIR\${THIS_FLDR}" WriteUninstaller "$WINDIR\${THIS_FLDR}\uninst.exe" SectionEnd ;Section `UXTheme Multi-Patcher` sec_uxthemepatcher ; SetDetailsPrint none ; RMDir /r $PLUGINSDIR ; SetDetailsPrint both ; File `/oname=$WINDIR\${THIS_FLDR}\UXTheme Multi-Patcher.exe` `.\include\UXTheme Multi-Patcher.exe` ; HideWindow ; nsExec::Exec `$WINDIR\${THIS_FLDR}\UXTheme Multi-Patcher.exe` ; ExecWait `$WINDIR\${THIS_FLDR}\UXTheme Multi-Patcher.exe` ; BringToFront ;SectionEnd Section `-End` sec_end SectionEnd Function .onInit InitPluginsDir ;创建互斥体。只允许一个安装程序实例 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${THIS_NAME}") i .r1 ?e' Pop $0 StrCmp $0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "$(Mutex)" /SD IDOK Quit ${GetDllVersion} $0 `$SYSDIR\user32.dll` ${VerCmp} $0 $0 `5.1` ;只允许在 Windows XP 上运行,5.0 == 2000 5.1 == XP 5.2 == 2003 ${If} $0 = -1 MessageBox MB_OK|MB_ICONEXCLAMATION "$(OS_ERROR)" /SD IDOK Quit ${EndIf} ;检测是否有需要重启后才能执行的操作,避免重复覆盖 GetFunctionAddress $0 CheckRebootFlag StrCpy $1 ${FALSE} ${ReadRegMultiStr} ${HKLM} `SYSTEM\CurrentControlSet\Control\Session Manager` PendingFileRenameOperations $0 ${If} $1 = ${TRUE} MessageBox MB_OK|MB_ICONEXCLAMATION "$(RebootFirst)" /SD IDOK Quit ${EndIf} DisplaySettings::EnumSettings BitsPerPel Pop $0 ${If} $0 = 0 StrCpy $1 ${TRUE} ${EndIf} Pop $R1 Pop $R0 FunctionEnd ; -------------------------------------- ; 卸载段 ; -------------------------------------- Section Uninstall FileOpen $0 `$WINDIR\${THIS_FLDR}\Backup.txt` a Delete /REBOOTOK `$WINDIR\${THIS_FLDR}\Backup.txt` FileClose $0 ${If} ${FileExists} `$WINDIR\${THIS_FLDR}\Backup.txt` WriteRegDWORD HKLM `SYSTEM\CurrentControlSet\Control\Session Manager` "AllowProtectedRenames" 1 Call un.Restore ;恢复安装前的系统文件 ${EndIf} ;恢复覆盖的文件 SetDetailsPrint none CopyFiles /SILENT `$WINDIR\${THIS_FLDR}\Backup\pchealth\*` `$WINDIR\pchealth` SetDetailsPrint both ; 恢复默认的墙纸(如果安装了墙纸) ${If} ${FileExists} `$WINDIR\${THIS_FLDR}\${THIS_NAME_LITE}.${WALLPAPER_TYPE}` ReadRegStr $0 HKCU `Control Panel\Desktop` Wallpaper ${If} $0 == `$WINDIR\${THIS_FLDR}\${THIS_NAME_LITE}.${WALLPAPER_TYPE}` ReadRegStr $0 HKCU `Control Panel\Desktop` PrevWallpaperStyle WriteRegStr HKCU `Control Panel\Desktop` WallpaperStyle $0 ReadRegStr $0 HKCU `Control Panel\Desktop` PrevWallpaper WriteRegStr HKCU `Control Panel\Desktop` Wallpaper $0 ${EndIf} ${EndIf} ; 恢复默认的光标 ${If} ${FileExists} `$WINDIR\${THIS_FLDR}\Cursor\*` WriteRegStr HKCU "Control Panel\Cursors" "" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "Arrow" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "Help" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "AppStarting" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "Wait" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "Crosshair" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "IBeam" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "NWPen" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "No" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeNS" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeWE" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeNWSE" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeNESW" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "SizeAll" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "UpArrow" "" WriteRegExpandStr HKCU "Control Panel\Cursors" "Hand" "" DeleteRegValue HKCU `Control Panel\Cursors\Schemes` `${THIS_NAME_LITE}` ${EndIf} ; 恢复默认的 VS ${If} ${FileExists} `$WINDIR\resources\Themes\${THIS_FLDR}\${THIS_NAME_LITE}.msstyles` WriteRegStr HKCU "Control Panel\Colors" "ActiveTitle" "10 36 106" WriteRegStr HKCU "Control Panel\Colors" "Background" "58 110 165" WriteRegStr HKCU "Control Panel\Colors" "ButtonDkShadow" "64 64 64" WriteRegStr HKCU "Control Panel\Colors" "ButtonFace" "212 208 200" WriteRegStr HKCU "Control Panel\Colors" "ButtonLight" "212 208 200" WriteRegStr HKCU "Control Panel\Colors" "ButtonShadow" "128 128 128" WriteRegStr HKCU "Control Panel\Colors" "GradientActiveTitle" "166 202 240" WriteRegStr HKCU "Control Panel\Colors" "GradientInactiveTitle" "192 192 192" WriteRegStr HKCU "Control Panel\Colors" "GrayText" "128 128 128" WriteRegStr HKCU "Control Panel\Colors" "Hilight" "10 36 106" WriteRegStr HKCU "Control Panel\Colors" "HilightText" "255 255 255" WriteRegStr HKCU "Control Panel\Colors" "HotTrackingColor" "0 0 128" WriteRegStr HKCU "Control Panel\Colors" "InactiveTitle" "128 128 128" WriteRegStr HKCU "Control Panel\Colors" "InactiveTitleText" "212 208 200" WriteRegStr HKCU "Control Panel\Colors" "InfoText" "0 0 0" WriteRegStr HKCU "Control Panel\Colors" "InfoWindow" "255 255 225" WriteRegStr HKCU "Control Panel\Colors" "Menu" "212 208 200" WriteRegStr HKCU "Control Panel\Colors" "TitleText" "255 255 255" WriteRegStr HKCU "Control Panel\Colors" "MenuHilight" "10 36 106" WriteRegStr HKCU "Control Panel\Colors" "MenuBar" "212 208 200" WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "CaptionHeight" "-270" WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "MenuHeight" "-270" WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "SmCaptionHeight" "-180" WriteRegStr HKCU "Control Panel\Desktop\WindowMetrics" "SmCaptionWidth" "-180" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\ThemeManager" "ThemeActive" "0" ${EndIf} ;结束 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${THIS_NAME_LITE}" RMDir /r `$WINDIR\${THIS_FLDR}` ;强制重启后刷新图标 ${SHRegGetPath} $0 ${HKCU} "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" "Local AppData" FileOpen $1 `$0\IconCache.db` a Delete /REBOOTOK `$0\IconCache.db` FileClose $1 ;重启提示 ${If} ${RebootFlag} MessageBox MB_YESNO|MB_ICONEXCLAMATION `$(RebootPrompt)` /SD IDYES IDNO +2 Reboot ${EndIf} SectionEnd Function un.Restore Push $R0 Push $R1 Push $R2 Push $R3 Push $R4 FileOpen $R0 `$WINDIR\${THIS_FLDR}\Backup.txt` r ${Do} FileRead $R0 $R1 ${If} $R1 == `` ${ExitDo} ${EndIf} ${un.TrimLine} $R1 ${un.GetChild} $R2 $R1 ${If} ${FileExists} `$WINDIR\${THIS_FLDR}\Backup\$R2` SetDetailsPrint none ${If} ${FileExists} `$SYSDIR\dllcache\$R2` CopyFiles /SILENT /FILESONLY `$WINDIR\${THIS_FLDR}\Backup\$R2` `$SYSDIR\dllcache` ${EndIf} GetTempFileName $R3 $WINDIR CopyFiles /SILENT /FILESONLY `$WINDIR\${THIS_FLDR}\Backup\$R2` $R3 FileOpen $R4 $R1 a Rename /REBOOTOK $R3 $R1 FileClose $R4 SetDetailsPrint both DetailPrint `$(RestoreAfterReboot) $R1` ${EndIf} ${Loop} FileClose $R0 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Pop $R0 FunctionEnd
引用ioA.ini的内容:
; Ini file generated by the HM NIS Edit IO designer. [Settings] NumFields=4 [Field 1] Type=RadioButton Text=RadioButton Left=20 Right=280 Top=52 Bottom=63 State=1 [Field 2] Type=RadioButton Text=RadioButton Left=20 Right=280 Top=110 Bottom=121 [Field 3] Type=Label Text=Label Left=32 Right=282 Top=70 Bottom=104 [Field 4] Type=Label Text=Label Left=32 Right=284 Top=130 Bottom=159
资源文件点击另存