-
Notifications
You must be signed in to change notification settings - Fork 160
/
MediaInfo_GUI_Windows_x64.nsi
279 lines (248 loc) · 10.8 KB
/
MediaInfo_GUI_Windows_x64.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#NSIS: encoding=UTF-8
; Request application privileges for Windows Vista
RequestExecutionLevel admin
; Some defines
!define PRODUCT_NAME "MediaInfo"
!define PRODUCT_PUBLISHER "MediaArea.net"
!define PRODUCT_VERSION "24.11"
!define PRODUCT_VERSION4 "${PRODUCT_VERSION}.0.0"
!define PRODUCT_WEB_SITE "http://MediaArea.net/MediaInfo"
!define COMPANY_REGISTRY_OLD "Software\MediaArea.net"
!define PRODUCT_REGISTRY_OLD "Software\MediaArea.net\MediaInfo"
!define COMPANY_REGISTRY "Software\MediaArea"
!define PRODUCT_REGISTRY "Software\MediaArea\MediaInfo"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MediaInfo.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; Compression
SetCompressor /FINAL /SOLID lzma
; x64 stuff
!include "x64.nsh"
; Library macros for handling install/uninstall of exe/dll
; https://nsis.sourceforge.io/Docs/AppendixB.html
!include "Library.nsh"
; MediaInfo stuff
!include "MediaInfo_Extensions.nsh"
; File size
!include FileFunc.nsh
!include WinVer.nsh
; Modern UI
!include "MUI2.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "..\..\Source\Resource\Image\MediaInfo.ico"
!define MUI_UNICON "..\..\Source\Resource\Image\MediaInfo.ico"
; Uninstaller signing
!uninstfinalize 'sign.cmd "%1" "MediaInfo Uninstaller"'
; 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"
; Function to launch MediaInfo with same integrity level as Windows Explorer
Function LaunchMediaInfoAsCurrentUser
Exec '"$WINDIR\explorer.exe" "$INSTDIR\MediaInfo.exe"'
FunctionEnd
; Installer pages
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchMediaInfoAsCurrentUser"
!define MUI_WELCOMEFINISHPAGE_BITMAP "..\..\Source\Resource\Image\Windows_Finish.bmp"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
; Language files
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_RESERVEFILE_LANGDLL
; Info
VIProductVersion "${PRODUCT_VERSION4}"
VIAddVersionKey /LANG=0 "CompanyName" "${PRODUCT_PUBLISHER}"
VIAddVersionKey /LANG=0 "ProductName" "${PRODUCT_NAME}"
VIAddVersionKey /LANG=0 "ProductVersion" "${PRODUCT_VERSION4}"
VIAddVersionKey /LANG=0 "FileDescription" "All about your audio and video files"
VIAddVersionKey /LANG=0 "FileVersion" "${PRODUCT_VERSION4}"
VIAddVersionKey /LANG=0 "LegalCopyright" "${PRODUCT_PUBLISHER}"
VIAddVersionKey /LANG=0 "OriginalFilename" "${PRODUCT_NAME}_GUI_${PRODUCT_VERSION}_Windows.exe"
BrandingText " "
; Modern UI end
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "..\..\Release\${PRODUCT_NAME}_GUI_${PRODUCT_VERSION}_Windows_x64.exe"
InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails nevershow
ShowUnInstDetails nevershow
Function .onInit
${If} ${RunningX64}
SetRegView 64
${Else}
MessageBox mb_iconStop "Windows not 64-bit!"
Abort
${EndIf}
!insertmacro MUI_LANGDLL_DISPLAY
; Increment install count
ReadRegDWORD $0 HKCU "${PRODUCT_REGISTRY}" "InstallCount"
IntOp $0 $0 + 1
WriteRegDWORD HKCU "${PRODUCT_REGISTRY}" "InstallCount" $0
FunctionEnd
Section "SectionPrincipale" SEC01
SetOverwrite on
SetOutPath "$SMPROGRAMS"
CreateShortCut "$SMPROGRAMS\MediaInfo.lnk" "$INSTDIR\MediaInfo.exe" "" "" "" "" "" "Convenient unified display of the most relevant technical and tag data for video and audio files"
SetOutPath "$INSTDIR"
File "/oname=History.txt" "..\..\History_GUI.txt"
File "..\..\License.html"
File "/oname=ReadMe.txt" "..\..\Release\ReadMe_GUI_Windows.txt"
; ${If} ${RunningX64}
File "/oname=MediaInfo.exe" "..\..\Project\BCB\GUI\Win64\Release\MediaInfo_GUI.exe"
File "..\..\..\MediaInfoLib\Project\MSVC2022\x64\Release\MediaInfo_InfoTip.dll"
File "..\..\..\MediaInfoLib\Project\MSVC2022\x64\Release\MediaInfo.dll"
File "C:\Program Files (x86)\Embarcadero\Studio\22.0\Redist\win64\WebView2Loader.dll"
File "$%BPATH%\Windows\libcurl\x64\Release\LIBCURL.DLL"
${If} ${AtLeastWin11}
File "..\..\Project\MSVC2022\x64\Release\MediaInfo_SparsePackage.msix"
File "..\..\Project\MSVC2022\x64\Release\MediaInfo_WindowsShellExtension.dll"
File "..\..\Project\MSVC2022\win32\Release\MediaInfo_PackageHelper.dll"
File "..\WindowsSparsePackage\Resources\resources.pri"
SetOutPath "$INSTDIR\Assets"
File "..\WindowsSparsePackage\Resources\Assets\*.png"
${EndIf}
; ${EndIf}
SetOverwrite try
SetOutPath "$INSTDIR\Plugin\Custom"
File "..\Resource\Plugin\Custom\*.csv"
SetOutPath "$INSTDIR\Plugin\Language"
File "..\Resource\Plugin\Language\*.csv"
SetOutPath "$INSTDIR\Plugin\Sheet"
File "..\Resource\Plugin\Sheet\*.csv"
SetOutPath "$INSTDIR\Plugin\Tree"
File "..\Resource\Plugin\Tree\*.csv"
# Create files
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
# Delete files that might be present from older installation
Delete "$INSTDIR\MediaInfo_i386.dll"
Delete "$INSTDIR\History_GUI.txt"
Delete "$INSTDIR\Licence.txt"
Delete "$INSTDIR\Licence.html"
Delete "$INSTDIR\License.txt"
Delete "$INSTDIR\ReadMe_Windows.txt"
Delete "$SMPROGRAMS\MediaInfo\Website.lnk"
Delete "$SMPROGRAMS\MediaInfo\Uninstall.lnk"
Delete "$SMPROGRAMS\MediaInfo\History.lnk"
Delete "$SMPROGRAMS\MediaInfo\MediaInfo.lnk"
RMDir "$SMPROGRAMS\MediaInfo"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\MediaInfo.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\MediaInfo.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
ExecWait '"$SYSDIR\regsvr32.exe" "$INSTDIR\MediaInfo_InfoTip.dll" /s'
!insertmacro MediaInfo_Extensions_Install
${If} ${AtLeastWin11}
System::Call '"$INSTDIR\MediaInfo_PackageHelper.dll"::_Install@0() ? u'
${EndIf}
${If} ${AtLeastWin7}
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0 ; Convert the decimal KB value in $0 to DWORD, put it right back into $0
WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "EstimatedSize" "$0" ; Create/Write the reg key with the dword value
${EndIf}
SectionEnd
Section Uninstall
SetRegView 64
!insertmacro MediaInfo_Extensions_Uninstall
ExecWait '"$SYSDIR\regsvr32.exe" "$INSTDIR\MediaInfo_InfoTip.dll" /u /s'
IfFileExists "$INSTDIR\graph_plugin_uninst.exe" 0 +3
ExecWait '"$INSTDIR\graph_plugin_uninst.exe" /S _?=$INSTDIR'
Delete "$INSTDIR\graph_plugin_uninst.exe"
IfFileExists "$INSTDIR\ffmpeg_plugin_uninst.exe" 0 +3
ExecWait '"$INSTDIR\ffmpeg_plugin_uninst.exe" /S _?=$INSTDIR'
Delete "$INSTDIR\ffmpeg_plugin_uninst.exe"
${If} ${AtLeastWin11}
System::Call '"$INSTDIR\MediaInfo_PackageHelper.dll"::_Uninstall@0() ? u'
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\MediaInfo_PackageHelper.dll"
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\MediaInfo_WindowsShellExtension.dll"
Delete "$INSTDIR\MediaInfo_SparsePackage.msix"
Delete "$INSTDIR\resources.pri"
Delete "$INSTDIR\Assets\*.png"
RMDir "$INSTDIR\Assets"
${EndIf}
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\MediaInfo.exe"
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\MediaInfo.dll"
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\MediaInfo_i386.dll"
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\MediaInfo_InfoTip.dll"
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_NOTPROTECTED "$INSTDIR\WebView2Loader.dll"
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\History.txt"
Delete "$INSTDIR\License.html"
Delete "$INSTDIR\License.NoModifications.html"
Delete "$INSTDIR\ReadMe.txt"
Delete "$INSTDIR\curl-ca-bundle.crt"
Delete "$INSTDIR\LIBCURL.DLL"
Delete "$INSTDIR\Plugin\MediaInfo.cfg"
Delete "$INSTDIR\Plugin\Custom\*.csv"
Delete "$INSTDIR\Plugin\Language\*.csv"
Delete "$INSTDIR\Plugin\Sheet\*.csv"
Delete "$INSTDIR\Plugin\Tree\*.csv"
Delete "$SMPROGRAMS\MediaInfo\Uninstall.lnk"
Delete "$SMPROGRAMS\MediaInfo\Website.lnk"
Delete "$SMPROGRAMS\MediaInfo\MediaInfo.lnk"
Delete "$SMPROGRAMS\MediaInfo\History.lnk"
Delete "$SMPROGRAMS\MediaInfo.lnk"
RMDir "$SMPROGRAMS\MediaInfo"
RMDir "$INSTDIR\Plugin\Custom"
RMDir "$INSTDIR\Plugin\Language"
RMDir "$INSTDIR\Plugin\Sheet"
RMDir "$INSTDIR\Plugin\Tree"
RMDir "$INSTDIR\Plugin"
RMDir /r "$INSTDIR\WebView2"
RMDir "$INSTDIR"
SetRegView 64
DeleteRegKey HKLM "${PRODUCT_REGISTRY}"
DeleteRegKey /ifempty HKLM "${COMPANY_REGISTRY}"
DeleteRegKey HKCU "${PRODUCT_REGISTRY}"
DeleteRegKey /ifempty HKCU "${COMPANY_REGISTRY}"
DeleteRegKey HKLM "${PRODUCT_REGISTRY_OLD}"
DeleteRegKey /ifempty HKLM "${COMPANY_REGISTRY_OLD}"
DeleteRegKey HKCU "${PRODUCT_REGISTRY_OLD}"
DeleteRegKey /ifempty HKCU "${COMPANY_REGISTRY_OLD}"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd