Debian Codegraph @

Docs/src/library.but

raw
1 \A{library} DLL/TLB Library Setup
2
3
4 \H{library_intro} Introduction
5
6 The Library header file can be used to setup dynamic link libraries (DLL) and type libraries (TLB).
7 If necessary, the following actions will be performed:
8
9 \b File copying
10
11 \b File copying on reboot
12
13 \b Version checks
14
15 \b Registration and unregistration
16
17 \b Registration and unregistration on reboot
18
19 \b Shared DLL counting
20
21 \b Windows File Protection checks
22
23 The macros are stored in the header file Library.nsh, which should be included in scripts using this system:
24
25 \c !include Library.nsh
26
27 Note that the library macros are limited on non-Windows platforms. DLL version information is required when compiling on non-Windows platforms.
28
29
30 \H{library_install} Library Installation
31
32 \S1{} Introduction
33
34 The InstallLib macro allows you to install a library. It sets the error flag if something went wrong during library setup.
35
36 To ask the user for a reboot, if required, use the Modern UI with a Finish page or use \R{ifrebootflag}{IfRebootFlag} and make your own page or message box.
37
38 \S1{library_install_parameters} Parameters
39
40 \c libtype shared install localfile destfile tempbasedir
41
42 \\<b\\>libtype\\</b\\>
43
44 The type of the library
45
46 DLL - Dynamic link library (DLL)\\<br\\>
47 REGDLL - DLL that has to be registered\\<br\\>
48 REGEXE - EXE COM server that has to be registered using /regserver\\<br\\>
49 TLB - Type library or DLL that contains a type library\\<br\\>
50 REGDLLTLB - DLL that has to be registered and contains a type library\\<br\\>
51
52
53 \\<b\\>shared\\</b\\>
54
55 Specify whether the library is shared with other applications
56
57 NOTSHARED - The library is not shared\\<br\\>
58 $VARNAME - Variable that is empty when the application is installed for the first time,
59 which is when the shared library count will be increased.\\<br\\>
60
61 \\<b\\>install\\</b\\>
62
63 Specify the installation method
64
65 REBOOT_PROTECTED
66
67 \b Upgrade the library on reboot when in use (required for system files).
68
69 \b Upgrade the library if the file is not protected by Windows File Protection.
70
71 NOREBOOT_PROTECTED
72
73 \b Warns the user when the library is in use. The user will have to close applications using the library.
74
75 \b Upgrade the library if the file is not protected by Windows File Protection.
76
77 REBOOT_NOTPROTECTED
78
79 \b Upgrade the library on reboot when in use (required for system files).
80
81 \b Upgrade the library without checking for Windows File Protection.
82
83 NOREBOOT_NOTPROTECTED
84
85 \b Warns the user when the library is in use. The user will have to close applications using the library.
86
87 \b Upgrade the library without checking for Windows File Protection.
88
89 \\<b\\>localfile\\</b\\>
90
91 Location of the library on the compiler system
92
93 \\<b\\>destfile\\</b\\>
94
95 Location to store the library on the user's system
96
97 \\<b\\>tempbasedir\\</b\\>
98
99 Directory on the user's system to store a temporary file when the system has to be rebooted.
100
101 For Windows 9x/ME support, this directory should be on the same volume as the destination file (destfile).
102 The Windows temp directory could be located on any volume, so you cannot use this directory.
103
104 \S1{library_install_options} Options
105
106 \R{define}{Define} any of the following before inserting a InstallLib macro to modify its behavior as specified.
107
108 \S2{} LIBRARY_X64
109
110 \b Installs a DLL built for Windows x64.
111
112 \b \s{Warning:} This resets \R{setregview}{SetRegView} and file system redirection.
113
114 \S2{} LIBRARY_SHELL_EXTENSION
115
116 \b Define this before inserting InstallLib macro to call SHChangeNotify with SHCNE_ASSOCCHANGED after registration.
117
118 \b Use this to refresh the shell when installing a shell extension or when changing file associations.
119
120 \S2{} LIBRARY_COM
121
122 \b Define this before inserting InstallLib macro to call CoFreeUnusedLibraries after registration.
123
124 \b Use this for unloading all unnecessary libraries from memory when installing COM libraries.
125
126 \S2{} LIBRARY_IGNORE_VERSION
127
128 \b Define this before inserting InstallLib macro to ignore version information in the file and always install it, even if it already exists.
129
130 \b Use this when an older or specific version is required.
131
132 \b Not recommended for DLLs installed to $SYSDIR.
133
134 \S2{} LIBRARY_INSTALL_EQUAL_VERSION
135
136 \b Define this before inserting InstallLib macro to overwrite the file even if the version is the same as the existing file.
137
138 \S1{library_install_notes} Notes
139
140 \b If you need to support Windows 9x/ME, you can only use short filenames (8.3).
141
142 \b \s{Warning:} Always use redistributable files when deploying DLLs, never copy files from your system directory!
143
144 \S1{library_install_examples} Example
145
146 \S2{} Unshared DLL
147
148 \c !insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED dllname.dll $SYSDIR\dllname.dll $SYSDIR
149
150 \S2{} Shared DLL
151
152 \c ;Add code here that sets $ALREADY_INSTALLED to a non-zero value if the application is
153 \c ;already installed. For example:
154 \c
155 \c IfFileExists "$INSTDIR\MyApp.exe" 0 new_installation ;Replace MyApp.exe with your application filename
156 \c StrCpy $ALREADY_INSTALLED 1
157 \c new_installation:
158 \c
159 \c !insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED dllname.dll $SYSDIR\dllname.dll $SYSDIR
160
161 \H{library_uninstall} Library Uninstallation
162
163 \S1{} Introduction
164
165 The UnInstallLib macro allows you to uninstall a library. It sets the error flag if something went wrong during library removal.
166
167 \S1{library_uninstall_parameters} Parameters
168
169 \c libtype shared uninstall file
170
171 \\<b\\>libtype\\</b\\>
172
173 The type of the library
174
175 DLL - Dynamic link library (DLL)\\<br\\>
176 REGDLL - DLL that has to be unregistered\\<br\\>
177 REGEXE - EXE COM server that has to be unregistered using /unregserver\\<br\\>
178 TLB - Type library or DLL that contains a type library\\<br\\>
179 REGDLLTLB - DLL that has to be unregistered and contains a type library\\<br\\>
180
181
182 \\<b\\>shared\\</b\\>
183
184 Specify whether the library is shared with other applications
185
186 NOTSHARED - The library is not shared\\<br\\>
187 SHARED - The library is shared and should be removed if the shared library count
188 indicates that the file is not in use anymore..\\<br\\>
189
190 \\<b\\>uninstall\\</b\\>
191
192 Specify the uninstallation method
193
194 NOREMOVE
195
196 \b The library should not be removed. You should use this option for common or important
197 system files such as the Visual Basic/C++/MFC runtimes.
198
199 REBOOT_PROTECTED
200
201 \b Remove the library on reboot when in use (required for system files).
202
203 \b Remove the library if the file is not protected by Windows File Protection.
204
205 NOREBOOT_PROTECTED
206
207 \b Warns the user when the library is in use. The user will have to close applications using the library.
208
209 \b Remove the library if the file is not protected by Windows File Protection.
210
211 REBOOT_NOTPROTECTED
212
213 \b Remove the library on reboot when in use (required for system files).
214
215 \b Remove the library without checking for Windows File Protection.
216
217 NOREBOOT_NOTPROTECTED
218
219 \b Warns the user when the library is in use. The user will have to close applications using the library.
220
221 \b Remove the library without checking for Windows File Protection.
222
223
224 \\<b\\>file\\</b\\>
225
226 Location of the library
227
228 \S1{library_uninstall_options} Options
229
230 \R{define}{Define} any of the following before inserting a UnInstallLib macro to modify its behavior as specified.
231
232 \S2{} LIBRARY_X64
233
234 \b Uninstalls a DLL built for Windows x64.
235
236 \b \s{Warning:} This resets \R{setregview}{SetRegView} and file system redirection.
237
238 \S2{} LIBRARY_SHELL_EXTENSION
239
240 \b Define this before inserting UninstallLib macro to call SHChangeNotify with SHCNE_ASSOCCHANGED after unregistration. Use this to refresh the shell when uninstalling a shell extension or when changing file associations.
241
242 \S2{} LIBRARY_COM
243
244 \b Define this before inserting UninstallLib macro to call CoFreeUnusedLibraries after unregistration. Use this for unloading all unnecessary libraries from memory when uninstalling COM libraries.
245
246 \S1{library_uninstall_examples} Example
247
248 \c !insertmacro UnInstallLib REGDLL SHARED REBOOT_NOTPROTECTED $SYSDIR\dllname.dll
249
250
251 \H{library_vb6} Visual Basic 6 Run-Time Files
252
253 A new VB6RunTime.nsh header file is available for the setup of the VB6 run-time files.
254 To obtain the latest run-time files, download \W{https://nsis.sourceforge.io/vb6runtime.zip}{vb6runtime.zip} and extract this file.
255
256 \c !include VB6RunTime.nsh
257 \c
258 \c Var AlreadyInstalled
259 \c
260 \c Section "-Install VB6 run-time files"
261 \c
262 \c ;Add code here that sets $AlreadyInstalled to a non-zero value if the application is already installed. For example:
263 \c IfFileExists "$INSTDIR\MyApp.exe" 0 new_installation ;Replace MyApp.exe with your application filename
264 \c StrCpy $AlreadyInstalled 1
265 \c new_installation:
266 \c
267 \c !insertmacro VB6RunTimeInstall C:\vb6runtimes $AlreadyInstalled ;Replace C:\vb6runtimes with the location of the files
268 \c
269 \c SectionEnd
270 \c
271 \c Section "-un.Uninstall VB6 run-time files"
272 \c
273 \c !insertmacro VB6RunTimeUnInstall
274 \c
275 \c SectionEnd
276
277 Remarks:
278
279 \b You may have to install additional files for such Visual Basic application to work, such as OCX files for user interface controls.
280
281 \b Installation of the run-time files requires Administrator or Power User privileges. Use the Multi-User header file to verify whether these privileges are available.
282
283 \b Add a Modern UI finish page or another check (see \R{ifrebootflag}{IfRebootFlag}) to allow the user to restart the computer when necessary.