diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index 4007fb43c0..279cf095f4 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -54,6 +54,9 @@ macro(SET_PACKAGING_PARAMETERS) set(CONSOLE_EXEC_NAME "server-console.exe") + set(DS_EXEC_NAME "domain-server.exe") + set(AC_EXEC_NAME "assignment-client.exe") + # start menu shortcuts set(INTERFACE_SM_SHORTCUT_NAME "High Fidelity") set(CONSOLE_SM_SHORTCUT_NAME "Server Console") diff --git a/cmake/templates/CPackProperties.cmake.in b/cmake/templates/CPackProperties.cmake.in index bf1a4ec033..eb78e5880b 100644 --- a/cmake/templates/CPackProperties.cmake.in +++ b/cmake/templates/CPackProperties.cmake.in @@ -13,6 +13,8 @@ set(INTERFACE_SHORTCUT_NAME "@INTERFACE_SM_SHORTCUT_NAME@") set(INTERFACE_WIN_EXEC_NAME "@INTERFACE_EXEC_PREFIX@.exe") set(CONSOLE_SHORTCUT_NAME "@CONSOLE_SM_SHORTCUT_NAME@") set(CONSOLE_WIN_EXEC_NAME "@CONSOLE_EXEC_NAME@") +set(DS_EXEC_NAME "@DS_EXEC_NAME@") +set(AC_EXEC_NAME "@AC_EXEC_NAME@") set(HIGH_FIDELITY_PROTOCOL "@HIGH_FIDELITY_PROTOCOL@") set(PRODUCTION_BUILD "@PRODUCTION_BUILD@") set(POST_INSTALL_OPTIONS_PATH "@POST_INSTALL_OPTIONS_PATH@") diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index f13862e5cc..b85d5010af 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -984,7 +984,31 @@ Function HandlePostInstallOptions FunctionEnd -!include WinVer.nsh +!define FindProc_NOT_FOUND 1 +!define FindProc_FOUND 0 +!macro FindProc result processName + ExecCmd::exec "%SystemRoot%\System32\tasklist /NH /FI $\"IMAGENAME eq ${processName}$\" | %SystemRoot%\System32\find /I $\"${processName}$\"" + Pop $0 ; The handle for the process + ExecCmd::wait $0 + Pop ${result} ; The exit code +!macroend + +Var processFound + +!macro PromptForRunningApplication applicationName displayName + !insertmacro FindProc $processFound ${applicationName} + + ${If} $processFound == FindProc_FOUND + MessageBox MB_OK|MB_ICONEXCLAMATION "The High Fidelity ${displayName} is running. Please close it first." /SD IDOK + ${EndIf} +!macroend + +!macro CheckForRunningApplications + !insertmacro PromptForRunningApplication "@INTERFACE_WIN_EXEC_NAME@" "Client" + !insertmacro PromptForRunningApplication "@CONSOLE_WIN_EXEC_NAME@" "Server Console" + !insertmacro PromptForRunningApplication "@DS_EXEC_NAME@" "domain-server" + !insertmacro PromptForRunningApplication "@AC_EXEC_NAME@" "assignment-client" +!macroend ;-------------------------------- ; determine admin versus local install @@ -1001,6 +1025,9 @@ Function un.onInit Quit ${EndIf} + ; make sure none of the installed applications are still running + !insertmacro CheckForRunningApplications + ; attempt to elevate the uninstaller to admin status uac_tryagain: !insertmacro UAC_RunElevated