Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Section "Main"
- ;CheckINI:
- ;=== Find the INI file, if there is one
- IfFileExists "$EXEDIR\${NAME}.ini" "" NoINI
- StrCpy $INIPATH "$EXEDIR"
- ;=== Read the parameters from the INI file
- ${ReadINIStrWithDefault} $0 "$INIPATH\${NAME}.ini" "${NAME}" "${APPNAME}Directory" "App\${DEFAULTAPPDIR}"
- StrCpy $PROGRAMDIRECTORY "$EXEDIR\$0"
- ${ReadINIStrWithDefault} $0 "$INIPATH\${NAME}.ini" "${NAME}" "SettingsDirectory" "Data\${DEFAULTSETTINGSDIR}"
- StrCpy $SETTINGSDIRECTORY "$EXEDIR\$0"
- ${ReadINIStrWithDefault} $PROGRAMEXECUTABLE "$INIPATH\${NAME}.ini" "${NAME}" "${APPNAME}Executable" "${DEFAULTEXE}"
- ${ReadINIStrWithDefault} $ADDITIONALPARAMETERS "$INIPATH\${NAME}.ini" "${NAME}" "AdditionalParameters" ""
- ${ReadINIStrWithDefault} $DISABLESPLASHSCREEN "$INIPATH\${NAME}.ini" "${NAME}" "DisableSplashScreen" "false"
- IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" FoundProgramEXE NoProgramEXE
- NoINI:
- ;=== No INI file, so we'll use the defaults
- StrCpy $PROGRAMEXECUTABLE "${DEFAULTEXE}"
- StrCpy $ADDITIONALPARAMETERS ""
- StrCpy $DISABLESPLASHSCREEN "false"
- IfFileExists "$EXEDIR\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" NoProgramEXE
- StrCpy $PROGRAMDIRECTORY "$EXEDIR\App\${DEFAULTAPPDIR}"
- StrCpy $SETTINGSDIRECTORY "$EXEDIR\Data\${DEFAULTSETTINGSDIR}"
- Goto FoundProgramEXE
- NoProgramEXE:
- ;=== Program executable not where expected
- StrCpy $MISSINGFILEORPATH $PROGRAMEXECUTABLE
- MessageBox MB_OK|MB_SETFOREGROUND|MB_ICONEXCLAMATION `$(LauncherFileNotFound)`
- Goto TheEnd
- FoundProgramEXE:
- ;=== Check if already running
- System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e'
- Pop $0
- StrCmp $0 0 CheckAppRunning
- StrCpy $SECONDARYLAUNCH "true"
- CheckAppRunning:
- FindProcDLL::FindProc "${DEFAULTEXE}"
- StrCmp $R0 "1" WarnAnotherInstance
- StrCmp $SECONDARYLAUNCH "true" TheEnd DisplaySplash
- WarnAnotherInstance:
- StrCmp $SECONDARYLAUNCH "true" GetPassedParameters
- MessageBox MB_OK|MB_SETFOREGROUND|MB_ICONINFORMATION `$(LauncherAlreadyRunning)`
- Goto TheEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement