cross-packer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +151 -0
- package/README.zh-CN.md +151 -0
- package/dist/archive/ar.d.ts +12 -0
- package/dist/archive/seven-za.d.ts +32 -0
- package/dist/archive/tar.d.ts +30 -0
- package/dist/archive/zip-reader.d.ts +17 -0
- package/dist/asar/dependency/collect.d.ts +2 -0
- package/dist/asar/dependency/detector.d.ts +8 -0
- package/dist/asar/dependency/hoister.d.ts +27 -0
- package/dist/asar/dependency/utils.d.ts +59 -0
- package/dist/asar/fileset/matcher.d.ts +12 -0
- package/dist/asar/fileset/platform-fileset.d.ts +36 -0
- package/dist/asar/fileset/transformer.d.ts +2 -0
- package/dist/asar/fileset/unpack-detector.d.ts +10 -0
- package/dist/asar/fileset/walker.d.ts +14 -0
- package/dist/asar/pack.d.ts +23 -0
- package/dist/asar/packer/app-collector.d.ts +2 -0
- package/dist/asar/packer/collector.d.ts +18 -0
- package/dist/asar/packer/concurrency.d.ts +1 -0
- package/dist/asar/packer/integrity.d.ts +8 -0
- package/dist/asar/packer/nm-collector.d.ts +7 -0
- package/dist/asar/packer/stream-builder.d.ts +18 -0
- package/dist/cli.d.ts +2 -0
- package/dist/config/index.d.ts +97 -0
- package/dist/electron/dist-zip.d.ts +18 -0
- package/dist/electron/download.d.ts +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/packer/common/app-update-yml.d.ts +5 -0
- package/dist/packer/common/extra-resources.d.ts +39 -0
- package/dist/packer/common/staging.d.ts +3 -0
- package/dist/packer/common/template.d.ts +2 -0
- package/dist/packer/linux/linux.d.ts +2 -0
- package/dist/packer/mac/mac.d.ts +23 -0
- package/dist/packer/win/nsis.d.ts +24 -0
- package/dist/packer/win/resedit.d.ts +5 -0
- package/dist/packer/win/toolchain.d.ts +8 -0
- package/dist/packer/win/win.d.ts +12 -0
- package/dist/pipeline/pipeline.d.ts +41 -0
- package/dist/pipeline/targets.d.ts +28 -0
- package/dist/shared/hash.d.ts +2 -0
- package/dist/shared/logger.d.ts +39 -0
- package/dist/shared/platform.d.ts +26 -0
- package/dist/shared/types.d.ts +68 -0
- package/dist/update/blockmap.d.ts +13 -0
- package/dist/update/metadata.d.ts +20 -0
- package/dist/update/version.d.ts +7 -0
- package/package.json +71 -0
- package/src/archive/ar.ts +41 -0
- package/src/archive/seven-za.ts +160 -0
- package/src/archive/tar.ts +142 -0
- package/src/archive/zip-reader.ts +61 -0
- package/src/asar/dependency/collect.ts +437 -0
- package/src/asar/dependency/detector.ts +73 -0
- package/src/asar/dependency/hoister.ts +714 -0
- package/src/asar/dependency/utils.ts +225 -0
- package/src/asar/fileset/matcher.ts +101 -0
- package/src/asar/fileset/platform-fileset.ts +416 -0
- package/src/asar/fileset/transformer.ts +154 -0
- package/src/asar/fileset/unpack-detector.ts +38 -0
- package/src/asar/fileset/walker.ts +115 -0
- package/src/asar/pack.ts +186 -0
- package/src/asar/packer/app-collector.ts +74 -0
- package/src/asar/packer/collector.ts +134 -0
- package/src/asar/packer/concurrency.ts +24 -0
- package/src/asar/packer/integrity.ts +53 -0
- package/src/asar/packer/nm-collector.ts +194 -0
- package/src/asar/packer/stream-builder.ts +723 -0
- package/src/cli.ts +182 -0
- package/src/config/index.ts +365 -0
- package/src/electron/dist-zip.ts +65 -0
- package/src/electron/download.ts +121 -0
- package/src/index.ts +14 -0
- package/src/packer/common/app-update-yml.ts +21 -0
- package/src/packer/common/extra-resources.ts +83 -0
- package/src/packer/common/staging.ts +33 -0
- package/src/packer/common/template.ts +24 -0
- package/src/packer/linux/linux.ts +329 -0
- package/src/packer/mac/mac.ts +495 -0
- package/src/packer/win/nsis.ts +244 -0
- package/src/packer/win/resedit.ts +60 -0
- package/src/packer/win/toolchain.ts +63 -0
- package/src/packer/win/win.ts +421 -0
- package/src/pipeline/pipeline.ts +149 -0
- package/src/pipeline/targets.ts +67 -0
- package/src/shared/hash.ts +15 -0
- package/src/shared/logger.ts +91 -0
- package/src/shared/platform.ts +41 -0
- package/src/shared/types.ts +82 -0
- package/src/update/blockmap.ts +247 -0
- package/src/update/metadata.ts +97 -0
- package/src/update/version.ts +59 -0
- package/templates/linux/app.desktop +11 -0
- package/templates/linux/control +9 -0
- package/templates/linux/postinst +10 -0
- package/templates/linux/postrm +8 -0
- package/templates/linux/preinst +49 -0
- package/templates/linux/prerm +43 -0
- package/templates/mac/Info.plist +18 -0
- package/templates/mac/app-update.yml +4 -0
- package/templates/win/nsis/README.md +51 -0
- package/templates/win/nsis/THIRD-PARTY-NOTICES.md +20 -0
- package/templates/win/nsis/assistedInstaller.nsh +154 -0
- package/templates/win/nsis/assistedMessages.yml +368 -0
- package/templates/win/nsis/common.nsh +147 -0
- package/templates/win/nsis/empty-license.txt +1 -0
- package/templates/win/nsis/include/FileAssociation.nsh +123 -0
- package/templates/win/nsis/include/StdUtils.nsh +496 -0
- package/templates/win/nsis/include/StrContains.nsh +48 -0
- package/templates/win/nsis/include/UAC.nsh +299 -0
- package/templates/win/nsis/include/allowOnlyOneInstallerInstance.nsh +164 -0
- package/templates/win/nsis/include/extractAppPackage.nsh +138 -0
- package/templates/win/nsis/include/getProcessInfo.nsh +157 -0
- package/templates/win/nsis/include/installUtil.nsh +248 -0
- package/templates/win/nsis/include/installer.nsh +247 -0
- package/templates/win/nsis/include/nsProcess.nsh +28 -0
- package/templates/win/nsis/include/webPackage.nsh +64 -0
- package/templates/win/nsis/installSection.nsh +110 -0
- package/templates/win/nsis/installer.nsi +132 -0
- package/templates/win/nsis/messages.yml +240 -0
- package/templates/win/nsis/multiUser.nsh +134 -0
- package/templates/win/nsis/multiUserUi.nsh +230 -0
- package/templates/win/nsis/oneClick.nsh +19 -0
- package/templates/win/nsis/portable.nsi +91 -0
- package/templates/win/nsis/uninstaller.nsh +263 -0
- package/templates/win/nsis-header.nsh +57 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/*** UAC Plug-in ***
|
|
2
|
+
|
|
3
|
+
Interactive User (MediumIL) Admin user (HighIL)
|
|
4
|
+
***[Setup.exe]************* ***[Setup.exe]**************
|
|
5
|
+
* * * *
|
|
6
|
+
* +++[.OnInit]+++++++++++ * * +++[.OnInit]++++++++++++ *
|
|
7
|
+
* + UAC_RunElevated >---+-+----> * + + *
|
|
8
|
+
* + NSIS.Quit + * * + + *
|
|
9
|
+
* +++++++++++++++++++++++ * * ++++++++++++++++++++++++ *
|
|
10
|
+
* * * *
|
|
11
|
+
* * * *
|
|
12
|
+
* +++[Section]+++++++++++ * * +++[Section]++++++++++++ *
|
|
13
|
+
* + + * /--+-+-<UAC_AsUser_ExecShell+ *
|
|
14
|
+
* +++++++++++++++++++++++ * | * ++++++++++++++++++++++++ *
|
|
15
|
+
* * | * *
|
|
16
|
+
* Win32.ShellExecute <---+--/ * *
|
|
17
|
+
* * * *
|
|
18
|
+
*************************** ****************************
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
!ifndef UAC_HDR__INC
|
|
23
|
+
!verbose push
|
|
24
|
+
!verbose 3
|
|
25
|
+
!ifndef UAC_VERBOSE
|
|
26
|
+
!define UAC_VERBOSE 3
|
|
27
|
+
!endif
|
|
28
|
+
!verbose ${UAC_VERBOSE}
|
|
29
|
+
|
|
30
|
+
!define UAC_HDR__INC 0x00020400 ;MMmmbbrr
|
|
31
|
+
|
|
32
|
+
!include LogicLib.nsh
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/* UAC_RunElevated
|
|
37
|
+
**
|
|
38
|
+
** Starts the elevation operation.
|
|
39
|
+
**
|
|
40
|
+
** Return values:
|
|
41
|
+
**
|
|
42
|
+
** $0: Win32 error code (0 on success, 1223 if user aborted elevation dialog, anything else should be treated as a fatal error)
|
|
43
|
+
** $1: If $0==0:
|
|
44
|
+
** 0 UAC is not supported by the OS
|
|
45
|
+
** 1 Started a elevated child process, the current process should act like a wrapper (Call Quit without any further processing)
|
|
46
|
+
** 2 The process is already running @ HighIL (Member of admin group)
|
|
47
|
+
** 3 You should call RunElevated again (This can happen if a user without admin priv. is used in the runas dialog)
|
|
48
|
+
** $2: If $0==0 && $1==1: ExitCode of the elevated fork process (The NSIS errlvl is also set)
|
|
49
|
+
** $3: If $0==0: 1 if the user is a member of the admin group or 0 otherwise
|
|
50
|
+
**/
|
|
51
|
+
!macro UAC_RunElevated
|
|
52
|
+
UAC::_ 0
|
|
53
|
+
!macroend
|
|
54
|
+
!macro UAC_PageElevation_RunElevated
|
|
55
|
+
UAC::_ 0
|
|
56
|
+
!macroend
|
|
57
|
+
/*!macro UAC_OnInitElevation_RunElevated
|
|
58
|
+
UAC::_ 0
|
|
59
|
+
!macroend
|
|
60
|
+
!macro UAC_OnInitElevation_OnGuiInit
|
|
61
|
+
!macroend*/
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/* UAC_GetIntegrityLevel <NSISVar:Output | "s">
|
|
66
|
+
**
|
|
67
|
+
** Get integrity level of current process
|
|
68
|
+
**
|
|
69
|
+
**/
|
|
70
|
+
!macro UAC_GetIntegrityLevel outvar
|
|
71
|
+
UAC::_ 6
|
|
72
|
+
!if "${outvar}" != "s"
|
|
73
|
+
Pop ${outvar}
|
|
74
|
+
!endif
|
|
75
|
+
!macroend
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/* UAC_IsAdmin
|
|
80
|
+
**
|
|
81
|
+
** Is the current process running with administrator privileges? Result in $0
|
|
82
|
+
**
|
|
83
|
+
** ${If} ${UAC_IsAdmin} ...
|
|
84
|
+
**
|
|
85
|
+
**/
|
|
86
|
+
!macro UAC_IsAdmin
|
|
87
|
+
UAC::_ 2
|
|
88
|
+
!macroend
|
|
89
|
+
!define UAC_IsAdmin `"" UAC_IsAdmin ""`
|
|
90
|
+
!macro _UAC_IsAdmin _a _b _t _f
|
|
91
|
+
!insertmacro _UAC_MakeLL_Cmp _!= 0 2s
|
|
92
|
+
!macroend
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/* UAC_IsInnerInstance
|
|
97
|
+
**
|
|
98
|
+
** Does the current process have a NSIS/UAC parent process that is part of the elevation operation?
|
|
99
|
+
**
|
|
100
|
+
** ${If} ${UAC_IsInnerInstance} ...
|
|
101
|
+
**
|
|
102
|
+
**/
|
|
103
|
+
!macro UAC_IsInnerInstance
|
|
104
|
+
UAC::_ 3
|
|
105
|
+
!macroend
|
|
106
|
+
!define UAC_IsInnerInstance `"" UAC_IsInnerInstance ""`
|
|
107
|
+
!macro _UAC_IsInnerInstance _a _b _t _f
|
|
108
|
+
!insertmacro _UAC_MakeLL_Cmp _!= 0 3s
|
|
109
|
+
!macroend
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/* UAC_PageElevation_OnInit, UAC_PageElevation_OnGuiInit,
|
|
114
|
+
**
|
|
115
|
+
** Helper macros for elevation on a custom elevation page, see the DualMode example for more information.
|
|
116
|
+
**
|
|
117
|
+
**/
|
|
118
|
+
!macro UAC_Notify_OnGuiInit
|
|
119
|
+
UAC::_ 4
|
|
120
|
+
!macroend
|
|
121
|
+
!macro UAC_PageElevation_OnGuiInit
|
|
122
|
+
!insertmacro UAC_Notify_OnGuiInit
|
|
123
|
+
!macroend
|
|
124
|
+
!macro UAC_PageElevation_OnInit
|
|
125
|
+
UAC::_ 5
|
|
126
|
+
${IfThen} ${Errors} ${|} Quit ${|}
|
|
127
|
+
!macroend
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
/* UAC_AsUser_Call <Function|Label> <NSISAddressName> <UAC_* flags>
|
|
132
|
+
**
|
|
133
|
+
** Calls a function or label in the user process instance.
|
|
134
|
+
** All the UAC_AsUser_* macros use this helper macro.
|
|
135
|
+
**
|
|
136
|
+
**/
|
|
137
|
+
!define UAC_SYNCREGISTERS 0x1
|
|
138
|
+
;define UAC_SYNCSTACK 0x2
|
|
139
|
+
!define UAC_SYNCOUTDIR 0x4
|
|
140
|
+
!define UAC_SYNCINSTDIR 0x8
|
|
141
|
+
;define UAC_CLEARERRFLAG 0x10
|
|
142
|
+
!macro UAC_AsUser_Call type name flags
|
|
143
|
+
push $0
|
|
144
|
+
Get${type}Address $0 ${name}
|
|
145
|
+
!verbose push
|
|
146
|
+
!verbose ${UAC_VERBOSE}
|
|
147
|
+
!insertmacro _UAC_ParseDefineFlagsToInt _UAC_AsUser_Call__flags ${flags}
|
|
148
|
+
!verbose pop
|
|
149
|
+
StrCpy $0 "1$0:${_UAC_AsUser_Call__flags}"
|
|
150
|
+
!undef _UAC_AsUser_Call__flags
|
|
151
|
+
Exch $0
|
|
152
|
+
UAC::_
|
|
153
|
+
!macroend
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
/*
|
|
158
|
+
** UAC_AsUser_GetSection <Flags|InstTypes|Size|Text> <SectionIndex> <NSISVar:Output>
|
|
159
|
+
*/
|
|
160
|
+
!macro UAC_AsUser_GetSection secprop secidx outvar
|
|
161
|
+
!insertmacro _UAC_AsUser_GenOp ${outvar} SectionGet${secprop} ${secidx} ""
|
|
162
|
+
!macroend
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
/*
|
|
167
|
+
** UAC_AsUser_GetGlobalVar <NSISVar:SourceAndOutput>
|
|
168
|
+
** UAC_AsUser_GetGlobal <NSISVar:Output> <NSISVar:Source>
|
|
169
|
+
*/
|
|
170
|
+
!macro UAC_AsUser_GetGlobalVar var
|
|
171
|
+
!insertmacro _UAC_AsUser_GenOp ${var} StrCpy "" ${var}
|
|
172
|
+
!macroend
|
|
173
|
+
!macro UAC_AsUser_GetGlobal outvar srcvar
|
|
174
|
+
!insertmacro _UAC_AsUser_GenOp ${outvar} StrCpy "" ${srcvar}
|
|
175
|
+
!macroend
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
** UAC_AsUser_ExecShell <Verb> <ApplicationOrFile> <Parameters> <Working Directory> <SW_*>
|
|
181
|
+
**
|
|
182
|
+
** Call ExecShell in the user process instance.
|
|
183
|
+
**
|
|
184
|
+
*/
|
|
185
|
+
!macro UAC_AsUser_ExecShell verb command params workdir show
|
|
186
|
+
!insertmacro _UAC_IncL
|
|
187
|
+
goto _UAC_L_E_${__UAC_L}
|
|
188
|
+
_UAC_L_F_${__UAC_L}:
|
|
189
|
+
ExecShell "${verb}" "${command}" '${params}' ${show}
|
|
190
|
+
return
|
|
191
|
+
_UAC_L_E_${__UAC_L}:
|
|
192
|
+
!if "${workdir}" != ""
|
|
193
|
+
push $outdir
|
|
194
|
+
SetOutPath "${workdir}"
|
|
195
|
+
!endif
|
|
196
|
+
!insertmacro UAC_AsUser_Call Label _UAC_L_F_${__UAC_L} ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR} #|${UAC_CLEARERRFLAG}
|
|
197
|
+
!if "${workdir}" != ""
|
|
198
|
+
pop $outdir
|
|
199
|
+
SetOutPath $outdir
|
|
200
|
+
!endif
|
|
201
|
+
!macroend
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
!macro _UAC_MakeLL_Cmp cmpop cmp pluginparams
|
|
206
|
+
!insertmacro _LOGICLIB_TEMP
|
|
207
|
+
UAC::_ ${pluginparams}
|
|
208
|
+
pop $_LOGICLIB_TEMP
|
|
209
|
+
!insertmacro ${cmpop} $_LOGICLIB_TEMP ${cmp} `${_t}` `${_f}`
|
|
210
|
+
!macroend
|
|
211
|
+
!macro _UAC_definemath def val1 op val2
|
|
212
|
+
!define /math _UAC_definemath "${val1}" ${op} ${val2}
|
|
213
|
+
!ifdef ${def}
|
|
214
|
+
!undef ${def}
|
|
215
|
+
!endif
|
|
216
|
+
!define ${def} "${_UAC_definemath}"
|
|
217
|
+
!undef _UAC_definemath
|
|
218
|
+
!macroend
|
|
219
|
+
!macro _UAC_ParseDefineFlags_orin parse outflags
|
|
220
|
+
!searchparse /noerrors ${${parse}} "" _UAC_ParseDefineFlags_orin_f1 "|" _UAC_ParseDefineFlags_orin_f2
|
|
221
|
+
!define _UAC_ParseDefineFlags_orin_this ${_UAC_ParseDefineFlags_orin_f1}
|
|
222
|
+
!undef ${parse}
|
|
223
|
+
!define ${parse} ${_UAC_ParseDefineFlags_orin_f2}
|
|
224
|
+
!define _UAC_ParseDefineFlags_orin_saveout ${${outflags}}
|
|
225
|
+
!undef ${outflags}
|
|
226
|
+
!define /math ${outflags} "${_UAC_ParseDefineFlags_orin_saveout}" | "${_UAC_ParseDefineFlags_orin_this}"
|
|
227
|
+
!undef _UAC_ParseDefineFlags_orin_saveout
|
|
228
|
+
!undef _UAC_ParseDefineFlags_orin_this
|
|
229
|
+
!ifdef _UAC_ParseDefineFlags_orin_f1
|
|
230
|
+
!undef _UAC_ParseDefineFlags_orin_f1
|
|
231
|
+
!endif
|
|
232
|
+
!ifdef _UAC_ParseDefineFlags_orin_f2
|
|
233
|
+
!undef _UAC_ParseDefineFlags_orin_f2
|
|
234
|
+
!endif
|
|
235
|
+
!macroend
|
|
236
|
+
!macro _UAC_ParseDefineFlags_Begin _outdef _in
|
|
237
|
+
!define _UAC_PDF${_outdef}_parse "${_in}"
|
|
238
|
+
!define _UAC_PDF${_outdef}_flags ""
|
|
239
|
+
!define _UAC_PDF${_outdef}_r 0
|
|
240
|
+
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x1
|
|
241
|
+
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x2
|
|
242
|
+
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x4
|
|
243
|
+
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x8
|
|
244
|
+
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x10
|
|
245
|
+
!macroend
|
|
246
|
+
!macro _UAC_ParseDefineFlags_End _outdef
|
|
247
|
+
!define ${_outdef} ${_UAC_PDF${_outdef}_r}
|
|
248
|
+
!undef _UAC_PDF${_outdef}_r
|
|
249
|
+
!undef _UAC_PDF${_outdef}_flags
|
|
250
|
+
!undef _UAC_PDF${_outdef}_parse
|
|
251
|
+
!macroend
|
|
252
|
+
!macro _UAC_ParseDefineFlags_IncludeFlag _outdef flag
|
|
253
|
+
!if ${_UAC_PDF${_outdef}_flags} & ${flag}
|
|
254
|
+
!insertmacro _UAC_definemath _UAC_PDF${_outdef}_r ${_UAC_PDF${_outdef}_r} | ${flag}
|
|
255
|
+
!endif
|
|
256
|
+
!macroend
|
|
257
|
+
!macro _UAC_ParseDefineFlagsToInt _outdef _in
|
|
258
|
+
!insertmacro _UAC_ParseDefineFlags_Begin _UAC_ParseDefineFlagsToInt_tmp "${_in}"
|
|
259
|
+
!define ${_outdef} ${_UAC_PDF_UAC_ParseDefineFlagsToInt_tmp_flags}
|
|
260
|
+
!insertmacro _UAC_ParseDefineFlags_End _UAC_ParseDefineFlagsToInt_tmp
|
|
261
|
+
!undef _UAC_ParseDefineFlagsToInt_tmp
|
|
262
|
+
!macroend
|
|
263
|
+
!macro _UAC_IncL
|
|
264
|
+
!insertmacro _UAC_definemath __UAC_L "${__UAC_L}" + 1
|
|
265
|
+
!macroend
|
|
266
|
+
!macro _UAC_AsUser_GenOp outvar op opparam1 opparam2
|
|
267
|
+
!define _UAC_AUGOGR_ID _UAC_AUGOGR_OP${outvar}${op}${opparam1}${opparam2}
|
|
268
|
+
!ifndef ${_UAC_AUGOGR_ID} ;Has this exact action been done before?
|
|
269
|
+
!if ${outvar} == $0
|
|
270
|
+
!define ${_UAC_AUGOGR_ID} $1
|
|
271
|
+
!else
|
|
272
|
+
!define ${_UAC_AUGOGR_ID} $0
|
|
273
|
+
!endif
|
|
274
|
+
!if "${opparam1}" == ""
|
|
275
|
+
!define _UAC_AUGOGR_OPP1 ${${_UAC_AUGOGR_ID}}
|
|
276
|
+
!define _UAC_AUGOGR_OPP2 ${opparam2}
|
|
277
|
+
!else
|
|
278
|
+
!define _UAC_AUGOGR_OPP1 ${opparam1}
|
|
279
|
+
!define _UAC_AUGOGR_OPP2 ${${_UAC_AUGOGR_ID}}
|
|
280
|
+
!endif
|
|
281
|
+
goto ${_UAC_AUGOGR_ID}_C
|
|
282
|
+
${_UAC_AUGOGR_ID}_F:
|
|
283
|
+
${op} ${_UAC_AUGOGR_OPP1} ${_UAC_AUGOGR_OPP2}
|
|
284
|
+
return
|
|
285
|
+
${_UAC_AUGOGR_ID}_C:
|
|
286
|
+
!undef _UAC_AUGOGR_OPP1
|
|
287
|
+
!undef _UAC_AUGOGR_OPP2
|
|
288
|
+
!endif
|
|
289
|
+
push ${${_UAC_AUGOGR_ID}}
|
|
290
|
+
!insertmacro UAC_AsUser_Call Label ${_UAC_AUGOGR_ID}_F ${UAC_SYNCREGISTERS}
|
|
291
|
+
StrCpy ${outvar} ${${_UAC_AUGOGR_ID}}
|
|
292
|
+
pop ${${_UAC_AUGOGR_ID}}
|
|
293
|
+
!undef _UAC_AUGOGR_ID
|
|
294
|
+
!macroend
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
!verbose pop
|
|
299
|
+
!endif /* UAC_HDR__INC */
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
!ifndef nsProcess::FindProcess
|
|
2
|
+
!include "nsProcess.nsh"
|
|
3
|
+
!endif
|
|
4
|
+
|
|
5
|
+
!ifmacrondef customCheckAppRunning
|
|
6
|
+
!include "getProcessInfo.nsh"
|
|
7
|
+
Var pid
|
|
8
|
+
!endif
|
|
9
|
+
|
|
10
|
+
# http://nsis.sourceforge.net/Allow_only_one_installer_instance
|
|
11
|
+
!macro ALLOW_ONLY_ONE_INSTALLER_INSTANCE
|
|
12
|
+
BringToFront
|
|
13
|
+
!define /ifndef SYSTYPE_PTR p ; NSIS v3.0+
|
|
14
|
+
System::Call 'kernel32::CreateMutex(${SYSTYPE_PTR}0, i1, t"${APP_GUID}")?e'
|
|
15
|
+
Pop $0
|
|
16
|
+
IntCmpU $0 183 0 launch launch ; ERROR_ALREADY_EXISTS
|
|
17
|
+
StrLen $0 "$(^SetupCaption)"
|
|
18
|
+
IntOp $0 $0 + 1 ; GetWindowText count includes \0
|
|
19
|
+
StrCpy $1 "" ; Start FindWindow with NULL
|
|
20
|
+
loop:
|
|
21
|
+
FindWindow $1 "#32770" "" "" $1
|
|
22
|
+
StrCmp 0 $1 notfound
|
|
23
|
+
System::Call 'user32::GetWindowText(${SYSTYPE_PTR}r1, t.r2, ir0)'
|
|
24
|
+
StrCmp $2 "$(^SetupCaption)" 0 loop
|
|
25
|
+
SendMessage $1 0x112 0xF120 0 /TIMEOUT=2000 ; WM_SYSCOMMAND:SC_RESTORE to restore the window if it is minimized
|
|
26
|
+
System::Call "user32::SetForegroundWindow(${SYSTYPE_PTR}r1)"
|
|
27
|
+
notfound:
|
|
28
|
+
Abort
|
|
29
|
+
launch:
|
|
30
|
+
!macroend
|
|
31
|
+
|
|
32
|
+
!macro CHECK_APP_RUNNING
|
|
33
|
+
Var /GLOBAL CmdPath
|
|
34
|
+
Var /GLOBAL FindPath
|
|
35
|
+
Var /GLOBAL PowerShellPath
|
|
36
|
+
StrCpy $CmdPath "$SYSDIR\cmd.exe"
|
|
37
|
+
StrCpy $FindPath "$SYSDIR\find.exe"
|
|
38
|
+
StrCpy $PowerShellPath "$SYSDIR\WindowsPowerShell\v1.0\powershell.exe"
|
|
39
|
+
!ifmacrodef customCheckAppRunning
|
|
40
|
+
!insertmacro customCheckAppRunning
|
|
41
|
+
!else
|
|
42
|
+
!insertmacro IS_POWERSHELL_AVAILABLE
|
|
43
|
+
!insertmacro _CHECK_APP_RUNNING
|
|
44
|
+
!endif
|
|
45
|
+
!macroend
|
|
46
|
+
|
|
47
|
+
!macro IS_POWERSHELL_AVAILABLE
|
|
48
|
+
Var /GLOBAL IsPowerShellAvailable ; 0 = available, 1 = not available
|
|
49
|
+
# Try running PowerShell with a simple command to check if it's available
|
|
50
|
+
nsExec::Exec `"$PowerShellPath" -C "if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"`
|
|
51
|
+
Pop $0 # Return code (0 = success, other = error)
|
|
52
|
+
|
|
53
|
+
${if} $0 == 0
|
|
54
|
+
# PowerShell is available, check if it's not blocked by policies
|
|
55
|
+
nsExec::Exec `"$PowerShellPath" -C "if ((Get-ExecutionPolicy -Scope Process) -eq 'Restricted') { exit 1 } else { exit 0 }"`
|
|
56
|
+
Pop $0
|
|
57
|
+
${endIf}
|
|
58
|
+
|
|
59
|
+
${if} $0 != 0
|
|
60
|
+
StrCpy $0 1
|
|
61
|
+
${endIf}
|
|
62
|
+
|
|
63
|
+
StrCpy $IsPowerShellAvailable $0
|
|
64
|
+
!macroend
|
|
65
|
+
|
|
66
|
+
!macro FIND_PROCESS _FILE _RETURN
|
|
67
|
+
${if} $IsPowerShellAvailable == 0
|
|
68
|
+
nsExec::Exec `"$PowerShellPath" -C "if ((Get-CimInstance -ClassName Win32_Process | ? {$$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')}).Count -gt 0) { exit 0 } else { exit 1 }"`
|
|
69
|
+
Pop ${_RETURN}
|
|
70
|
+
${else}
|
|
71
|
+
!ifdef INSTALL_MODE_PER_ALL_USERS
|
|
72
|
+
${nsProcess::FindProcess} "${_FILE}" ${_RETURN}
|
|
73
|
+
!else
|
|
74
|
+
# find process owned by current user
|
|
75
|
+
nsExec::Exec `"$CmdPath" /C tasklist /FI "USERNAME eq %USERNAME%" /FI "IMAGENAME eq ${_FILE}" /FO CSV | "$FindPath" "${_FILE}"`
|
|
76
|
+
Pop ${_RETURN}
|
|
77
|
+
!endif
|
|
78
|
+
${endIf}
|
|
79
|
+
!macroend
|
|
80
|
+
|
|
81
|
+
!macro KILL_PROCESS _FILE _FORCE
|
|
82
|
+
Push $0
|
|
83
|
+
${if} ${_FORCE} == 1
|
|
84
|
+
${if} $IsPowerShellAvailable == 0
|
|
85
|
+
StrCpy $0 "-Force"
|
|
86
|
+
${else}
|
|
87
|
+
StrCpy $0 "/F"
|
|
88
|
+
${endIf}
|
|
89
|
+
${else}
|
|
90
|
+
StrCpy $0 ""
|
|
91
|
+
${endIf}
|
|
92
|
+
|
|
93
|
+
${if} $IsPowerShellAvailable == 0
|
|
94
|
+
nsExec::Exec `"$PowerShellPath" -C "Get-CimInstance -ClassName Win32_Process | ? {$$_.Path -and $$_.Path.StartsWith('$INSTDIR', 'CurrentCultureIgnoreCase')} | % { Stop-Process -Id $$_.ProcessId $0 }"`
|
|
95
|
+
${else}
|
|
96
|
+
!ifdef INSTALL_MODE_PER_ALL_USERS
|
|
97
|
+
nsExec::Exec `taskkill /IM "${_FILE}" /FI "PID ne $pid"`
|
|
98
|
+
!else
|
|
99
|
+
nsExec::Exec `"$CmdPath" /C taskkill $0 /IM "${_FILE}" /FI "PID ne $pid" /FI "USERNAME eq %USERNAME%"`
|
|
100
|
+
!endif
|
|
101
|
+
${endIf}
|
|
102
|
+
Pop $0
|
|
103
|
+
!macroend
|
|
104
|
+
|
|
105
|
+
!macro _CHECK_APP_RUNNING
|
|
106
|
+
${GetProcessInfo} 0 $pid $1 $2 $3 $4
|
|
107
|
+
${if} $3 != "${APP_EXECUTABLE_FILENAME}"
|
|
108
|
+
${if} ${isUpdated}
|
|
109
|
+
# allow app to exit without explicit kill
|
|
110
|
+
Sleep 300
|
|
111
|
+
${endIf}
|
|
112
|
+
|
|
113
|
+
!insertmacro FIND_PROCESS "${APP_EXECUTABLE_FILENAME}" $R0
|
|
114
|
+
${if} $R0 == 0
|
|
115
|
+
${if} ${isUpdated}
|
|
116
|
+
# allow app to exit without explicit kill
|
|
117
|
+
Sleep 1000
|
|
118
|
+
Goto doStopProcess
|
|
119
|
+
${endIf}
|
|
120
|
+
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(appRunning)" /SD IDOK IDOK doStopProcess
|
|
121
|
+
Quit
|
|
122
|
+
|
|
123
|
+
doStopProcess:
|
|
124
|
+
|
|
125
|
+
DetailPrint "$(appClosing)"
|
|
126
|
+
|
|
127
|
+
!insertmacro KILL_PROCESS "${APP_EXECUTABLE_FILENAME}" 0
|
|
128
|
+
# to ensure that files are not "in-use"
|
|
129
|
+
Sleep 300
|
|
130
|
+
|
|
131
|
+
# Retry counter
|
|
132
|
+
StrCpy $R1 0
|
|
133
|
+
|
|
134
|
+
loop:
|
|
135
|
+
IntOp $R1 $R1 + 1
|
|
136
|
+
|
|
137
|
+
!insertmacro FIND_PROCESS "${APP_EXECUTABLE_FILENAME}" $R0
|
|
138
|
+
${if} $R0 == 0
|
|
139
|
+
# wait to give a chance to exit gracefully
|
|
140
|
+
Sleep 1000
|
|
141
|
+
!insertmacro KILL_PROCESS "${APP_EXECUTABLE_FILENAME}" 1 # 1 = force kill
|
|
142
|
+
!insertmacro FIND_PROCESS "${APP_EXECUTABLE_FILENAME}" $R0
|
|
143
|
+
${if} $R0 == 0
|
|
144
|
+
DetailPrint `Waiting for "${PRODUCT_NAME}" to close.`
|
|
145
|
+
Sleep 2000
|
|
146
|
+
${else}
|
|
147
|
+
Goto not_running
|
|
148
|
+
${endIf}
|
|
149
|
+
${else}
|
|
150
|
+
Goto not_running
|
|
151
|
+
${endIf}
|
|
152
|
+
|
|
153
|
+
# App likely running with elevated permissions.
|
|
154
|
+
# Ask user to close it manually
|
|
155
|
+
${if} $R1 > 1
|
|
156
|
+
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(appCannotBeClosed)" /SD IDCANCEL IDRETRY loop
|
|
157
|
+
Quit
|
|
158
|
+
${else}
|
|
159
|
+
Goto loop
|
|
160
|
+
${endIf}
|
|
161
|
+
not_running:
|
|
162
|
+
${endIf}
|
|
163
|
+
${endIf}
|
|
164
|
+
!macroend
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
!macro extractEmbeddedAppPackage
|
|
2
|
+
!ifdef COMPRESS
|
|
3
|
+
SetCompress off
|
|
4
|
+
!endif
|
|
5
|
+
|
|
6
|
+
Var /GLOBAL packageArch
|
|
7
|
+
|
|
8
|
+
!insertmacro identify_package
|
|
9
|
+
!insertmacro compute_files_for_current_arch
|
|
10
|
+
|
|
11
|
+
!ifdef COMPRESS
|
|
12
|
+
SetCompress "${COMPRESS}"
|
|
13
|
+
!endif
|
|
14
|
+
|
|
15
|
+
!insertmacro decompress
|
|
16
|
+
!insertmacro custom_files_post_decompression
|
|
17
|
+
!macroend
|
|
18
|
+
|
|
19
|
+
!macro identify_package
|
|
20
|
+
!ifdef APP_32
|
|
21
|
+
StrCpy $packageArch "32"
|
|
22
|
+
!endif
|
|
23
|
+
!ifdef APP_64
|
|
24
|
+
${if} ${RunningX64}
|
|
25
|
+
${OrIf} ${IsNativeARM64}
|
|
26
|
+
StrCpy $packageArch "64"
|
|
27
|
+
${endif}
|
|
28
|
+
!endif
|
|
29
|
+
!ifdef APP_ARM64
|
|
30
|
+
${if} ${IsNativeARM64}
|
|
31
|
+
StrCpy $packageArch "ARM64"
|
|
32
|
+
${endif}
|
|
33
|
+
!endif
|
|
34
|
+
!macroend
|
|
35
|
+
|
|
36
|
+
!macro compute_files_for_current_arch
|
|
37
|
+
${if} $packageArch == "ARM64"
|
|
38
|
+
!ifdef APP_ARM64
|
|
39
|
+
!insertmacro arm64_app_files
|
|
40
|
+
!endif
|
|
41
|
+
${elseif} $packageArch == "64"
|
|
42
|
+
!ifdef APP_64
|
|
43
|
+
!insertmacro x64_app_files
|
|
44
|
+
!endif
|
|
45
|
+
${else}
|
|
46
|
+
!ifdef APP_32
|
|
47
|
+
!insertmacro ia32_app_files
|
|
48
|
+
!endif
|
|
49
|
+
${endIf}
|
|
50
|
+
!macroend
|
|
51
|
+
|
|
52
|
+
!macro custom_files_post_decompression
|
|
53
|
+
${if} $packageArch == "ARM64"
|
|
54
|
+
!ifmacrodef customFiles_arm64
|
|
55
|
+
!insertmacro customFiles_arm64
|
|
56
|
+
!endif
|
|
57
|
+
${elseif} $packageArch == "64"
|
|
58
|
+
!ifmacrodef customFiles_x64
|
|
59
|
+
!insertmacro customFiles_x64
|
|
60
|
+
!endif
|
|
61
|
+
${else}
|
|
62
|
+
!ifmacrodef customFiles_ia32
|
|
63
|
+
!insertmacro customFiles_ia32
|
|
64
|
+
!endif
|
|
65
|
+
${endIf}
|
|
66
|
+
!macroend
|
|
67
|
+
|
|
68
|
+
!macro arm64_app_files
|
|
69
|
+
File /oname=$PLUGINSDIR\app-arm64.${COMPRESSION_METHOD} "${APP_ARM64}"
|
|
70
|
+
!macroend
|
|
71
|
+
|
|
72
|
+
!macro x64_app_files
|
|
73
|
+
File /oname=$PLUGINSDIR\app-64.${COMPRESSION_METHOD} "${APP_64}"
|
|
74
|
+
!macroend
|
|
75
|
+
|
|
76
|
+
!macro ia32_app_files
|
|
77
|
+
File /oname=$PLUGINSDIR\app-32.${COMPRESSION_METHOD} "${APP_32}"
|
|
78
|
+
!macroend
|
|
79
|
+
|
|
80
|
+
!macro decompress
|
|
81
|
+
!ifdef ZIP_COMPRESSION
|
|
82
|
+
nsisunz::Unzip "$PLUGINSDIR\app-$packageArch.zip" "$INSTDIR"
|
|
83
|
+
Pop $R0
|
|
84
|
+
StrCmp $R0 "success" +3
|
|
85
|
+
MessageBox MB_OK|MB_ICONEXCLAMATION "$(decompressionFailed)$\n$R0"
|
|
86
|
+
Quit
|
|
87
|
+
!else
|
|
88
|
+
!insertmacro extractUsing7za "$PLUGINSDIR\app-$packageArch.7z"
|
|
89
|
+
!endif
|
|
90
|
+
!macroend
|
|
91
|
+
|
|
92
|
+
!macro extractUsing7za FILE
|
|
93
|
+
Push $OUTDIR
|
|
94
|
+
CreateDirectory "$PLUGINSDIR\7z-out"
|
|
95
|
+
ClearErrors
|
|
96
|
+
SetOutPath "$PLUGINSDIR\7z-out"
|
|
97
|
+
Nsis7z::Extract "${FILE}"
|
|
98
|
+
Pop $R0
|
|
99
|
+
SetOutPath $R0
|
|
100
|
+
|
|
101
|
+
# Retry counter
|
|
102
|
+
StrCpy $R1 0
|
|
103
|
+
|
|
104
|
+
LoopExtract7za:
|
|
105
|
+
IntOp $R1 $R1 + 1
|
|
106
|
+
|
|
107
|
+
# Attempt to copy files in atomic way
|
|
108
|
+
CopyFiles /SILENT "$PLUGINSDIR\7z-out\*" $OUTDIR
|
|
109
|
+
IfErrors 0 DoneExtract7za
|
|
110
|
+
|
|
111
|
+
DetailPrint `Can't modify "${PRODUCT_NAME}"'s files.`
|
|
112
|
+
${if} $R1 < 5
|
|
113
|
+
# Try copying a few times before asking for a user action.
|
|
114
|
+
Goto RetryExtract7za
|
|
115
|
+
${else}
|
|
116
|
+
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(appCannotBeClosed)" /SD IDRETRY IDCANCEL AbortExtract7za
|
|
117
|
+
${endIf}
|
|
118
|
+
|
|
119
|
+
# As an absolutely last resort after a few automatic attempts and user
|
|
120
|
+
# intervention - we will just overwrite everything with `Nsis7z::Extract`
|
|
121
|
+
# even though it is not atomic and will ignore errors.
|
|
122
|
+
|
|
123
|
+
# Clear the temporary folder first to make sure we don't use twice as
|
|
124
|
+
# much disk space.
|
|
125
|
+
RMDir /r "$PLUGINSDIR\7z-out"
|
|
126
|
+
|
|
127
|
+
Nsis7z::Extract "${FILE}"
|
|
128
|
+
Goto DoneExtract7za
|
|
129
|
+
|
|
130
|
+
AbortExtract7za:
|
|
131
|
+
Quit
|
|
132
|
+
|
|
133
|
+
RetryExtract7za:
|
|
134
|
+
Sleep 1000
|
|
135
|
+
Goto LoopExtract7za
|
|
136
|
+
|
|
137
|
+
DoneExtract7za:
|
|
138
|
+
!macroend
|