;*************************************************************************************************** ; include better ui (modern ui) !include "mui.nsh" ; include logic functions !include LogicLib.nsh ;*************************************************************************************************** ;Variables Var StartMenuFolder Var ApplicationExec ;*************************************************************************************************** ; General !define PRODUCT_NAME "3D_IVDS" !define PRODUCT_NAME_CLIENT "3D_IVDS client" !define EXE_NAME_SERVER "3D_IVDS.exe" !define EXE_NAME_CLIENT "3D_IVDS_client.exe" !define PRODUCT_VERSION "1.0" !define PRODUCT_PUBLISHER "Stephan Plaschke" !define PRODUCT_WEB_SITE "http://cms-server.ti-mmlab.haw-hamburg.de/typo4/" Name "${PRODUCT_NAME}" OutFile "Setup.exe" InstallDir $PROGRAMFILES\${PRODUCT_NAME} ; Zeige im Falle eines Installationsabbruchs eine Warnung !define MUI_ABORTWARNING ; Definiere den Text der Warnung !define MUI_ABORTWARNING_TEXT "Are you sure you want to quit the installation process?" ; Setze den "Abbrechen" Button als default !define MUI_ABORTWARNING_CANCEL_DEFAULT !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${EXE_NAME_SERVER}" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ; write file definitions VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "3D_IVDS" VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "MMLab" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Test Application is a trademark of MMLab" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© MMLab" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Viewer for 3D images in distributed systems" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.2.3" VIProductVersion "1.0.0.0" ; get user level for windows VISTA and 7 ;RequestExecutionLevel user ;*************************************************************************************************** ; Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "gpl-3.0.txt" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder !insertmacro MUI_PAGE_INSTFILES ; füge Häkchen zur sofortigen Ausführung ein !define MUI_FINISHPAGE_RUN $ApplicationExec !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; setze Sprache !insertmacro MUI_LANGUAGE "English" ShowInstDetails show ShowUnInstDetails show InstType "Server" InstType "Client" InstType /NOCUSTOM Section "Server Program" SEC01 ; only server part SectionIn 1 RO SetOutPath $INSTDIR SetOverwrite ifnewer ;kopiere die .exe-Datei ins Installationsverzeichnis File ${EXE_NAME_SERVER} ;kopiere die Bibliotheken ins Installationsverzeichnis File QtCore4.dll File QtGui4.dll ;Lege Startmenü-Eintrag an ($SMPROGRAMS entspricht dem Startmenü-Ordner) CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXE_NAME_SERVER}" ;Erstelle Icons für Uninstaller CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" StrCpy $ApplicationExec "$INSTDIR\${EXE_NAME_SERVER}" SectionEnd Section "Client Program" SEC02 ; only client part SectionIn 2 RO SetOutPath $INSTDIR SetOverwrite ifnewer ;kopiere die .exe-Datei ins Installationsverzeichnis File ${EXE_NAME_CLIENT} ;kopiere die Bibliotheken ins Installationsverzeichnis File QtCore4.dll File QtGui4.dll ;Lege Startmenü-Eintrag an ($SMPROGRAMS entspricht dem Startmenü-Ordner) CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME_CLIENT}.lnk" "$INSTDIR\${EXE_NAME_CLIENT} " ;CreateShortCut "$SMSTARTUP\${PRODUCT_NAME_CLIENT}.lnk" "$INSTDIR\${EXE_NAME_CLIENT} "" "$INSTDIR\${EXE_NAME_CLIENT}" ;Erstelle Icons für Uninstaller CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" ; create autostart link ; here I define the key which makes the problem ;WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Run" \ ; ${PRODUCT_NAME} "$INSTDIR\${EXE_NAME_CLIENT}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run\" "${PRODUCT_NAME}" "$INSTDIR\${EXE_NAME_CLIENT}" ;MessageBox MB_OK "The Application is running on Windows Start" ;MessageBox MB_YESNO|MB_ICONQUESTION "Do you wish to reboot the system?" IDNO +2 ;Reboot StrCpy $ApplicationExec "$INSTDIR\${EXE_NAME_CLIENT}" SectionEnd ; check if a version is already running Function .onInit System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e' Pop $R0 StrCmp $R0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." Abort FunctionEnd Section -Post WriteUninstaller $INSTDIR\uninstall.exe WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "$(^Name)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_NAME}" 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}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" 1 SectionEnd ;Meldung bei Erfolg Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer" FunctionEnd ;Meldung bei Initialisierung Function un.onInit MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 Abort FunctionEnd ;Sektion Uninstall Section Uninstall ;Lösche die Dateien aus dem Programmordner Delete $INSTDIR\uninstall.exe Delete $INSTDIR\${EXE_NAME_SERVER} Delete $INSTDIR\${EXE_NAME_CLIENT} Delete $INSTDIR\QtCore4.dll Delete $INSTDIR\QtGui4.dll ;Entferne den Programmordner RMDir $INSTDIR ;Lösche alle Dateien aus dem Startmenü-Ordner Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME_CLIENT}.lnk" Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" ;Delete "$SMPROGRAMS\$StartMenuFolder}\*.*" ;Lösche den Startmenü-Ordner RMDir "$SMPROGRAMS\${PRODUCT_NAME}" ; delete all registry entries ;DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Run\${PRODUCT_NAME}" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Run\${PRODUCT_NAME}" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" SectionEnd