mp-installer.nsi 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. ; Script generated with the Venis Install Wizard
  2. Unicode true
  3. ; Define your application name
  4. !define APPNAME "OBS Studio"
  5. !ifndef APPVERSION
  6. !define APPVERSION "17.0.2"
  7. !define SHORTVERSION "17.0.2"
  8. !endif
  9. !define APPNAMEANDVERSION "OBS Studio ${SHORTVERSION}"
  10. ; !define FULL
  11. !define REALSENSE_PLUGIN
  12. ; Additional script dependencies
  13. !include WinVer.nsh
  14. !include x64.nsh
  15. ; Main Install settings
  16. Name "${APPNAMEANDVERSION}"
  17. InstallDir "$PROGRAMFILES32\obs-studio"
  18. InstallDirRegKey HKLM "Software\${APPNAME}" ""
  19. !ifdef FULL
  20. OutFile "OBS-Studio-${SHORTVERSION}-Full-Installer.exe"
  21. !else
  22. OutFile "OBS-Studio-${SHORTVERSION}-Small-Installer.exe"
  23. !endif
  24. ; Use compression
  25. SetCompressor /SOLID LZMA
  26. ; Need Admin
  27. RequestExecutionLevel admin
  28. ; Modern interface settings
  29. !include "MUI.nsh"
  30. !define MUI_ABORTWARNING
  31. !define MUI_FINISHPAGE_RUN
  32. !define MUI_FINISHPAGE_RUN_TEXT "Launch OBS Studio ${SHORTVERSION}"
  33. !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchOBS"
  34. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE PreReqCheck
  35. !insertmacro MUI_PAGE_WELCOME
  36. !insertmacro MUI_PAGE_LICENSE "new\core\data\obs-studio\license\gplv2.txt"
  37. !insertmacro MUI_PAGE_DIRECTORY
  38. !ifdef FULL
  39. !insertmacro MUI_PAGE_COMPONENTS
  40. !endif
  41. !insertmacro MUI_PAGE_INSTFILES
  42. !insertmacro MUI_PAGE_FINISH
  43. ;!insertmacro MUI_UNPAGE_CONFIRM
  44. !insertmacro MUI_UNPAGE_COMPONENTS
  45. !insertmacro MUI_UNPAGE_INSTFILES
  46. ; Set languages (first is default language)
  47. !insertmacro MUI_LANGUAGE "English"
  48. !insertmacro MUI_RESERVEFILE_LANGDLL
  49. Function PreReqCheck
  50. ; Abort on XP or lower
  51. ${If} ${AtMostWinXP}
  52. MessageBox MB_OK|MB_ICONSTOP "Due to extensive use of DirectX 10 features, ${APPNAME} requires Windows Vista SP2 or higher and cannot be installed on this version of Windows."
  53. Quit
  54. ${EndIf}
  55. ; Vista specific checks
  56. ${If} ${IsWinVista}
  57. ; Check Vista SP2
  58. ${If} ${AtMostServicePack} 1
  59. MessageBox MB_YESNO|MB_ICONEXCLAMATION "${APPNAME} requires Service Pack 2 when running on Vista. Would you like to download it?" IDYES sptrue IDNO spfalse
  60. sptrue:
  61. ExecShell "open" "http://windows.microsoft.com/en-US/windows-vista/Learn-how-to-install-Windows-Vista-Service-Pack-2-SP2"
  62. spfalse:
  63. Quit
  64. ${EndIf}
  65. ; Check Vista Platform Update
  66. nsexec::exectostack "$SYSDIR\wbem\wmic.exe qfe where HotFixID='KB971512' get HotFixID /Format:list"
  67. pop $0
  68. pop $0
  69. strcpy $1 $0 17 6
  70. strcmps $1 "HotFixID=KB971512" gotPatch
  71. MessageBox MB_YESNO|MB_ICONEXCLAMATION "${APPNAME} requires the Windows Vista Platform Update. Would you like to download it?" IDYES putrue IDNO pufalse
  72. putrue:
  73. ${If} ${RunningX64}
  74. ; 64 bit
  75. ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=4390"
  76. ${Else}
  77. ; 32 bit
  78. ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=3274"
  79. ${EndIf}
  80. pufalse:
  81. Quit
  82. gotPatch:
  83. ${EndIf}
  84. ; 32 bit Visual Studio 2013 runtime check
  85. ClearErrors
  86. GetDLLVersion "MSVCR120.DLL" $R0 $R1
  87. GetDLLVersion "MSVCP120.DLL" $R0 $R1
  88. IfErrors vs2013Missing vs2013OK1
  89. vs2013Missing:
  90. MessageBox MB_YESNO|MB_ICONEXCLAMATION "Your system is missing runtime components that ${APPNAME} requires. Please make sure to install both vcredist_x64 and vcredist_x86. Would you like to download them?" IDYES vs2013true IDNO vs2013false
  91. vs2013true:
  92. ExecShell "open" "https://obsproject.com/visual-studio-2013-runtimes"
  93. vs2013false:
  94. Quit
  95. vs2013OK1:
  96. ClearErrors
  97. ; 64 bit Visual Studio 2013 runtime check
  98. ${if} ${RunningX64}
  99. SetOutPath "$TEMP\OBS"
  100. File check_for_64bit_visual_studio_2013_runtimes.exe
  101. ExecWait "$TEMP\OBS\check_for_64bit_visual_studio_2013_runtimes.exe" $R0
  102. Delete "$TEMP\OBS\check_for_64bit_visual_studio_2013_runtimes.exe"
  103. RMDir "$TEMP\OBS"
  104. IntCmp $R0 126 vs2013Missing vs2013OK2
  105. vs2013OK2:
  106. ClearErrors
  107. ${endif}
  108. ; DirectX Version Check
  109. ClearErrors
  110. GetDLLVersion "D3DCompiler_33.dll" $R0 $R1
  111. IfErrors dxMissing33 dxOK
  112. dxMissing33:
  113. ClearErrors
  114. GetDLLVersion "D3DCompiler_34.dll" $R0 $R1
  115. IfErrors dxMissing34 dxOK
  116. dxMissing34:
  117. ClearErrors
  118. GetDLLVersion "D3DCompiler_35.dll" $R0 $R1
  119. IfErrors dxMissing35 dxOK
  120. dxMissing35:
  121. ClearErrors
  122. GetDLLVersion "D3DCompiler_36.dll" $R0 $R1
  123. IfErrors dxMissing36 dxOK
  124. dxMissing36:
  125. ClearErrors
  126. GetDLLVersion "D3DCompiler_37.dll" $R0 $R1
  127. IfErrors dxMissing37 dxOK
  128. dxMissing37:
  129. ClearErrors
  130. GetDLLVersion "D3DCompiler_38.dll" $R0 $R1
  131. IfErrors dxMissing38 dxOK
  132. dxMissing38:
  133. ClearErrors
  134. GetDLLVersion "D3DCompiler_39.dll" $R0 $R1
  135. IfErrors dxMissing39 dxOK
  136. dxMissing39:
  137. ClearErrors
  138. GetDLLVersion "D3DCompiler_40.dll" $R0 $R1
  139. IfErrors dxMissing40 dxOK
  140. dxMissing40:
  141. ClearErrors
  142. GetDLLVersion "D3DCompiler_41.dll" $R0 $R1
  143. IfErrors dxMissing41 dxOK
  144. dxMissing41:
  145. ClearErrors
  146. GetDLLVersion "D3DCompiler_42.dll" $R0 $R1
  147. IfErrors dxMissing42 dxOK
  148. dxMissing42:
  149. ClearErrors
  150. GetDLLVersion "D3DCompiler_43.dll" $R0 $R1
  151. IfErrors dxMissing43 dxOK
  152. dxMissing43:
  153. ClearErrors
  154. GetDLLVersion "D3DCompiler_47.dll" $R0 $R1
  155. IfErrors dxMissing47 dxOK
  156. dxMissing47:
  157. MessageBox MB_YESNO|MB_ICONEXCLAMATION "Your system is missing DirectX components that ${APPNAME} requires. Would you like to download them?" IDYES dxtrue IDNO dxfalse
  158. dxtrue:
  159. ExecShell "open" "https://obsproject.com/go/dxwebsetup"
  160. dxfalse:
  161. Quit
  162. dxOK:
  163. ClearErrors
  164. ; Check previous instance
  165. OBSInstallerUtils::IsProcessRunning "obs32.exe"
  166. IntCmp $R0 1 0 notRunning1
  167. MessageBox MB_OK|MB_ICONEXCLAMATION "${APPNAME} is already running. Please close it first before installing a new version." /SD IDOK
  168. Quit
  169. notRunning1:
  170. ${if} ${RunningX64}
  171. OBSInstallerUtils::IsProcessRunning "obs64.exe"
  172. IntCmp $R0 1 0 notRunning2
  173. MessageBox MB_OK|MB_ICONEXCLAMATION "${APPNAME} is already running. Please close it first before installing a new version." /SD IDOK
  174. Quit
  175. notRunning2:
  176. ${endif}
  177. OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-capture\graphics-hook32.dll"
  178. OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-capture\graphics-hook64.dll"
  179. OBSInstallerUtils::GetAppNameForInUseFiles
  180. StrCmp $R0 "" gameCaptureNotRunning
  181. MessageBox MB_OK|MB_ICONEXCLAMATION "Game Capture is still in use by the following applications:$\r$\n$\r$\n$R0$\r$\nPlease close these applications before installing a new version of OBS." /SD IDOK
  182. Quit
  183. gameCaptureNotRunning:
  184. FunctionEnd
  185. Function filesInUse
  186. MessageBox MB_OK|MB_ICONEXCLAMATION "Some files were not able to be installed. If this is the first time you are installing OBS, please disable any anti-virus or other security software and try again. If you are re-installing or updating OBS, close any applications that may be have been hooked, or reboot and try again." /SD IDOK
  187. FunctionEnd
  188. Function LaunchOBS
  189. ${if} ${RunningX64}
  190. Exec '"$WINDIR\explorer.exe" "$SMPROGRAMS\OBS Studio\OBS Studio (64bit).lnk"'
  191. ${else}
  192. Exec '"$WINDIR\explorer.exe" "$SMPROGRAMS\OBS Studio\OBS Studio (32bit).lnk"'
  193. ${endif}
  194. FunctionEnd
  195. Var outputErrors
  196. Section "OBS Studio" SecCore
  197. ; Set Section properties
  198. SectionIn RO
  199. SetOverwrite on
  200. AllowSkipFiles off
  201. SetShellVarContext all
  202. ; Set Section Files and Shortcuts
  203. SetOutPath "$INSTDIR"
  204. OBSInstallerUtils::KillProcess "obs-plugins\32bit\cef-bootstrap.exe"
  205. OBSInstallerUtils::KillProcess "obs-plugins\64bit\cef-bootstrap.exe"
  206. File /r "new\core\data"
  207. SetOutPath "$INSTDIR\bin"
  208. File /r "new\core\bin\32bit"
  209. SetOutPath "$INSTDIR\obs-plugins"
  210. File /r "new\core\obs-plugins\32bit"
  211. ${if} ${RunningX64}
  212. SetOutPath "$INSTDIR\bin"
  213. File /r "new\core\bin\64bit"
  214. SetOutPath "$INSTDIR\obs-plugins"
  215. File /r "new\core\obs-plugins\64bit"
  216. ${endif}
  217. ClearErrors
  218. IfErrors 0 +2
  219. StrCpy $outputErrors "yes"
  220. WriteUninstaller "$INSTDIR\uninstall.exe"
  221. ; Delete Old "Multiplatform" Shortcuts
  222. Delete "$DESKTOP\OBS Multiplatform.lnk"
  223. Delete "$SMPROGRAMS\OBS Multiplatform\OBS Multiplatform (32bit).lnk"
  224. Delete "$SMPROGRAMS\OBS Multiplatform\Uninstall.lnk"
  225. ${if} ${RunningX64}
  226. Delete "$SMPROGRAMS\OBS Multiplatform\OBS Multiplatform (64bit).lnk"
  227. ${endif}
  228. ${if} ${RunningX64}
  229. SetOutPath "$INSTDIR\bin\64bit"
  230. CreateShortCut "$DESKTOP\OBS Studio.lnk" "$INSTDIR\bin\64bit\obs64.exe"
  231. ${else}
  232. SetOutPath "$INSTDIR\bin\32bit"
  233. CreateShortCut "$DESKTOP\OBS Studio.lnk" "$INSTDIR\bin\32bit\obs32.exe"
  234. ${endif}
  235. SetOutPath "$INSTDIR\bin\32bit"
  236. CreateDirectory "$SMPROGRAMS\OBS Studio"
  237. CreateShortCut "$SMPROGRAMS\OBS Studio\OBS Studio (32bit).lnk" "$INSTDIR\bin\32bit\obs32.exe"
  238. CreateShortCut "$SMPROGRAMS\OBS Studio\Uninstall.lnk" "$INSTDIR\uninstall.exe"
  239. ${if} ${RunningX64}
  240. SetOutPath "$INSTDIR\bin\64bit"
  241. CreateShortCut "$SMPROGRAMS\OBS Studio\OBS Studio (64bit).lnk" "$INSTDIR\bin\64bit\obs64.exe"
  242. ${endif}
  243. SetOutPath "$INSTDIR\bin\32bit"
  244. StrCmp $outputErrors "yes" 0 +2
  245. Call filesInUse
  246. SectionEnd
  247. !ifdef FULL
  248. SectionGroup /e "Plugins" SecPlugins
  249. Section "Browser Source" SecPlugins_Browser
  250. ; Set Section properties
  251. SetOverwrite on
  252. AllowSkipFiles off
  253. SetShellVarContext all
  254. SetOutPath "$INSTDIR\obs-plugins"
  255. OBSInstallerUtils::KillProcess "32bit\cef-bootstrap.exe"
  256. File /r "new\obs-browser\obs-plugins\32bit"
  257. ${if} ${RunningX64}
  258. OBSInstallerUtils::KillProcess "64bit\cef-bootstrap.exe"
  259. File /r "new\obs-browser\obs-plugins\64bit"
  260. ${endif}
  261. SetOutPath "$INSTDIR\bin\32bit"
  262. SectionEnd
  263. !ifdef REALSENSE_PLUGIN
  264. Section /o "Realsense Source" SecPlugins_Realsense
  265. SetOverwrite on
  266. AllowSkipFiles off
  267. SetShellVarContext all
  268. SetOutPath "$INSTDIR\obs-plugins"
  269. File /r "new\realsense\obs-plugins\32bit"
  270. ${if} ${RunningX64}
  271. File /r "new\realsense\obs-plugins\64bit"
  272. ${endif}
  273. SetOutPath "$INSTDIR\data\obs-plugins"
  274. File /r "new\realsense\data\obs-plugins\win-ivcam"
  275. ExecWait '"$INSTDIR\data\obs-plugins\win-ivcam\seg_service.exe" /UnregServer'
  276. ExecWait '"$INSTDIR\data\obs-plugins\win-ivcam\seg_service.exe" /RegServer'
  277. ReadRegStr $0 HKLM "Software\Intel\RSSDK\Dispatch" "Core"
  278. ${if} ${Errors}
  279. ReadRegStr $0 HKLM "Software\Intel\RSSDK\v10\Dispatch" "Core"
  280. ${endif}
  281. ${if} ${Errors}
  282. InitPluginsDir
  283. SetOutPath "$PLUGINSDIR\realsense"
  284. File "intel_rs_sdk_runtime_websetup_10.0.26.0396.exe"
  285. ExecWait '"$PLUGINSDIR\realsense\intel_rs_sdk_runtime_websetup_10.0.26.0396.exe" --finstall=personify --fnone=all'
  286. ${endif}
  287. SetOutPath "$INSTDIR\bin\32bit"
  288. SectionEnd
  289. !endif
  290. SectionGroupEnd
  291. !endif
  292. Section -FinishSection
  293. WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
  294. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
  295. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
  296. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "ProductID" "d16d2409-3151-4331-a9b1-dfd8cf3f0d9c"
  297. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$INSTDIR\bin\32bit\obs32.exe"
  298. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "OBS Project"
  299. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "https://obsproject.com"
  300. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${APPVERSION}"
  301. SectionEnd
  302. ; Modern install component descriptions
  303. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  304. !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "Core OBS Studio files"
  305. !ifdef FULL
  306. !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Optional Plugins"
  307. !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins_Browser} "Browser plugin (a source you can add to your scenes that displays web pages)"
  308. !ifdef REALSENSE_PLUGIN
  309. !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins_Realsense} "Plugin for Realsense cameras"
  310. !endif
  311. !endif
  312. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  313. ;Uninstall section
  314. Section "un.obs-studio Program Files" UninstallSection1
  315. SectionIn RO
  316. ;Remove from registry...
  317. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
  318. DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
  319. ; Delete self
  320. Delete "$INSTDIR\uninstall.exe"
  321. ; Delete Shortcuts
  322. Delete "$DESKTOP\OBS Studio.lnk"
  323. Delete "$SMPROGRAMS\OBS Studio\OBS Studio (32bit).lnk"
  324. Delete "$SMPROGRAMS\OBS Studio\Uninstall.lnk"
  325. ${if} ${RunningX64}
  326. Delete "$SMPROGRAMS\OBS Studio\OBS Studio (64bit).lnk"
  327. ${endif}
  328. IfFileExists "$INSTDIR\data\obs-plugins\win-ivcam\seg_service.exe" UnregisterSegService SkipUnreg
  329. UnregisterSegService:
  330. ExecWait '"$INSTDIR\data\obs-plugins\win-ivcam\seg_service.exe" /UnregServer'
  331. SkipUnreg:
  332. ; Clean up OBS Studio
  333. RMDir /r "$INSTDIR\bin"
  334. RMDir /r "$INSTDIR\data"
  335. RMDir /r "$INSTDIR\obs-plugins"
  336. RMDir "$INSTDIR"
  337. ; Remove remaining directories
  338. RMDir "$SMPROGRAMS\OBS Studio"
  339. RMDir "$INSTDIR\OBS Studio"
  340. SectionEnd
  341. Section /o "un.User Settings" UninstallSection2
  342. RMDir /R "$APPDATA\obs-studio"
  343. SectionEnd
  344. !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
  345. !insertmacro MUI_DESCRIPTION_TEXT ${UninstallSection1} "Remove the OBS program files."
  346. !insertmacro MUI_DESCRIPTION_TEXT ${UninstallSection2} "Removes all settings, plugins, scenes and sources, profiles, log files and other application data."
  347. !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
  348. ; Version information
  349. VIProductVersion "${APPVERSION}.0"
  350. VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "OBS Studio"
  351. VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "obsproject.com"
  352. VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "(c) 2012-2016"
  353. ; FileDescription is what shows in the UAC elevation prompt when signed
  354. VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "OBS Studio"
  355. VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.0"
  356. ; eof