Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -0,0 +1,15 @@
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace Microsoft.Win32
{
static class NativeMethods
{
[MethodImplAttribute (MethodImplOptions.InternalCall)]
public static extern int GetCurrentProcessId ();
}
}

View File

@@ -122,11 +122,11 @@ namespace System {
throw new FormatException ("Could not find any parsable digits.");
}
var res = (uint) fromBase * result + (uint) digitValue;
if (res < result || res > max_value)
long res = fromBase * result + digitValue;
if (res > max_value)
throw new OverflowException ();
result = res;
result = (uint)res;
chars++;
++i;
}

View File

@@ -41,14 +41,78 @@ using System.Runtime.Serialization;
namespace System
{
// Contains information about the type which is expensive to compute
[StructLayout (LayoutKind.Sequential)]
internal class MonoTypeInfo {
// this is the displayed form: special characters
// ,+*&*[]\ in the identifier portions of the names
// have been escaped with a leading backslash (\)
public string full_name;
public MonoCMethod default_ctor;
}
[StructLayout (LayoutKind.Sequential)]
partial class RuntimeType
{
[NonSerialized]
MonoTypeInfo type_info;
internal Object GenericCache;
internal virtual MonoCMethod GetDefaultConstructor ()
internal RuntimeType (Object obj)
{
// TODO: Requires MonoType
throw new NotSupportedException ();
throw new NotImplementedException ();
}
internal MonoCMethod GetDefaultConstructor ()
{
MonoCMethod ctor = null;
if (type_info == null)
type_info = new MonoTypeInfo ();
else
ctor = type_info.default_ctor;
if (ctor == null) {
var ctors = GetConstructors (BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
for (int i = 0; i < ctors.Length; ++i) {
if (ctors [i].GetParametersCount () == 0) {
type_info.default_ctor = ctor = (MonoCMethod) ctors [i];
break;
}
}
}
return ctor;
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern MethodInfo GetCorrespondingInflatedMethod (MethodInfo generic);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern ConstructorInfo GetCorrespondingInflatedConstructor (ConstructorInfo generic);
internal override MethodInfo GetMethod (MethodInfo fromNoninstanciated)
{
if (fromNoninstanciated == null)
throw new ArgumentNullException ("fromNoninstanciated");
return GetCorrespondingInflatedMethod (fromNoninstanciated);
}
internal override ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
{
if (fromNoninstanciated == null)
throw new ArgumentNullException ("fromNoninstanciated");
return GetCorrespondingInflatedConstructor (fromNoninstanciated);
}
internal override FieldInfo GetField (FieldInfo fromNoninstanciated)
{
/* create sensible flags from given FieldInfo */
BindingFlags flags = fromNoninstanciated.IsStatic ? BindingFlags.Static : BindingFlags.Instance;
flags |= fromNoninstanciated.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic;
return GetField (fromNoninstanciated.Name, flags);
}
string GetDefaultMemberName ()
@@ -586,12 +650,6 @@ namespace System
get;
}
public override string FullName {
get {
throw new NotImplementedException ();
}
}
public extern override string Name {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
get;
@@ -602,6 +660,12 @@ namespace System
get;
}
#if MOBILE
static int get_core_clr_security_level ()
{
return 1;
}
#else
//seclevel { transparent = 0, safe-critical = 1, critical = 2}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern int get_core_clr_security_level ();
@@ -616,6 +680,34 @@ namespace System
public override bool IsSecuritySafeCritical {
get { return get_core_clr_security_level () == 1; }
}
}
#endif
public override int GetHashCode()
{
Type t = UnderlyingSystemType;
if (t != null && t != this)
return t.GetHashCode ();
return (int)_impl.Value;
}
public override string FullName {
get {
string fullName;
// This doesn't need locking
if (type_info == null)
type_info = new MonoTypeInfo ();
if ((fullName = type_info.full_name) == null)
fullName = type_info.full_name = getFullName (true, false);
return fullName;
}
}
internal override bool IsUserType {
get {
return false;
}
}
}
}

View File

@@ -1,16 +1,72 @@
using System.IO;
namespace Microsoft.Win32
{
static class Win32Native
{
internal const string ADVAPI32 = "advapi32.dll";
// Error codes from WinError.h
internal const int ERROR_SUCCESS = 0x0;
internal const int ERROR_INVALID_FUNCTION = 0x1;
internal const int ERROR_FILE_NOT_FOUND = 0x2;
internal const int ERROR_PATH_NOT_FOUND = 0x3;
internal const int ERROR_ACCESS_DENIED = 0x5;
internal const int ERROR_INVALID_HANDLE = 0x6;
internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8;
internal const int ERROR_INVALID_DATA = 0xd;
internal const int ERROR_INVALID_DRIVE = 0xf;
internal const int ERROR_NO_MORE_FILES = 0x12;
internal const int ERROR_NOT_READY = 0x15;
internal const int ERROR_BAD_LENGTH = 0x18;
internal const int ERROR_SHARING_VIOLATION = 0x20;
internal const int ERROR_NOT_SUPPORTED = 0x32;
internal const int ERROR_FILE_EXISTS = 0x50;
internal const int ERROR_INVALID_PARAMETER = 0x57;
internal const int ERROR_BROKEN_PIPE = 0x6D;
internal const int ERROR_CALL_NOT_IMPLEMENTED = 0x78;
internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
internal const int ERROR_INVALID_NAME = 0x7B;
internal const int ERROR_BAD_PATHNAME = 0xA1;
internal const int ERROR_ALREADY_EXISTS = 0xB7;
internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB;
internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE; // filename too long.
internal const int ERROR_NO_DATA = 0xE8;
internal const int ERROR_PIPE_NOT_CONNECTED = 0xE9;
internal const int ERROR_MORE_DATA = 0xEA;
internal const int ERROR_DIRECTORY = 0x10B;
internal const int ERROR_OPERATION_ABORTED = 0x3E3; // 995; For IO Cancellation
internal const int ERROR_NOT_FOUND = 0x490; // 1168; For IO Cancellation
internal const int ERROR_NO_TOKEN = 0x3f0;
internal const int ERROR_DLL_INIT_FAILED = 0x45A;
internal const int ERROR_NON_ACCOUNT_SID = 0x4E9;
internal const int ERROR_NOT_ALL_ASSIGNED = 0x514;
internal const int ERROR_UNKNOWN_REVISION = 0x519;
internal const int ERROR_INVALID_OWNER = 0x51B;
internal const int ERROR_INVALID_PRIMARY_GROUP = 0x51C;
internal const int ERROR_NO_SUCH_PRIVILEGE = 0x521;
internal const int ERROR_PRIVILEGE_NOT_HELD = 0x522;
internal const int ERROR_NONE_MAPPED = 0x534;
internal const int ERROR_INVALID_ACL = 0x538;
internal const int ERROR_INVALID_SID = 0x539;
internal const int ERROR_INVALID_SECURITY_DESCR = 0x53A;
internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542;
internal const int ERROR_CANT_OPEN_ANONYMOUS = 0x543;
internal const int ERROR_NO_SECURITY_ON_OBJECT = 0x546;
internal const int ERROR_TRUSTED_RELATIONSHIP_FAILURE = 0x6FD;
internal const FileAttributes FILE_ATTRIBUTE_DIRECTORY = FileAttributes.Directory;
public static string GetMessage (int hr)
{
return "Error " + hr;
}
public static int MakeHRFromErrorCode (int errorCode)
{
return unchecked(((int)0x80070000) | errorCode);
}
public class SECURITY_ATTRIBUTES
{