Merge pull request #1210 from PowerShell/andschwa/rtm

Update PowerShell to use .NET Core 1.0
This commit is contained in:
Andy Schwartzmeyer
2016-06-28 14:37:20 -07:00
committed by GitHub
43 changed files with 117 additions and 3157 deletions
-7
View File
@@ -916,18 +916,12 @@ function Start-TypeGen
[CmdletBinding()]
param()
if (!$IsWindows)
{
throw "Start-TypeGen is not supported on non-windows. Use src/TypeCatalogGen/build.sh instead"
}
# Add .NET CLI tools to PATH
Find-Dotnet
Push-Location "$PSScriptRoot/src/TypeCatalogParser"
try
{
dotnet restore -v Warning
dotnet run
}
finally
@@ -938,7 +932,6 @@ function Start-TypeGen
Push-Location "$PSScriptRoot/src/TypeCatalogGen"
try
{
dotnet restore -v Warning
dotnet run ../Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs powershell.inc
}
finally
+2 -2
View File
@@ -11,8 +11,8 @@
"netstandard1.3": {
"imports": [ "net40" ],
"dependencies": {
"Microsoft.NETCore": "5.0.1-rc2-24027",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027"
"Microsoft.NETCore": "5.0.1",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1"
}
}
}
-5
View File
@@ -6,11 +6,6 @@
</config>
<packageSources>
<clear />
<add key="CI Builds (dotnet-core)" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="CI Builds (dotnet-cli)" value="http://myget.org/F/dotnet-cli/api/v3/index.json" />
<add key="CI Builds (NuGet)" value="https://www.myget.org/F/nugetbuild/api/v3/index.json" />
<add key="CI Builds (xUnit)" value="https://www.myget.org/F/coreclr-xunit/api/v3/index.json" />
<add key="CI Builds (aspnetcidev)" value="http://myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="appveyor-psl-windows-build" value="https://ci.appveyor.com/nuget/psl-windows-build-buunqeauqyp5" />
</packageSources>
@@ -42,7 +42,7 @@
}
},
"netstandard1.5": {
"netstandard1.6": {
"imports": ["dnxcore50"],
"buildOptions": {
"define": ["CORECLR"]
@@ -42,7 +42,7 @@
}
},
"netstandard1.5": {
"netstandard1.6": {
"imports": ["dnxcore50"],
"buildOptions": {
"define": ["CORECLR"],
@@ -42,7 +42,7 @@
}
},
"netstandard1.5": {
"netstandard1.6": {
"imports": ["dnxcore50"],
"buildOptions": {
"define": ["CORECLR"]
@@ -50,7 +50,7 @@
}
},
"netstandard1.5": {
"netstandard1.6": {
"imports": ["dnxcore50"],
"buildOptions": {
"define": ["CORECLR"],
@@ -63,7 +63,7 @@
}
},
"dependencies": {
"System.Linq.Parallel": "4.0.1-rc2-24027"
"System.Linq.Parallel": "4.0.1"
}
}
}
@@ -51,7 +51,7 @@
}
},
"netstandard1.5": {
"netstandard1.6": {
"imports": ["dnxcore50"],
"buildOptions": {
"define": ["CORECLR"],
@@ -64,7 +64,7 @@
}
},
"dependencies": {
"System.Linq.Parallel": "4.0.1-rc2-24027"
"System.Linq.Parallel": "4.0.1"
}
}
}
+1 -1
View File
@@ -46,7 +46,7 @@
}
},
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR" ],
@@ -192,7 +192,7 @@ namespace Microsoft.PackageManagement.Provider.Utility
#if !CORECLR
Marshal.ZeroFreeGlobalAllocUnicode(value);
#else
SecureStringMarshal.ZeroFreeCoTaskMemUnicode(value);
Marshal.ZeroFreeCoTaskMemUnicode(value);
#endif
}
}
@@ -250,4 +250,4 @@ namespace Microsoft.PackageManagement.Provider.Utility
}
}
}
}
@@ -11,7 +11,7 @@
"System.Management.Automation": "1.0.0-*"
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [
"dnxcore50"
],
@@ -96,7 +96,7 @@ namespace Microsoft.PowerShell.Cim
}
finally
{
ClrFacade.ZeroFreeCoTaskMemUnicode(plainTextString);
Marshal.ZeroFreeCoTaskMemUnicode(plainTextString);
}
}
@@ -2574,7 +2574,7 @@ namespace Microsoft.PowerShell.Commands
{
if (password != IntPtr.Zero)
{
ClrFacade.ZeroFreeCoTaskMemUnicode(password);
Marshal.ZeroFreeCoTaskMemUnicode(password);
}
}
}//end of if
@@ -2230,7 +2230,7 @@ namespace Microsoft.PowerShell.Commands
{
if (IntPtr.Zero != password)
{
ClrFacade.ZeroFreeCoTaskMemUnicode(password);
Marshal.ZeroFreeCoTaskMemUnicode(password);
}
if (IntPtr.Zero != hService)
@@ -15,7 +15,7 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR" ],
@@ -45,8 +45,8 @@
}
},
"dependencies": {
"System.ServiceProcess.ServiceController": "4.1.0-rc2-24027",
"System.Net.NameResolution": "4.0.0-rc2-24027"
"System.ServiceProcess.ServiceController": "4.1.0",
"System.Net.NameResolution": "4.0.0"
}
},
"net451": {
@@ -15,7 +15,7 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"buildOptions": {
"define": [ "CORECLR" ],
"compile": {
@@ -62,7 +62,7 @@
"dependencies": {
"Microsoft.CodeAnalysis.CSharp": "1.1.1",
"Newtonsoft.Json": "8.0.2",
"System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-24027"
"System.Diagnostics.TextWriterTraceListener": "4.0.0"
}
},
"net451": {
@@ -41,15 +41,15 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"buildOptions": {
"define": [ "CORECLR", "PORTABLE" ]
},
"dependencies": {
"Newtonsoft.Json": "8.0.2",
"System.Xml.XDocument": "4.0.11-rc2-24027",
"System.IO.MemoryMappedFiles": "4.0.0-rc2-24027"
"System.Xml.XDocument": "4.0.11",
"System.IO.MemoryMappedFiles": "4.0.0"
}
},
"net451": {
File diff suppressed because it is too large Load Diff
@@ -18,16 +18,16 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR" ]
},
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Runtime.Loader": "4.0.0-rc2-24027",
"NETStandard.Library": "1.6.0",
"System.Runtime.Loader": "4.0.0",
"System.Reflection.Metadata": "1.1.0",
"System.Security.Cryptography.Algorithms": "4.1.0-rc2-24027"
"System.Security.Cryptography.Algorithms": "4.2.0"
}
}
}
@@ -11,16 +11,17 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR" ]
},
"dependencies": {
"System.Security.Principal": "4.0.1-rc2-24027",
"System.Security.Principal.Windows": "4.0.0-rc2-24027",
"System.Diagnostics.TraceSource": "4.0.0-rc2-24027",
"System.Security.SecureString": "4.0.0-*"
"NETStandard.Library": "1.6.0",
"System.Security.Principal": "4.0.1",
"System.Security.Principal.Windows": "4.0.0",
"System.Diagnostics.TraceSource": "4.0.0",
"System.Security.SecureString": "4.0.0"
}
}
}
@@ -160,7 +160,7 @@ namespace System.Management.Automation.SecurityAccountsManager.Extensions
#if CORECLR
IntPtr buffer = SecureStringMarshal.SecureStringToCoTaskMemUnicode(str);
string clear = Marshal.PtrToStringUni(buffer);
SecureStringMarshal.ZeroFreeCoTaskMemUnicode(buffer);
Marshal.ZeroFreeCoTaskMemUnicode(buffer);
#else
var bstr = Marshal.SecureStringToBSTR(str);
string clear = Marshal.PtrToStringAuto(bstr);
@@ -200,4 +200,4 @@ namespace System.Management.Automation.SecurityAccountsManager.Extensions
return ex.MakeErrorRecord(ex.ErrorName, ex.ErrorCategory, target ?? ex.Target);
}
}
}
}
@@ -14,13 +14,13 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR" ]
},
"dependencies": {
"System.Net.NameResolution": "4.0.0-rc2-24027"
"System.Net.NameResolution": "4.0.0"
}
},
"net451": {
@@ -14,7 +14,7 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"buildOptions": {
"define": [ "CORECLR" ]
},
@@ -51,7 +51,7 @@
}
},
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": ["CORECLR"]
@@ -15,7 +15,7 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR" ],
@@ -9,6 +9,7 @@ using System.Net;
using System.Security;
using SafeString=System.String;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using Microsoft.PowerShell;
@@ -286,7 +287,7 @@ namespace System.Management.Automation
{
if (unmanagedPtr != IntPtr.Zero)
{
ClrFacade.ZeroFreeCoTaskMemUnicode(unmanagedPtr);
Marshal.ZeroFreeCoTaskMemUnicode(unmanagedPtr);
}
}
#else
@@ -179,7 +179,7 @@ namespace System.Management.Automation
{
if (p != IntPtr.Zero)
{
ClrFacade.ZeroFreeCoTaskMemUnicode(p);
Marshal.ZeroFreeCoTaskMemUnicode(p);
}
}
@@ -379,7 +379,7 @@ namespace System.Management.Automation.Remoting.Client
{
if (cred.password != IntPtr.Zero)
{
ClrFacade.ZeroFreeCoTaskMemUnicode(cred.password);
Marshal.ZeroFreeCoTaskMemUnicode(cred.password);
cred.password = IntPtr.Zero;
}
+31 -31
View File
@@ -23,7 +23,7 @@
},
"frameworks": {
"netstandard1.5": {
"netstandard1.6": {
"imports": [ "dnxcore50" ],
"buildOptions": {
"define": [ "CORECLR", "PORTABLE" ],
@@ -131,36 +131,36 @@
"Microsoft.PowerShell.CoreCLR.AssemblyLoadContext": "1.0.0-*",
"Microsoft.PowerShell.CoreCLR.Eventing": "1.0.0-*",
"Microsoft.CSharp": "4.0.1-rc2-24027",
"Microsoft.Win32.Registry.AccessControl": "4.0.0-rc2-24027",
"System.Collections.Specialized": "4.0.1-rc2-24027",
"System.Collections.NonGeneric": "4.0.1-rc2-24027",
"System.ComponentModel.EventBasedAsync": "4.0.11-rc2-24027",
"System.ComponentModel.TypeConverter": "4.0.1-rc2-24027",
"System.Data.Common": "4.0.1-rc2-24027",
"System.Diagnostics.Contracts": "4.0.1-rc2-24027",
"System.Diagnostics.FileVersionInfo": "4.0.0-rc2-24027",
"System.Diagnostics.Process": "4.1.0-rc2-24027",
"System.Diagnostics.StackTrace": "4.0.1-rc2-24027",
"System.Diagnostics.TraceSource": "4.0.0-rc2-24027",
"System.Dynamic.Runtime": "4.0.11-rc2-24027",
"System.IO.FileSystem.AccessControl": "4.0.0-rc2-24027",
"System.IO.FileSystem.DriveInfo": "4.0.0-rc2-24027",
"System.IO.FileSystem.Watcher": "4.0.0-rc2-24027",
"System.IO.Pipes": "4.0.0-rc2-24027",
"System.Linq.Expressions": "4.0.11-rc2-24027",
"System.Net.Http": "4.0.1-rc2-24027",
"System.Net.NetworkInformation": "4.1.0-rc2-24027",
"System.Reflection.Emit": "4.0.1-rc2-24027",
"System.Reflection.Emit.Lightweight": "4.0.1-rc2-24027",
"System.Security.AccessControl": "4.0.0-rc2-24027",
"System.Security.Cryptography.Algorithms": "4.1.0-rc2-24027",
"System.Security.Cryptography.X509Certificates": "4.1.0-rc2-24027",
"System.Threading.Thread": "4.0.0-rc2-24027",
"System.Threading.Tasks.Parallel": "4.0.1-rc2-24027",
"System.Xml.XPath.XmlDocument": "4.0.1-rc2-24027",
"System.Xml.XmlDocument": "4.0.1-rc2-24027",
"System.Xml.XmlSerializer": "4.0.11-rc2-24027"
"Microsoft.CSharp": "4.0.1",
"Microsoft.Win32.Registry.AccessControl": "4.0.0",
"System.Collections.Specialized": "4.0.1",
"System.Collections.NonGeneric": "4.0.1",
"System.ComponentModel.EventBasedAsync": "4.0.11",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Data.Common": "4.1.0",
"System.Diagnostics.Contracts": "4.0.1",
"System.Diagnostics.FileVersionInfo": "4.0.0",
"System.Diagnostics.Process": "4.1.0",
"System.Diagnostics.StackTrace": "4.0.1",
"System.Diagnostics.TraceSource": "4.0.0",
"System.Dynamic.Runtime": "4.0.11",
"System.IO.FileSystem.AccessControl": "4.0.0",
"System.IO.FileSystem.DriveInfo": "4.0.0",
"System.IO.FileSystem.Watcher": "4.0.0",
"System.IO.Pipes": "4.0.0",
"System.Linq.Expressions": "4.1.0",
"System.Net.Http": "4.1.0",
"System.Net.NetworkInformation": "4.1.0",
"System.Reflection.Emit": "4.0.1",
"System.Reflection.Emit.Lightweight": "4.0.1",
"System.Security.AccessControl": "4.0.0",
"System.Security.Cryptography.Algorithms": "4.2.0",
"System.Security.Cryptography.X509Certificates": "4.1.0",
"System.Threading.Thread": "4.0.0",
"System.Threading.Tasks.Parallel": "4.0.1",
"System.Xml.XPath.XmlDocument": "4.0.1",
"System.Xml.XmlDocument": "4.0.1",
"System.Xml.XmlSerializer": "4.0.11"
}
},
"net451": {
@@ -94,7 +94,7 @@ namespace Microsoft.PowerShell
}
finally
{
ClrFacade.ZeroFreeCoTaskMemUnicode(ptr);
Marshal.ZeroFreeCoTaskMemUnicode(ptr);
}
}
@@ -148,7 +148,7 @@ namespace System.Management.Automation
{
if (unmanagedMemory != IntPtr.Zero)
{
ZeroFreeCoTaskMemUnicode(unmanagedMemory);
Marshal.ZeroFreeCoTaskMemUnicode(unmanagedMemory);
}
}
return passwordInClearText;
@@ -213,19 +213,6 @@ namespace System.Management.Automation
#endif
}
/// <summary>
/// Needed to pair with the SecureStringToCoTaskMemUnicode method which is member of
/// 'SecureStringMarshal' on CORE CLR, and member of 'Marshal' on Full CLR.
/// </summary>
internal static void ZeroFreeCoTaskMemUnicode(IntPtr unmanagedStr)
{
#if CORECLR
SecureStringMarshal.ZeroFreeCoTaskMemUnicode(unmanagedStr);
#else
Marshal.ZeroFreeCoTaskMemUnicode(unmanagedStr);
#endif
}
/// <summary>
/// Facade for SecureStringToCoTaskMemUnicode
/// </summary>
@@ -1023,7 +1023,7 @@ namespace System.Management.Automation.Internal
{
data[i] = Marshal.ReadByte(ptr, i);
}
ClrFacade.ZeroFreeCoTaskMemUnicode(ptr);
Marshal.ZeroFreeCoTaskMemUnicode(ptr);
try
{
@@ -1,353 +0,0 @@
//
// System.Security.SecureString class
//
// Authors
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Security {
public sealed class SecureString : IDisposable
{
private const int BlockSize = 16;
private const int MaxSize = 65536;
private int length;
private bool disposed;
private bool read_only;
private byte[] data;
static SecureString()
{
// ProtectedMemory has been moved to System.Security.dll
// we use reflection to call it (if available) or we'll
// throw an exception
}
public SecureString()
{
Alloc(BlockSize >> 1, false);
}
public unsafe SecureString(char* value, int length)
{
if (value == null)
throw new ArgumentNullException("value");
if ((length < 0) || (length > MaxSize))
throw new ArgumentOutOfRangeException("length", "< 0 || > 65536");
this.length = length; // real length
Alloc(length, false);
int n = 0;
for (int i = 0; i < length; i++)
{
char c = *value++;
data[n++] = (byte)c;
data[n++] = (byte)(c >> 8);
}
Encrypt();
}
// properties
public int Length
{
get
{
if (disposed)
throw new ObjectDisposedException("SecureString");
return length;
}
}
public void AppendChar(char c)
{
if (disposed)
throw new ObjectDisposedException("SecureString");
if (read_only)
{
throw new InvalidOperationException("SecureString is read-only.");
}
if (length == MaxSize)
throw new ArgumentOutOfRangeException("length", "> 65536");
try
{
Decrypt();
int n = length * 2;
Alloc(++length, true);
data[n++] = (byte)c;
data[n++] = (byte)(c >> 8);
}
finally
{
Encrypt();
}
}
public void Clear()
{
if (disposed)
throw new ObjectDisposedException("SecureString");
if (read_only)
{
throw new InvalidOperationException("SecureString is read-only.");
}
Array.Clear(data, 0, data.Length);
length = 0;
}
public SecureString Copy()
{
SecureString ss = new SecureString();
ss.data = (byte[])data.Clone();
ss.length = length;
return ss;
}
public void Dispose()
{
disposed = true;
// don't call clear because we could be either in read-only
// or already disposed - but DO CLEAR the data
if (data != null)
{
Array.Clear(data, 0, data.Length);
data = null;
}
length = 0;
}
public void InsertAt(int index, char c)
{
if (disposed)
throw new ObjectDisposedException("SecureString");
if (read_only)
{
throw new InvalidOperationException("SecureString is read-only.");
}
if ((index < 0) || (index > length))
throw new ArgumentOutOfRangeException("index", "< 0 || > length");
// insert increments length
if (length >= MaxSize)
{
string msg = $"Maximum string size is '{MaxSize}'.";
throw new ArgumentOutOfRangeException("index", msg);
}
try
{
Decrypt();
Alloc(++length, true);
int n = index * 2;
Buffer.BlockCopy(data, n, data, n + 2, data.Length - n - 2);
data[n++] = (byte)c;
data[n] = (byte)(c >> 8);
}
finally
{
Encrypt();
}
}
public bool IsReadOnly()
{
if (disposed)
throw new ObjectDisposedException("SecureString");
return read_only;
}
public void MakeReadOnly()
{
read_only = true;
}
public void RemoveAt(int index)
{
if (disposed)
throw new ObjectDisposedException("SecureString");
if (read_only)
{
throw new InvalidOperationException("SecureString is read-only.");
}
if ((index < 0) || (index >= length))
throw new ArgumentOutOfRangeException("index", "< 0 || > length");
try
{
Decrypt();
Buffer.BlockCopy(data, index * 2 + 2, data, index * 2, data.Length - index * 2 - 2);
Alloc(--length, true);
}
finally
{
Encrypt();
}
}
public void SetAt(int index, char c)
{
if (disposed)
throw new ObjectDisposedException("SecureString");
if (read_only)
{
throw new InvalidOperationException("SecureString is read-only.");
}
if ((index < 0) || (index >= length))
throw new ArgumentOutOfRangeException("index", "< 0 || > length");
try
{
Decrypt();
int n = index * 2;
data[n++] = (byte)c;
data[n] = (byte)(c >> 8);
}
finally
{
Encrypt();
}
}
// internal/private stuff
// [MethodImplAttribute(MethodImplOptions.InternalCall)]
// extern static void EncryptInternal (byte [] data, object scope);
// [MethodImplAttribute(MethodImplOptions.InternalCall)]
// extern static void DecryptInternal (byte [] data, object scope);
// static readonly object scope = Enum.Parse (
// Assembly.Load (Consts.AssemblySystem_Security)
// .GetType ("System.Security.Cryptography.MemoryProtectionScope"), "SameProcess");
// Note that ProtectedMemory is not supported on non-Windows environment right now.
private void Encrypt()
{
if ((data != null) && (data.Length > 0))
{
// It somehow causes nunit test breakage
// EncryptInternal (data, scope);
}
}
// Note that ProtectedMemory is not supported on non-Windows environment right now.
private void Decrypt()
{
if ((data != null) && (data.Length > 0))
{
// It somehow causes nunit test breakage
// DecryptInternal (data, scope);
}
}
// note: realloc only work for bigger buffers. Clear will
// reset buffers to default (and small) size.
private void Alloc(int length, bool realloc)
{
if ((length < 0) || (length > MaxSize))
throw new ArgumentOutOfRangeException("length", "< 0 || > 65536");
// (size / blocksize) + 1 * blocksize
// where size = length * 2 (unicode) and blocksize == 16 (ProtectedMemory)
// length * 2 (unicode) / 16 (blocksize)
int size = (length >> 3) + (((length & 0x7) == 0) ? 0 : 1) << 4;
// is re-allocation necessary ? (i.e. grow or shrink
// but do not re-allocate the same amount of memory)
if (realloc && (data != null) && (size == data.Length))
return;
if (realloc)
{
// copy, then clear
byte[] newdata = new byte[size];
Array.Copy(data, 0, newdata, 0, Math.Min(data.Length, newdata.Length));
Array.Clear(data, 0, data.Length);
data = newdata;
}
else
{
data = new byte[size];
}
}
// dangerous method (put a LinkDemand on it)
internal byte[] GetBuffer()
{
byte[] secret = new byte[length << 1];
try
{
Decrypt();
Buffer.BlockCopy(data, 0, secret, 0, secret.Length);
}
finally
{
Encrypt();
}
// NOTE: CALLER IS RESPONSIBLE TO ZEROIZE THE DATA
return secret;
}
internal IntPtr ToPtr()
{
var ptr = Marshal.AllocHGlobal((this.Length+1) *2 );
for (var i = 0; i < this.Length * 2; i++)
{
Marshal.WriteByte(ptr,i, this.data[i]);
}
Marshal.WriteByte(ptr,this.Length*2, 0);
Marshal.WriteByte(ptr,this.Length*2+1, 0);
return ptr;
}
}
public static class SecureStringMarshal
{
public static IntPtr SecureStringToCoTaskMemUnicode(SecureString s)
{
if (s == null)
{
throw new ArgumentNullException("s");
}
return s.ToPtr();
}
public static void ZeroFreeCoTaskMemUnicode(IntPtr s)
{
Marshal.ZeroFreeCoTaskMemUnicode(s);
}
}
}
Binary file not shown.
@@ -1,22 +0,0 @@
{
"name": "System.Security.SecureString",
"version": "4.0.0-*",
"description": "SecureString Stub borrowed from Mono",
"buildOptions": {
"keyFile": "key.snk",
"delaySign": true,
"publicSign": false,
"warningsAsErrors": true,
"allowUnsafe": true
},
"frameworks": {
"netstandard1.5": {
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
},
"imports": [ "dnxcore50" ]
}
}
}
+5 -5
View File
@@ -128,19 +128,19 @@ Usage: TypeCatalogGen.exe <{0}> <{1}>
switch (hashAlgorithm)
{
case AssemblyHashAlgorithm.Sha1:
hashImpl = HashAlgorithm.Create("SHA1");
hashImpl = SHA1.Create();
break;
case AssemblyHashAlgorithm.MD5:
hashImpl = HashAlgorithm.Create("MD5");
hashImpl = MD5.Create();
break;
case AssemblyHashAlgorithm.Sha256:
hashImpl = HashAlgorithm.Create("SHA256");
hashImpl = SHA256.Create();
break;
case AssemblyHashAlgorithm.Sha384:
hashImpl = HashAlgorithm.Create("SHA384");
hashImpl = SHA384.Create();
break;
case AssemblyHashAlgorithm.Sha512:
hashImpl = HashAlgorithm.Create("SHA512");
hashImpl = SHA512.Create();
break;
default:
throw new NotSupportedException();
-10
View File
@@ -1,10 +0,0 @@
. mono-snapshot mono
export DOTNET_REFERENCE_ASSEMBLIES_PATH=$MONO_PREFIX/lib/mono/xbuild-frameworks/
pushd ../TypeCatalogParser
dotnet restore -v Warning
dotnet run
popd
dotnet restore -v Warning
dotnet run ../Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs powershell.inc
+15 -10
View File
@@ -7,18 +7,23 @@
"emitEntryPoint": true
},
"dependencies": {
"System.Reflection.Metadata": "1.1.0",
"System.Collections.Immutable": "1.1.37"
},
"frameworks": {
"net45": {
"frameworkAssemblies": {
"System.Runtime": "",
"System.IO": "",
"System.Reflection.Primitives": ""
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": "1.0.0",
"System.Reflection.Metadata": "1.3.0",
"System.Collections.Immutable": "1.2.0"
}
}
},
"runtimes": {
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
"win7-x64": { },
"win81-x64": { },
"win10-x64": { },
"osx.10.11-x64": { }
}
}
+10 -2
View File
@@ -13,6 +13,14 @@ namespace TypeCatalogParser
{
public static void Main(string[] args)
{
// These are packages that are not part of .NET Core and must be excluded
string[] excludedPackages = {
"Microsoft.Management.Infrastructure",
"Microsoft.Management.Infrastructure.Native"
// We need to exclude Newtonsoft.Json once the ALC story is figured out
// "Newtonsoft.Json"
};
// The TypeCatalogGen project takes this as input
var outputPath = "../TypeCatalogGen/powershell.inc";
@@ -21,9 +29,9 @@ namespace TypeCatalogParser
System.IO.File.WriteAllLines(outputPath,
// Get the target for the current runtime
from t in context.LockFile.Targets where t.RuntimeIdentifier == Constants.RuntimeIdentifier
from t in context.LockFile.Targets where t.RuntimeIdentifier == context.RuntimeIdentifier
// Get the packages (not projects)
from x in t.Libraries where x.Type == "package"
from x in t.Libraries where (x.Type == "package" && !excludedPackages.Contains(x.Name))
// Get the real reference assemblies
from y in x.CompileTimeAssemblies where y.Path.EndsWith(".dll")
// Construct the path to the assemblies
+4 -3
View File
@@ -5,8 +5,9 @@
},
"dependencies": {
"Microsoft.DotNet.ProjectModel": "1.0.0-rc2-002665",
"Microsoft.DotNet.Cli.Utils": "1.0.0-rc2-002665"
"Microsoft.NETCore.App": "1.0.0",
"Microsoft.DotNet.ProjectModel": "1.0.0-rc3-003121",
"Microsoft.DotNet.Cli.Utils": "1.0.0-preview2-003121"
},
"frameworks": {
@@ -17,7 +18,7 @@
"runtimes": {
"ubuntu.14.04-x64": { },
"centos.7.1-x64": { },
"centos.7-x64": { },
"win7-x64": { },
"win10-x64": { },
"osx.10.10-x64": { },
+1 -1
View File
@@ -42,7 +42,7 @@
"define": [ "CORECLR" ]
},
"dependencies": {
"Microsoft.NETCore.App": "1.0.0-rc2-3002526"
"Microsoft.NETCore.App": "1.0.0"
}
}
},
+2 -2
View File
@@ -16,14 +16,14 @@
"netcoreapp1.0": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"Microsoft.NETCore.App": "1.0.0-rc2-3002485"
"Microsoft.NETCore.App": "1.0.0"
}
}
},
"runtimes": {
"ubuntu.14.04-x64": { },
"centos.7.1-x64": { },
"centos.7-x64": { },
"win7-x64": { },
"win10-x64": { },
"osx.10.10-x64": { },
+1 -1
View File
@@ -19,7 +19,7 @@
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-192208-24"
"dotnet-test-xunit": "1.0.0-rc2-build10025"
}
}
},