You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$err="Did not find the platform of the exe $fullName)."
212
+
}
213
+
214
+
$platform=$m.Matches.Groups[1].Value
215
+
$fullName=$_.FullName
216
+
$name=$_.Name
217
+
218
+
if ("x86"-eq$platform) {
219
+
$corFlagsOutput=&$corFlags$fullName
220
+
# this is an native x86 exe or a .net x86 that requires of prefers 32bit
221
+
$platform=if ($corFlagsOutput-like"*does not have a valid managed header*"-or$corFlagsOutput-like"*32BITREQ : 1*"-or$corFlagsOutput-like"*32BITPREF : 1*") {
222
+
# this is an native x86 exe or a .net x86 that requires of prefers 32bit
223
+
"x86" } else {
224
+
# this is a x86 executable that is built as AnyCpu and does not prefer 32-bit so it will run as x64 on 64-bit system.
225
+
"x86-64" }
226
+
}
227
+
228
+
if (($pair=$exclusions.GetEnumerator() |Where-Object { $fullName-like"*$($_.Name)" })) {
229
+
if (1-lt$($pair).Count) {
230
+
$err="Too many paths matched the query, only one match is allowed. Matches: $($pair.Name)"
231
+
$errs+=$err
232
+
Write-Host-ForegroundColor Red Error: $err
233
+
}
234
+
235
+
if ($platform-ne$pair.Value) {
236
+
$err="$fullName must have architecture $($pair.Value), but it was $platform."
237
+
$errs+=$err
238
+
Write-Host-ForegroundColor Red Error: $err
239
+
}
240
+
}
241
+
elseif ("x86"-eq$platform) {
242
+
if ($name-notlike"*x86*") {
243
+
$err="$fullName has architecture $platform, and must contain x86 in the name of the executable."
244
+
$errs+=$err
245
+
Write-Host-ForegroundColor Red Error: $err
246
+
}
247
+
}
248
+
elseif ($platform-in"x64","x86-64") {
249
+
if ($name-like"*x86*"-or$name-like"*arm64*") {
250
+
$err="$fullName has architecture $platform, and must NOT contain x86 or arm64 in the name of the executable."
251
+
$errs+=$err
252
+
Write-Host-ForegroundColor Red Error: $err
253
+
}
254
+
}
255
+
elseif ("arm64"-eq$platform) {
256
+
if ($name-notlike"*arm64*") {
257
+
$err="$fullName has architecture $platform, and must contain arm64 in the name of the executable."
258
+
$errs+=$err
259
+
Write-Host-ForegroundColor Red Error: $err
260
+
}
261
+
}
262
+
else {
263
+
$err="$fullName has unknown architecture $platform."
0 commit comments