; Script generated by the HM NIS Edit Script Wizard. ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "KDA_v1.0" !define PRODUCT_VERSION "1.0" !define PRODUCT_PUBLISHER "一个极客ageek" !define PRODUCT_WEB_SITE "https://gitee.com/nikolan" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\KDA.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" ; MUI 1.67 compatible ------ !include "MUI.nsh" ; MUI Settings !define MUI_ABORTWARNING !define MUI_ICON "KDA_Logo.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" ; Language Selection Dialog Settings !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language" ; Welcome page !insertmacro MUI_PAGE_WELCOME ; License page !define MUI_LICENSEPAGE_CHECKBOX !insertmacro MUI_PAGE_LICENSE "GPLv2.txt" ; Directory page !insertmacro MUI_PAGE_DIRECTORY ; Start menu page var ICONS_GROUP !define MUI_STARTMENUPAGE_NODISABLE !define MUI_STARTMENUPAGE_DEFAULTFOLDER "KDA_v1.0" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP ; Instfiles page !insertmacro MUI_PAGE_INSTFILES ; Finish page !include "WordFunc.nsh" !define PATH_KEY "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" ;//path对应的HKLM下的注册表项 Section -Post ;获取到系统原有的环境变量 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" ;在原有的环境变量里追加 D:\test 目录 WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0;$INSTDIR" ;刷新环境变量 SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500 SectionEnd !define MUI_FINISHPAGE_RUN "$INSTDIR\KDA.exe" !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_INSTFILES ; Language files !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "SimpChinese" ; MUI end ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "KDA_v1.0安装包.exe" InstallDir "$PROGRAMFILES\KDA_v1.0" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show Function .onInit !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd Section "MainSection" SEC01 SetOutPath "$INSTDIR" SetOverwrite try File "..\Winx64\D3Dcompiler_47.dll" SetOutPath "$INSTDIR\iconengines" File "..\Winx64\iconengines\qsvgicon.dll" SetOutPath "$INSTDIR\imageformats" File "..\Winx64\imageformats\qgif.dll" File "..\Winx64\imageformats\qicns.dll" File "..\Winx64\imageformats\qico.dll" File "..\Winx64\imageformats\qjpeg.dll" File "..\Winx64\imageformats\qsvg.dll" File "..\Winx64\imageformats\qtga.dll" File "..\Winx64\imageformats\qtiff.dll" File "..\Winx64\imageformats\qwbmp.dll" File "..\Winx64\imageformats\qwebp.dll" SetOutPath "$INSTDIR" File "..\Winx64\KDA.exe" File "..\Winx64\libEGL.dll" File "..\Winx64\libgcc_s_seh-1.dll" File "..\Winx64\libGLESV2.dll" File "..\Winx64\libstdc++-6.dll" File "..\Winx64\libwinpthread-1.dll" File "..\Winx64\opengl32sw.dll" SetOutPath "$INSTDIR\platforms" File "..\Winx64\platforms\qwindows.dll" SetOutPath "$INSTDIR" File "..\Winx64\Qt5Charts.dll" File "..\Winx64\Qt5Core.dll" File "..\Winx64\Qt5Gui.dll" File "..\Winx64\Qt5Svg.dll" File "..\Winx64\Qt5Widgets.dll" SetOutPath "$INSTDIR\styles" File "..\Winx64\styles\qwindowsvistastyle.dll" SetOutPath "$INSTDIR\translations" File "..\Winx64\translations\qt_ar.qm" File "..\Winx64\translations\qt_bg.qm" File "..\Winx64\translations\qt_ca.qm" File "..\Winx64\translations\qt_cs.qm" File "..\Winx64\translations\qt_da.qm" File "..\Winx64\translations\qt_de.qm" File "..\Winx64\translations\qt_en.qm" File "..\Winx64\translations\qt_es.qm" File "..\Winx64\translations\qt_fi.qm" File "..\Winx64\translations\qt_fr.qm" File "..\Winx64\translations\qt_gd.qm" File "..\Winx64\translations\qt_he.qm" File "..\Winx64\translations\qt_hu.qm" File "..\Winx64\translations\qt_it.qm" File "..\Winx64\translations\qt_ja.qm" File "..\Winx64\translations\qt_ko.qm" File "..\Winx64\translations\qt_lv.qm" File "..\Winx64\translations\qt_pl.qm" File "..\Winx64\translations\qt_ru.qm" File "..\Winx64\translations\qt_sk.qm" File "..\Winx64\translations\qt_uk.qm" File "..\Winx64\translations\qt_zh_TW.qm" ; Shortcuts !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\KDA_v1.0.lnk" "$INSTDIR\KDA.exe" CreateShortCut "$DESKTOP\KDA_v1.0.lnk" "$INSTDIR\KDA.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd Section -AdditionalIcons SetOutPath $INSTDIR !insertmacro MUI_STARTMENU_WRITE_BEGIN Application WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd Section -Post WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\KDA.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\KDA.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" SectionEnd Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。" FunctionEnd Function un.onInit !insertmacro MUI_UNGETLANGUAGE MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,其及所有的组件?" IDYES +2 Abort FunctionEnd Section Uninstall !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP Delete "$INSTDIR\${PRODUCT_NAME}.url" Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\translations\qt_zh_TW.qm" Delete "$INSTDIR\translations\qt_uk.qm" Delete "$INSTDIR\translations\qt_sk.qm" Delete "$INSTDIR\translations\qt_ru.qm" Delete "$INSTDIR\translations\qt_pl.qm" Delete "$INSTDIR\translations\qt_lv.qm" Delete "$INSTDIR\translations\qt_ko.qm" Delete "$INSTDIR\translations\qt_ja.qm" Delete "$INSTDIR\translations\qt_it.qm" Delete "$INSTDIR\translations\qt_hu.qm" Delete "$INSTDIR\translations\qt_he.qm" Delete "$INSTDIR\translations\qt_gd.qm" Delete "$INSTDIR\translations\qt_fr.qm" Delete "$INSTDIR\translations\qt_fi.qm" Delete "$INSTDIR\translations\qt_es.qm" Delete "$INSTDIR\translations\qt_en.qm" Delete "$INSTDIR\translations\qt_de.qm" Delete "$INSTDIR\translations\qt_da.qm" Delete "$INSTDIR\translations\qt_cs.qm" Delete "$INSTDIR\translations\qt_ca.qm" Delete "$INSTDIR\translations\qt_bg.qm" Delete "$INSTDIR\translations\qt_ar.qm" Delete "$INSTDIR\styles\qwindowsvistastyle.dll" Delete "$INSTDIR\Qt5Widgets.dll" Delete "$INSTDIR\Qt5Svg.dll" Delete "$INSTDIR\Qt5Gui.dll" Delete "$INSTDIR\Qt5Core.dll" Delete "$INSTDIR\Qt5Charts.dll" Delete "$INSTDIR\platforms\qwindows.dll" Delete "$INSTDIR\opengl32sw.dll" Delete "$INSTDIR\libwinpthread-1.dll" Delete "$INSTDIR\libstdc++-6.dll" Delete "$INSTDIR\libGLESV2.dll" Delete "$INSTDIR\libgcc_s_seh-1.dll" Delete "$INSTDIR\libEGL.dll" Delete "$INSTDIR\KDA.exe" Delete "$INSTDIR\imageformats\qwebp.dll" Delete "$INSTDIR\imageformats\qwbmp.dll" Delete "$INSTDIR\imageformats\qtiff.dll" Delete "$INSTDIR\imageformats\qtga.dll" Delete "$INSTDIR\imageformats\qsvg.dll" Delete "$INSTDIR\imageformats\qjpeg.dll" Delete "$INSTDIR\imageformats\qico.dll" Delete "$INSTDIR\imageformats\qicns.dll" Delete "$INSTDIR\imageformats\qgif.dll" Delete "$INSTDIR\iconengines\qsvgicon.dll" Delete "$INSTDIR\D3Dcompiler_47.dll" Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" Delete "$DESKTOP\KDA_v1.0.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\KDA_v1.0.lnk" RMDir "$SMPROGRAMS\$ICONS_GROUP" RMDir "$INSTDIR\translations" RMDir "$INSTDIR\styles" RMDir "$INSTDIR\platforms" RMDir "$INSTDIR\imageformats" RMDir "$INSTDIR\iconengines" RMDir "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true SectionEnd