-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy_asan_dll.ps1
More file actions
28 lines (25 loc) · 794 Bytes
/
copy_asan_dll.ps1
File metadata and controls
28 lines (25 loc) · 794 Bytes
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
param (
[Parameter(Mandatory=$true)][string]$TargetPath,
[Parameter(Mandatory=$true)][string]$TargetDir,
[Parameter(Mandatory=$false)][switch]$Info
)
$dlls = dumpbin /DEPENDENTS $TargetPath | findstr asan
function PrintIfVerbose {
param (
[Parameter(Mandatory=$true)][string]$message
)
if ($Info) {
Write-Output $message
}
}
foreach ($dll in $dlls) {
$dll = $dll.Trim()
PrintIfVerbose "Trying to copy dependency $dll"
if (Test-Path $TargetDir\$dll -PathType Leaf) {
PrintIfVerbose "$dll already exists, removing $TargetDir\$dll"
Remove-Item -Force $TargetDir\$dll
}
$fulldllpath = where.exe $dll
PrintIfVerbose "Copying $fulldllpath to $TargetDir"
Copy-Item -Force -Destination $TargetDir -Path $fulldllpath
}