mirror of
https://github.com/PowerShellMafia/PowerSploit
synced 2026-06-08 12:13:33 +00:00
Compiler parameters were not applied to Add-Type
The compiler parameters were not being applied to Add-Type in Get-PEHeader. Derp. This led to unexpected errors when Visual Studio environment variables were defined.
This commit is contained in:
@@ -525,12 +525,10 @@ PROCESS {
|
||||
}
|
||||
"@
|
||||
|
||||
$location = [PsObject].Assembly.Location
|
||||
$compileParams = New-Object System.CodeDom.Compiler.CompilerParameters
|
||||
$assemblyRange = @("System.dll", $location)
|
||||
$compileParams.ReferencedAssemblies.AddRange($assemblyRange)
|
||||
$compileParams.ReferencedAssemblies.AddRange(@('System.dll', 'mscorlib.dll'))
|
||||
$compileParams.GenerateInMemory = $True
|
||||
Add-Type -TypeDefinition $code -passthru -WarningAction SilentlyContinue | Out-Null
|
||||
Add-Type -TypeDefinition $code -CompilerParameters $compileParams -PassThru -WarningAction SilentlyContinue | Out-Null
|
||||
}
|
||||
|
||||
function Get-DelegateType
|
||||
|
||||
Reference in New Issue
Block a user