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.
Files changed (126) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +151 -0
  3. package/README.zh-CN.md +151 -0
  4. package/dist/archive/ar.d.ts +12 -0
  5. package/dist/archive/seven-za.d.ts +32 -0
  6. package/dist/archive/tar.d.ts +30 -0
  7. package/dist/archive/zip-reader.d.ts +17 -0
  8. package/dist/asar/dependency/collect.d.ts +2 -0
  9. package/dist/asar/dependency/detector.d.ts +8 -0
  10. package/dist/asar/dependency/hoister.d.ts +27 -0
  11. package/dist/asar/dependency/utils.d.ts +59 -0
  12. package/dist/asar/fileset/matcher.d.ts +12 -0
  13. package/dist/asar/fileset/platform-fileset.d.ts +36 -0
  14. package/dist/asar/fileset/transformer.d.ts +2 -0
  15. package/dist/asar/fileset/unpack-detector.d.ts +10 -0
  16. package/dist/asar/fileset/walker.d.ts +14 -0
  17. package/dist/asar/pack.d.ts +23 -0
  18. package/dist/asar/packer/app-collector.d.ts +2 -0
  19. package/dist/asar/packer/collector.d.ts +18 -0
  20. package/dist/asar/packer/concurrency.d.ts +1 -0
  21. package/dist/asar/packer/integrity.d.ts +8 -0
  22. package/dist/asar/packer/nm-collector.d.ts +7 -0
  23. package/dist/asar/packer/stream-builder.d.ts +18 -0
  24. package/dist/cli.d.ts +2 -0
  25. package/dist/config/index.d.ts +97 -0
  26. package/dist/electron/dist-zip.d.ts +18 -0
  27. package/dist/electron/download.d.ts +21 -0
  28. package/dist/index.d.ts +11 -0
  29. package/dist/packer/common/app-update-yml.d.ts +5 -0
  30. package/dist/packer/common/extra-resources.d.ts +39 -0
  31. package/dist/packer/common/staging.d.ts +3 -0
  32. package/dist/packer/common/template.d.ts +2 -0
  33. package/dist/packer/linux/linux.d.ts +2 -0
  34. package/dist/packer/mac/mac.d.ts +23 -0
  35. package/dist/packer/win/nsis.d.ts +24 -0
  36. package/dist/packer/win/resedit.d.ts +5 -0
  37. package/dist/packer/win/toolchain.d.ts +8 -0
  38. package/dist/packer/win/win.d.ts +12 -0
  39. package/dist/pipeline/pipeline.d.ts +41 -0
  40. package/dist/pipeline/targets.d.ts +28 -0
  41. package/dist/shared/hash.d.ts +2 -0
  42. package/dist/shared/logger.d.ts +39 -0
  43. package/dist/shared/platform.d.ts +26 -0
  44. package/dist/shared/types.d.ts +68 -0
  45. package/dist/update/blockmap.d.ts +13 -0
  46. package/dist/update/metadata.d.ts +20 -0
  47. package/dist/update/version.d.ts +7 -0
  48. package/package.json +71 -0
  49. package/src/archive/ar.ts +41 -0
  50. package/src/archive/seven-za.ts +160 -0
  51. package/src/archive/tar.ts +142 -0
  52. package/src/archive/zip-reader.ts +61 -0
  53. package/src/asar/dependency/collect.ts +437 -0
  54. package/src/asar/dependency/detector.ts +73 -0
  55. package/src/asar/dependency/hoister.ts +714 -0
  56. package/src/asar/dependency/utils.ts +225 -0
  57. package/src/asar/fileset/matcher.ts +101 -0
  58. package/src/asar/fileset/platform-fileset.ts +416 -0
  59. package/src/asar/fileset/transformer.ts +154 -0
  60. package/src/asar/fileset/unpack-detector.ts +38 -0
  61. package/src/asar/fileset/walker.ts +115 -0
  62. package/src/asar/pack.ts +186 -0
  63. package/src/asar/packer/app-collector.ts +74 -0
  64. package/src/asar/packer/collector.ts +134 -0
  65. package/src/asar/packer/concurrency.ts +24 -0
  66. package/src/asar/packer/integrity.ts +53 -0
  67. package/src/asar/packer/nm-collector.ts +194 -0
  68. package/src/asar/packer/stream-builder.ts +723 -0
  69. package/src/cli.ts +182 -0
  70. package/src/config/index.ts +365 -0
  71. package/src/electron/dist-zip.ts +65 -0
  72. package/src/electron/download.ts +121 -0
  73. package/src/index.ts +14 -0
  74. package/src/packer/common/app-update-yml.ts +21 -0
  75. package/src/packer/common/extra-resources.ts +83 -0
  76. package/src/packer/common/staging.ts +33 -0
  77. package/src/packer/common/template.ts +24 -0
  78. package/src/packer/linux/linux.ts +329 -0
  79. package/src/packer/mac/mac.ts +495 -0
  80. package/src/packer/win/nsis.ts +244 -0
  81. package/src/packer/win/resedit.ts +60 -0
  82. package/src/packer/win/toolchain.ts +63 -0
  83. package/src/packer/win/win.ts +421 -0
  84. package/src/pipeline/pipeline.ts +149 -0
  85. package/src/pipeline/targets.ts +67 -0
  86. package/src/shared/hash.ts +15 -0
  87. package/src/shared/logger.ts +91 -0
  88. package/src/shared/platform.ts +41 -0
  89. package/src/shared/types.ts +82 -0
  90. package/src/update/blockmap.ts +247 -0
  91. package/src/update/metadata.ts +97 -0
  92. package/src/update/version.ts +59 -0
  93. package/templates/linux/app.desktop +11 -0
  94. package/templates/linux/control +9 -0
  95. package/templates/linux/postinst +10 -0
  96. package/templates/linux/postrm +8 -0
  97. package/templates/linux/preinst +49 -0
  98. package/templates/linux/prerm +43 -0
  99. package/templates/mac/Info.plist +18 -0
  100. package/templates/mac/app-update.yml +4 -0
  101. package/templates/win/nsis/README.md +51 -0
  102. package/templates/win/nsis/THIRD-PARTY-NOTICES.md +20 -0
  103. package/templates/win/nsis/assistedInstaller.nsh +154 -0
  104. package/templates/win/nsis/assistedMessages.yml +368 -0
  105. package/templates/win/nsis/common.nsh +147 -0
  106. package/templates/win/nsis/empty-license.txt +1 -0
  107. package/templates/win/nsis/include/FileAssociation.nsh +123 -0
  108. package/templates/win/nsis/include/StdUtils.nsh +496 -0
  109. package/templates/win/nsis/include/StrContains.nsh +48 -0
  110. package/templates/win/nsis/include/UAC.nsh +299 -0
  111. package/templates/win/nsis/include/allowOnlyOneInstallerInstance.nsh +164 -0
  112. package/templates/win/nsis/include/extractAppPackage.nsh +138 -0
  113. package/templates/win/nsis/include/getProcessInfo.nsh +157 -0
  114. package/templates/win/nsis/include/installUtil.nsh +248 -0
  115. package/templates/win/nsis/include/installer.nsh +247 -0
  116. package/templates/win/nsis/include/nsProcess.nsh +28 -0
  117. package/templates/win/nsis/include/webPackage.nsh +64 -0
  118. package/templates/win/nsis/installSection.nsh +110 -0
  119. package/templates/win/nsis/installer.nsi +132 -0
  120. package/templates/win/nsis/messages.yml +240 -0
  121. package/templates/win/nsis/multiUser.nsh +134 -0
  122. package/templates/win/nsis/multiUserUi.nsh +230 -0
  123. package/templates/win/nsis/oneClick.nsh +19 -0
  124. package/templates/win/nsis/portable.nsi +91 -0
  125. package/templates/win/nsis/uninstaller.nsh +263 -0
  126. package/templates/win/nsis-header.nsh +57 -0
@@ -0,0 +1,496 @@
1
+ #################################################################################
2
+ # StdUtils plug-in for NSIS
3
+ # Copyright (C) 2004-2018 LoRd_MuldeR <MuldeR2@GMX.de>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ #
19
+ # http://www.gnu.org/licenses/lgpl-2.1.txt
20
+ #################################################################################
21
+
22
+ # DEVELOPER NOTES:
23
+ # - Please see "https://github.com/lordmulder/stdutils/" for news and updates!
24
+ # - Please see "Docs\StdUtils\StdUtils.html" for detailed function descriptions!
25
+ # - Please see "Examples\StdUtils\StdUtilsTest.nsi" for usage examples!
26
+
27
+ #################################################################################
28
+ # FUNCTION DECLARTIONS
29
+ #################################################################################
30
+
31
+ !ifndef ___STDUTILS__NSH___
32
+ !define ___STDUTILS__NSH___
33
+
34
+ !define StdUtils.Time '!insertmacro _StdU_Time' #time(), as in C standard library
35
+ !define StdUtils.GetMinutes '!insertmacro _StdU_GetMinutes' #GetSystemTimeAsFileTime(), returns the number of minutes
36
+ !define StdUtils.GetHours '!insertmacro _StdU_GetHours' #GetSystemTimeAsFileTime(), returns the number of hours
37
+ !define StdUtils.GetDays '!insertmacro _StdU_GetDays' #GetSystemTimeAsFileTime(), returns the number of days
38
+ !define StdUtils.Rand '!insertmacro _StdU_Rand' #rand(), as in C standard library
39
+ !define StdUtils.RandMax '!insertmacro _StdU_RandMax' #rand(), as in C standard library, with maximum value
40
+ !define StdUtils.RandMinMax '!insertmacro _StdU_RandMinMax' #rand(), as in C standard library, with minimum/maximum value
41
+ !define StdUtils.RandList '!insertmacro _StdU_RandList' #rand(), as in C standard library, with list support
42
+ !define StdUtils.RandBytes '!insertmacro _StdU_RandBytes' #Generates random bytes, returned as Base64-encoded string
43
+ !define StdUtils.FormatStr '!insertmacro _StdU_FormatStr' #sprintf(), as in C standard library, one '%d' placeholder
44
+ !define StdUtils.FormatStr2 '!insertmacro _StdU_FormatStr2' #sprintf(), as in C standard library, two '%d' placeholders
45
+ !define StdUtils.FormatStr3 '!insertmacro _StdU_FormatStr3' #sprintf(), as in C standard library, three '%d' placeholders
46
+ !define StdUtils.ScanStr '!insertmacro _StdU_ScanStr' #sscanf(), as in C standard library, one '%d' placeholder
47
+ !define StdUtils.ScanStr2 '!insertmacro _StdU_ScanStr2' #sscanf(), as in C standard library, two '%d' placeholders
48
+ !define StdUtils.ScanStr3 '!insertmacro _StdU_ScanStr3' #sscanf(), as in C standard library, three '%d' placeholders
49
+ !define StdUtils.TrimStr '!insertmacro _StdU_TrimStr' #Remove whitspaces from string, left and right
50
+ !define StdUtils.TrimStrLeft '!insertmacro _StdU_TrimStrLeft' #Remove whitspaces from string, left side only
51
+ !define StdUtils.TrimStrRight '!insertmacro _StdU_TrimStrRight' #Remove whitspaces from string, right side only
52
+ !define StdUtils.RevStr '!insertmacro _StdU_RevStr' #Reverse a string, e.g. "reverse me" <-> "em esrever"
53
+ !define StdUtils.ValidFileName '!insertmacro _StdU_ValidFileName' #Test whether string is a valid file name - no paths allowed
54
+ !define StdUtils.ValidPathSpec '!insertmacro _StdU_ValidPathSpec' #Test whether string is a valid full(!) path specification
55
+ !define StdUtils.ValidDomainName '!insertmacro _StdU_ValidDomain' #Test whether string is a valid host name or domain name
56
+ !define StdUtils.StrToUtf8 '!insertmacro _StdU_StrToUtf8' #Convert string from Unicode (UTF-16) or ANSI to UTF-8 bytes
57
+ !define StdUtils.StrFromUtf8 '!insertmacro _StdU_StrFromUtf8' #Convert string from UTF-8 bytes to Unicode (UTF-16) or ANSI
58
+ !define StdUtils.SHFileMove '!insertmacro _StdU_SHFileMove' #SHFileOperation(), using the FO_MOVE operation
59
+ !define StdUtils.SHFileCopy '!insertmacro _StdU_SHFileCopy' #SHFileOperation(), using the FO_COPY operation
60
+ !define StdUtils.AppendToFile '!insertmacro _StdU_AppendToFile' #Append contents of an existing file to another file
61
+ !define StdUtils.ExecShellAsUser '!insertmacro _StdU_ExecShlUser' #ShellExecute() as NON-elevated user from elevated installer
62
+ !define StdUtils.InvokeShellVerb '!insertmacro _StdU_InvkeShlVrb' #Invokes a "shell verb", e.g. for pinning items to the taskbar
63
+ !define StdUtils.ExecShellWaitEx '!insertmacro _StdU_ExecShlWaitEx' #ShellExecuteEx(), returns the handle of the new process
64
+ !define StdUtils.WaitForProcEx '!insertmacro _StdU_WaitForProcEx' #WaitForSingleObject(), e.g. to wait for a running process
65
+ !define StdUtils.GetParameter '!insertmacro _StdU_GetParameter' #Get the value of a specific command-line option
66
+ !define StdUtils.TestParameter '!insertmacro _StdU_TestParameter' #Test whether a specific command-line option has been set
67
+ !define StdUtils.ParameterCnt '!insertmacro _StdU_ParameterCnt' #Get number of command-line tokens, similar to argc in main()
68
+ !define StdUtils.ParameterStr '!insertmacro _StdU_ParameterStr' #Get the n-th command-line token, similar to argv[i] in main()
69
+ !define StdUtils.GetAllParameters '!insertmacro _StdU_GetAllParams' #Get complete command-line, but without executable name
70
+ !define StdUtils.GetRealOSVersion '!insertmacro _StdU_GetRealOSVer' #Get the *real* Windows version number, even on Windows 8.1+
71
+ !define StdUtils.GetRealOSBuildNo '!insertmacro _StdU_GetRealOSBld' #Get the *real* Windows build number, even on Windows 8.1+
72
+ !define StdUtils.GetRealOSName '!insertmacro _StdU_GetRealOSStr' #Get the *real* Windows version, as a "friendly" name
73
+ !define StdUtils.GetOSEdition '!insertmacro _StdU_GetOSEdition' #Get the Windows edition, i.e. "workstation" or "server"
74
+ !define StdUtils.GetOSReleaseId '!insertmacro _StdU_GetOSRelIdNo' #Get the Windows release identifier (on Windows 10)
75
+ !define StdUtils.VerifyOSVersion '!insertmacro _StdU_VrfyRealOSVer' #Compare *real* operating system to an expected version number
76
+ !define StdUtils.VerifyOSBuildNo '!insertmacro _StdU_VrfyRealOSBld' #Compare *real* operating system to an expected build number
77
+ !define StdUtils.HashText '!insertmacro _StdU_HashText' #Compute hash from text string (CRC32, MD5, SHA1/2/3, BLAKE2)
78
+ !define StdUtils.HashFile '!insertmacro _StdU_HashFile' #Compute hash from file (CRC32, MD5, SHA1/2/3, BLAKE2)
79
+ !define StdUtils.NormalizePath '!insertmacro _StdU_NormalizePath' #Simplifies the path to produce a direct, well-formed path
80
+ !define StdUtils.GetParentPath '!insertmacro _StdU_GetParentPath' #Get parent path by removing the last component from the path
81
+ !define StdUtils.SplitPath '!insertmacro _StdU_SplitPath' #Split the components of the given path
82
+ !define StdUtils.GetDrivePart '!insertmacro _StdU_GetDrivePart' #Get drive component of path
83
+ !define StdUtils.GetDirectoryPart '!insertmacro _StdU_GetDirPart' #Get directory component of path
84
+ !define StdUtils.GetFileNamePart '!insertmacro _StdU_GetFNamePart' #Get file name component of path
85
+ !define StdUtils.GetExtensionPart '!insertmacro _StdU_GetExtnPart' #Get file extension component of path
86
+ !define StdUtils.TimerCreate '!insertmacro _StdU_TimerCreate' #Create a new event-timer that will be triggered periodically
87
+ !define StdUtils.TimerDestroy '!insertmacro _StdU_TimerDestroy' #Destroy a running timer created with TimerCreate()
88
+ !define StdUtils.ProtectStr '!insertmacro _StdU_PrtctStr' #Protect a given String using Windows' DPAPI
89
+ !define StdUtils.UnprotectStr '!insertmacro _StdU_UnprtctStr' #Unprotect a string that was protected via ProtectStr()
90
+ !define StdUtils.GetLibVersion '!insertmacro _StdU_GetLibVersion' #Get the current StdUtils library version (for debugging)
91
+ !define StdUtils.SetVerbose '!insertmacro _StdU_SetVerbose' #Enable or disable "verbose" mode (for debugging)
92
+
93
+
94
+ #################################################################################
95
+ # MACRO DEFINITIONS
96
+ #################################################################################
97
+
98
+ !macro _StdU_Time out
99
+ StdUtils::Time /NOUNLOAD
100
+ pop ${out}
101
+ !macroend
102
+
103
+ !macro _StdU_GetMinutes out
104
+ StdUtils::GetMinutes /NOUNLOAD
105
+ pop ${out}
106
+ !macroend
107
+
108
+ !macro _StdU_GetHours out
109
+ StdUtils::GetHours /NOUNLOAD
110
+ pop ${out}
111
+ !macroend
112
+
113
+ !macro _StdU_GetDays out
114
+ StdUtils::GetDays /NOUNLOAD
115
+ pop ${out}
116
+ !macroend
117
+
118
+ !macro _StdU_Rand out
119
+ StdUtils::Rand /NOUNLOAD
120
+ pop ${out}
121
+ !macroend
122
+
123
+ !macro _StdU_RandMax out max
124
+ push ${max}
125
+ StdUtils::RandMax /NOUNLOAD
126
+ pop ${out}
127
+ !macroend
128
+
129
+ !macro _StdU_RandMinMax out min max
130
+ push ${min}
131
+ push ${max}
132
+ StdUtils::RandMinMax /NOUNLOAD
133
+ pop ${out}
134
+ !macroend
135
+
136
+ !macro _StdU_RandList count max
137
+ push ${max}
138
+ push ${count}
139
+ StdUtils::RandList /NOUNLOAD
140
+ !macroend
141
+
142
+ !macro _StdU_RandBytes out count
143
+ push ${count}
144
+ StdUtils::RandBytes /NOUNLOAD
145
+ pop ${out}
146
+ !macroend
147
+
148
+ !macro _StdU_FormatStr out format val
149
+ push `${format}`
150
+ push ${val}
151
+ StdUtils::FormatStr /NOUNLOAD
152
+ pop ${out}
153
+ !macroend
154
+
155
+ !macro _StdU_FormatStr2 out format val1 val2
156
+ push `${format}`
157
+ push ${val1}
158
+ push ${val2}
159
+ StdUtils::FormatStr2 /NOUNLOAD
160
+ pop ${out}
161
+ !macroend
162
+
163
+ !macro _StdU_FormatStr3 out format val1 val2 val3
164
+ push `${format}`
165
+ push ${val1}
166
+ push ${val2}
167
+ push ${val3}
168
+ StdUtils::FormatStr3 /NOUNLOAD
169
+ pop ${out}
170
+ !macroend
171
+
172
+ !macro _StdU_ScanStr out format input default
173
+ push `${format}`
174
+ push `${input}`
175
+ push ${default}
176
+ StdUtils::ScanStr /NOUNLOAD
177
+ pop ${out}
178
+ !macroend
179
+
180
+ !macro _StdU_ScanStr2 out1 out2 format input default1 default2
181
+ push `${format}`
182
+ push `${input}`
183
+ push ${default1}
184
+ push ${default2}
185
+ StdUtils::ScanStr2 /NOUNLOAD
186
+ pop ${out1}
187
+ pop ${out2}
188
+ !macroend
189
+
190
+ !macro _StdU_ScanStr3 out1 out2 out3 format input default1 default2 default3
191
+ push `${format}`
192
+ push `${input}`
193
+ push ${default1}
194
+ push ${default2}
195
+ push ${default3}
196
+ StdUtils::ScanStr3 /NOUNLOAD
197
+ pop ${out1}
198
+ pop ${out2}
199
+ pop ${out3}
200
+ !macroend
201
+
202
+ !macro _StdU_TrimStr var
203
+ push ${var}
204
+ StdUtils::TrimStr /NOUNLOAD
205
+ pop ${var}
206
+ !macroend
207
+
208
+ !macro _StdU_TrimStrLeft var
209
+ push ${var}
210
+ StdUtils::TrimStrLeft /NOUNLOAD
211
+ pop ${var}
212
+ !macroend
213
+
214
+ !macro _StdU_TrimStrRight var
215
+ push ${var}
216
+ StdUtils::TrimStrRight /NOUNLOAD
217
+ pop ${var}
218
+ !macroend
219
+
220
+ !macro _StdU_RevStr var
221
+ push ${var}
222
+ StdUtils::RevStr /NOUNLOAD
223
+ pop ${var}
224
+ !macroend
225
+
226
+ !macro _StdU_ValidFileName out test
227
+ push `${test}`
228
+ StdUtils::ValidFileName /NOUNLOAD
229
+ pop ${out}
230
+ !macroend
231
+
232
+ !macro _StdU_ValidPathSpec out test
233
+ push `${test}`
234
+ StdUtils::ValidPathSpec /NOUNLOAD
235
+ pop ${out}
236
+ !macroend
237
+
238
+ !macro _StdU_ValidDomain out test
239
+ push `${test}`
240
+ StdUtils::ValidDomainName /NOUNLOAD
241
+ pop ${out}
242
+ !macroend
243
+
244
+
245
+ !macro _StdU_StrToUtf8 out str
246
+ push `${str}`
247
+ StdUtils::StrToUtf8 /NOUNLOAD
248
+ pop ${out}
249
+ !macroend
250
+
251
+ !macro _StdU_StrFromUtf8 out trnc str
252
+ push ${trnc}
253
+ push `${str}`
254
+ StdUtils::StrFromUtf8 /NOUNLOAD
255
+ pop ${out}
256
+ !macroend
257
+
258
+ !macro _StdU_SHFileMove out from to hwnd
259
+ push `${from}`
260
+ push `${to}`
261
+ push ${hwnd}
262
+ StdUtils::SHFileMove /NOUNLOAD
263
+ pop ${out}
264
+ !macroend
265
+
266
+ !macro _StdU_SHFileCopy out from to hwnd
267
+ push `${from}`
268
+ push `${to}`
269
+ push ${hwnd}
270
+ StdUtils::SHFileCopy /NOUNLOAD
271
+ pop ${out}
272
+ !macroend
273
+
274
+ !macro _StdU_AppendToFile out from dest offset maxlen
275
+ push `${from}`
276
+ push `${dest}`
277
+ push ${offset}
278
+ push ${maxlen}
279
+ StdUtils::AppendToFile /NOUNLOAD
280
+ pop ${out}
281
+ !macroend
282
+
283
+ !macro _StdU_ExecShlUser out file verb args
284
+ push `${file}`
285
+ push `${verb}`
286
+ push `${args}`
287
+ StdUtils::ExecShellAsUser /NOUNLOAD
288
+ pop ${out}
289
+ !macroend
290
+
291
+ !macro _StdU_InvkeShlVrb out path file verb_id
292
+ push "${path}"
293
+ push "${file}"
294
+ push ${verb_id}
295
+ StdUtils::InvokeShellVerb /NOUNLOAD
296
+ pop ${out}
297
+ !macroend
298
+
299
+ !macro _StdU_ExecShlWaitEx out_res out_val file verb args
300
+ push `${file}`
301
+ push `${verb}`
302
+ push `${args}`
303
+ StdUtils::ExecShellWaitEx /NOUNLOAD
304
+ pop ${out_res}
305
+ pop ${out_val}
306
+ !macroend
307
+
308
+ !macro _StdU_WaitForProcEx out handle
309
+ push `${handle}`
310
+ StdUtils::WaitForProcEx /NOUNLOAD
311
+ pop ${out}
312
+ !macroend
313
+
314
+ !macro _StdU_GetParameter out name default
315
+ push `${name}`
316
+ push `${default}`
317
+ StdUtils::GetParameter /NOUNLOAD
318
+ pop ${out}
319
+ !macroend
320
+
321
+ !macro _StdU_TestParameter out name
322
+ push `${name}`
323
+ StdUtils::TestParameter /NOUNLOAD
324
+ pop ${out}
325
+ !macroend
326
+
327
+ !macro _StdU_ParameterCnt out
328
+ StdUtils::ParameterCnt /NOUNLOAD
329
+ pop ${out}
330
+ !macroend
331
+
332
+ !macro _StdU_ParameterStr out index
333
+ push ${index}
334
+ StdUtils::ParameterStr /NOUNLOAD
335
+ pop ${out}
336
+ !macroend
337
+
338
+ !macro _StdU_GetAllParams out truncate
339
+ push `${truncate}`
340
+ StdUtils::GetAllParameters /NOUNLOAD
341
+ pop ${out}
342
+ !macroend
343
+
344
+ !macro _StdU_GetRealOSVer out_major out_minor out_spack
345
+ StdUtils::GetRealOsVersion /NOUNLOAD
346
+ pop ${out_major}
347
+ pop ${out_minor}
348
+ pop ${out_spack}
349
+ !macroend
350
+
351
+ !macro _StdU_GetRealOSBld out
352
+ StdUtils::GetRealOsBuildNo /NOUNLOAD
353
+ pop ${out}
354
+ !macroend
355
+
356
+ !macro _StdU_GetRealOSStr out
357
+ StdUtils::GetRealOsName /NOUNLOAD
358
+ pop ${out}
359
+ !macroend
360
+
361
+ !macro _StdU_VrfyRealOSVer out major minor spack
362
+ push `${major}`
363
+ push `${minor}`
364
+ push `${spack}`
365
+ StdUtils::VerifyRealOsVersion /NOUNLOAD
366
+ pop ${out}
367
+ !macroend
368
+
369
+ !macro _StdU_VrfyRealOSBld out build
370
+ push `${build}`
371
+ StdUtils::VerifyRealOsBuildNo /NOUNLOAD
372
+ pop ${out}
373
+ !macroend
374
+
375
+ !macro _StdU_GetOSEdition out
376
+ StdUtils::GetOsEdition /NOUNLOAD
377
+ pop ${out}
378
+ !macroend
379
+
380
+
381
+ !macro _StdU_GetOSRelIdNo out
382
+ StdUtils::GetOsReleaseId /NOUNLOAD
383
+ pop ${out}
384
+ !macroend
385
+
386
+ !macro _StdU_HashText out type text
387
+ push `${type}`
388
+ push `${text}`
389
+ StdUtils::HashText /NOUNLOAD
390
+ pop ${out}
391
+ !macroend
392
+
393
+ !macro _StdU_HashFile out type file
394
+ push `${type}`
395
+ push `${file}`
396
+ StdUtils::HashFile /NOUNLOAD
397
+ pop ${out}
398
+ !macroend
399
+
400
+ !macro _StdU_NormalizePath out path
401
+ push `${path}`
402
+ StdUtils::NormalizePath /NOUNLOAD
403
+ pop ${out}
404
+ !macroend
405
+
406
+ !macro _StdU_GetParentPath out path
407
+ push `${path}`
408
+ StdUtils::GetParentPath /NOUNLOAD
409
+ pop ${out}
410
+ !macroend
411
+
412
+ !macro _StdU_SplitPath out_drive out_dir out_fname out_ext path
413
+ push `${path}`
414
+ StdUtils::SplitPath /NOUNLOAD
415
+ pop ${out_drive}
416
+ pop ${out_dir}
417
+ pop ${out_fname}
418
+ pop ${out_ext}
419
+ !macroend
420
+
421
+ !macro _StdU_GetDrivePart out path
422
+ push `${path}`
423
+ StdUtils::GetDrivePart /NOUNLOAD
424
+ pop ${out}
425
+ !macroend
426
+
427
+ !macro _StdU_GetDirPart out path
428
+ push `${path}`
429
+ StdUtils::GetDirectoryPart /NOUNLOAD
430
+ pop ${out}
431
+ !macroend
432
+
433
+ !macro _StdU_GetFNamePart out path
434
+ push `${path}`
435
+ StdUtils::GetFileNamePart /NOUNLOAD
436
+ pop ${out}
437
+ !macroend
438
+
439
+ !macro _StdU_GetExtnPart out path
440
+ push `${path}`
441
+ StdUtils::GetExtensionPart /NOUNLOAD
442
+ pop ${out}
443
+ !macroend
444
+
445
+ !macro _StdU_TimerCreate out callback interval
446
+ GetFunctionAddress ${out} ${callback}
447
+ push ${out}
448
+ push ${interval}
449
+ StdUtils::TimerCreate /NOUNLOAD
450
+ pop ${out}
451
+ !macroend
452
+
453
+ !macro _StdU_TimerDestroy out timer_id
454
+ push ${timer_id}
455
+ StdUtils::TimerDestroy /NOUNLOAD
456
+ pop ${out}
457
+ !macroend
458
+
459
+ !macro _StdU_PrtctStr out dpsc salt text
460
+ push `${dpsc}`
461
+ push `${salt}`
462
+ push `${text}`
463
+ StdUtils::ProtectStr /NOUNLOAD
464
+ pop ${out}
465
+ !macroend
466
+
467
+ !macro _StdU_UnprtctStr out trnc salt data
468
+ push `${trnc}`
469
+ push `${salt}`
470
+ push `${data}`
471
+ StdUtils::UnprotectStr /NOUNLOAD
472
+ pop ${out}
473
+ !macroend
474
+
475
+ !macro _StdU_GetLibVersion out_ver out_tst
476
+ StdUtils::GetLibVersion /NOUNLOAD
477
+ pop ${out_ver}
478
+ pop ${out_tst}
479
+ !macroend
480
+
481
+ !macro _StdU_SetVerbose enable
482
+ Push ${enable}
483
+ StdUtils::SetVerboseMode /NOUNLOAD
484
+ !macroend
485
+
486
+
487
+ #################################################################################
488
+ # MAGIC NUMBERS
489
+ #################################################################################
490
+
491
+ !define StdUtils.Const.ShellVerb.PinToTaskbar 0
492
+ !define StdUtils.Const.ShellVerb.UnpinFromTaskbar 1
493
+ !define StdUtils.Const.ShellVerb.PinToStart 2
494
+ !define StdUtils.Const.ShellVerb.UnpinFromStart 3
495
+
496
+ !endif # !___STDUTILS__NSH___
@@ -0,0 +1,48 @@
1
+ ; StrContains
2
+ ; This function does a case sensitive searches for an occurrence of a substring in a string.
3
+ ; It returns the substring if it is found.
4
+ ; Otherwise it returns null("").
5
+ ; Written by kenglish_hi
6
+ ; Adapted from StrReplace written by dandaman32
7
+
8
+
9
+ Var STR_HAYSTACK
10
+ Var STR_NEEDLE
11
+ Var STR_CONTAINS_VAR_1
12
+ Var STR_CONTAINS_VAR_2
13
+ Var STR_CONTAINS_VAR_3
14
+ Var STR_CONTAINS_VAR_4
15
+ Var STR_RETURN_VAR
16
+
17
+ Function StrContains
18
+ Exch $STR_NEEDLE
19
+ Exch 1
20
+ Exch $STR_HAYSTACK
21
+ ; Uncomment to debug
22
+ ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
23
+ StrCpy $STR_RETURN_VAR ""
24
+ StrCpy $STR_CONTAINS_VAR_1 -1
25
+ StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
26
+ StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
27
+ loop:
28
+ IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
29
+ StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
30
+ StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
31
+ StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
32
+ Goto loop
33
+ found:
34
+ StrCpy $STR_RETURN_VAR $STR_NEEDLE
35
+ Goto done
36
+ done:
37
+ Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
38
+ Exch $STR_RETURN_VAR
39
+ FunctionEnd
40
+
41
+ !macro _StrContainsConstructor OUT NEEDLE HAYSTACK
42
+ Push `${HAYSTACK}`
43
+ Push `${NEEDLE}`
44
+ Call StrContains
45
+ Pop `${OUT}`
46
+ !macroend
47
+
48
+ !define StrContains '!insertmacro "_StrContainsConstructor"'