diff options
author | Matt Graeber <mattgraeber@gmail.com> | 2013-08-16 06:28:47 -0400 |
---|---|---|
committer | Matt Graeber <mattgraeber@gmail.com> | 2013-08-16 06:28:47 -0400 |
commit | 9577a4e2c2ea2679c96874498de037a88911962b (patch) | |
tree | 05df45e87dde7fdfca6c4206c99534684cbb2909 | |
parent | 98be62a03a58d7b78f545cd25f7846f70c674b96 (diff) | |
download | PowerSploit-9577a4e2c2ea2679c96874498de037a88911962b.tar.gz PowerSploit-9577a4e2c2ea2679c96874498de037a88911962b.zip |
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.
-rw-r--r-- | PETools/Get-PEHeader.ps1 | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/PETools/Get-PEHeader.ps1 b/PETools/Get-PEHeader.ps1 index 551aac0..2f35292 100644 --- a/PETools/Get-PEHeader.ps1 +++ b/PETools/Get-PEHeader.ps1 @@ -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 |