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,137 @@
//------------------------------------------------------------------------------
// <copyright file="ConfigPathUtility.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Configuration {
#if CONFIGPATHUTILITY_SYSTEMWEB
using Debug=System.Web.Util.Debug;
#endif
internal static class ConfigPathUtility {
private const char SeparatorChar = '/';
//
// A configPath is valid if
// * It does not start or end with a '/'
// * It is not null or empty, except in the case of the root configuration record
// * It does not contain '\'
// * It does not contain a path component equal to "." or ".."
//
// The checks for '\', ".", and ".." are not strictly necessary, but their presence
// could lead to problems for configuration hosts.
//
static internal bool IsValid(string configPath) {
if (String.IsNullOrEmpty(configPath)) {
return false;
}
int start = -1;
for (int examine = 0; examine <= configPath.Length; examine++) {
char ch;
if (examine < configPath.Length) {
ch = configPath[examine];
}
else {
ch = SeparatorChar;
}
// backslash disallowed
if (ch == '\\') {
return false;
}
if (ch == SeparatorChar) {
// double slash disallowed
// note this check also purposefully catches starting and ending slash
if (examine == start + 1) {
return false;
}
// "." disallowed
if (examine == start + 2 && configPath[start + 1] == '.') {
return false;
}
// ".." disallowed
if (examine == start + 3 && configPath[start + 1] == '.' && configPath[start + 2] == '.') {
return false;
}
start = examine;
}
}
return true;
}
#if !CONFIGPATHUTILITY_SYSTEMWEB
static internal string Combine(string parentConfigPath, string childConfigPath) {
Debug.Assert(String.IsNullOrEmpty(parentConfigPath) || IsValid(parentConfigPath), "String.IsNullOrEmpty(parentConfigPath) || IsValid(parentConfigPath)");
Debug.Assert(String.IsNullOrEmpty(childConfigPath) || IsValid(childConfigPath), "String.IsNullOrEmpty(childConfigPath) || IsValid(childConfigPath)");
if (String.IsNullOrEmpty(parentConfigPath)) {
return childConfigPath;
}
if (String.IsNullOrEmpty(childConfigPath)) {
return parentConfigPath;
}
return parentConfigPath + "/" + childConfigPath;
}
static internal string[] GetParts(string configPath) {
Debug.Assert(IsValid(configPath), "IsValid(configPath)");
string[] parts = configPath.Split(SeparatorChar);
return parts;
}
//
// Return the last part of a config path, e.g.
// GetName("MACHINE/WEBROOT/Default Web Site/app") == "app"
//
static internal string GetName(string configPath) {
Debug.Assert(String.IsNullOrEmpty(configPath) || IsValid(configPath), "String.IsNullOrEmpty(configPath) || IsValid(configPath)");
if (String.IsNullOrEmpty(configPath)) {
return configPath;
}
int index = configPath.LastIndexOf('/');
if (index == -1) {
return configPath;
}
Debug.Assert(index != configPath.Length - 1);
return configPath.Substring(index + 1);
}
#endif
// Avoid unused code warning in System.Configuration by including functions in assembly-specific #defines
#if CONFIGPATHUTILITY_SYSTEMWEB
static internal string GetParent(string configPath) {
Debug.Assert(String.IsNullOrEmpty(configPath) || IsValid(configPath), "String.IsNullOrEmpty(configPath) || IsValid(configPath)");
if (String.IsNullOrEmpty(configPath)) {
return null;
}
string parentConfigPath;
int lastSlash = configPath.LastIndexOf(SeparatorChar);
if (lastSlash == -1) {
parentConfigPath = null;
}
else {
parentConfigPath = configPath.Substring(0, lastSlash);
}
return parentConfigPath;
}
#endif
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <copyright file="PrivilegedConfigurationManager.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Configuration {
using System.Collections.Specialized;
using System.Security;
using System.Security.Permissions;
[ConfigurationPermission(SecurityAction.Assert, Unrestricted=true)]
internal static class PrivilegedConfigurationManager {
internal static ConnectionStringSettingsCollection ConnectionStrings {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
get {
return ConfigurationManager.ConnectionStrings;
}
}
internal static object GetSection(string sectionName) {
return ConfigurationManager.GetSection(sectionName);
}
}
}

View File

@@ -0,0 +1,85 @@
//------------------------------------------------------------------------------
// <copyright file="ExternDll.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System {
internal static class ExternDll {
#if FEATURE_PAL && !SILVERLIGHT
#if !PLATFORM_UNIX
internal const String DLLPREFIX = "";
internal const String DLLSUFFIX = ".dll";
#else // !PLATFORM_UNIX
#if __APPLE__
internal const String DLLPREFIX = "lib";
internal const String DLLSUFFIX = ".dylib";
#elif _AIX
internal const String DLLPREFIX = "lib";
internal const String DLLSUFFIX = ".a";
#elif __hppa__ || IA64
internal const String DLLPREFIX = "lib";
internal const String DLLSUFFIX = ".sl";
#else
internal const String DLLPREFIX = "lib";
internal const String DLLSUFFIX = ".so";
#endif
#endif // !PLATFORM_UNIX
public const string Kernel32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX;
public const string User32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX;
public const string Mscoree = DLLPREFIX + "sscoree" + DLLSUFFIX;
#elif FEATURE_PAL && SILVERLIGHT
public const string Kernel32 = "coreclr";
public const string User32 = "coreclr";
#else
public const string Activeds = "activeds.dll";
public const string Advapi32 = "advapi32.dll";
public const string Comctl32 = "comctl32.dll";
public const string Comdlg32 = "comdlg32.dll";
public const string Gdi32 = "gdi32.dll";
public const string Gdiplus = "gdiplus.dll";
public const string Hhctrl = "hhctrl.ocx";
public const string Imm32 = "imm32.dll";
public const string Kernel32 = "kernel32.dll";
public const string Loadperf = "Loadperf.dll";
public const string Mscoree = "mscoree.dll";
public const string Clr = "clr.dll";
public const string Msi = "msi.dll";
public const string Mqrt = "mqrt.dll";
public const string Ntdll = "ntdll.dll";
public const string Ole32 = "ole32.dll";
public const string Oleacc = "oleacc.dll";
public const string Oleaut32 = "oleaut32.dll";
public const string Olepro32 = "olepro32.dll";
public const string PerfCounter = "perfcounter.dll";
public const string Powrprof = "Powrprof.dll";
public const string Psapi = "psapi.dll";
public const string Shell32 = "shell32.dll";
public const string User32 = "user32.dll";
public const string Uxtheme = "uxtheme.dll";
public const string WinMM = "winmm.dll";
public const string Winspool = "winspool.drv";
public const string Wtsapi32 = "wtsapi32.dll";
public const string Version = "version.dll";
public const string Vsassert = "vsassert.dll";
public const string Fxassert = "Fxassert.dll";
public const string Shlwapi = "shlwapi.dll";
public const string Crypt32 = "crypt32.dll";
// system.data specific
internal const string Odbc32 = "odbc32.dll";
internal const string SNI = "System.Data.dll";
// system.data.oracleclient specific
internal const string OciDll = "oci.dll";
internal const string OraMtsDll = "oramts.dll";
#endif //!FEATURE_PAL
}
}

View File

@@ -0,0 +1,105 @@
//------------------------------------------------------------------------------
// <copyright file="HResults.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
/*
These HRESULTs are used for mapping managed exceptions to COM error codes
and vice versa through COM Interop. For background on COM error codes see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/error_9td2.asp.
FACILITY_URT is defined as 0x13 (0x8013xxxx). The facility range is reserved
for the .NET Framework SDK teams.
Within that range, the following subranges have been allocated for different
feature areas:
0x10yy for Execution Engine
0x11yy for Metadata, TypeLib Export, and CLDB
0x12yy for MetaData Validator
0x13yy for Debugger and Profiler errors
0x14yy for Security
0x15yy for BCL
0x1600 - 0x161F for Reflection
0x1620 - 0x163F for System.IO
0x1640 - 0x165F for Security
0x1660 - 0x16FF for BCL
0x17yy for shim
0x18yy for IL Verifier
0x19yy for .NET Framework
0x1Ayy for .NET Framework
0x1Byy for MetaData Validator
0x30yy for VSA errors
CLR HRESULTs are defined in corerror.h. If you make any modifications to
the range allocations described above, please make sure the corerror.h file
gets updated.
*/
namespace System {
using System;
internal static class HResults{
internal const int Configuration = unchecked((int)0x80131902);
// Xml
internal const int Xml = unchecked((int)0x80131940);
internal const int XmlSchema = unchecked((int)0x80131941);
internal const int XmlXslt = unchecked((int)0x80131942);
internal const int XmlXPath = unchecked((int)0x80131943);
// DataSet
internal const int Data = unchecked((int)0x80131920);
internal const int DataDeletedRowInaccessible = unchecked((int)0x80131921);
internal const int DataDuplicateName = unchecked((int)0x80131922);
internal const int DataInRowChangingEvent = unchecked((int)0x80131923);
internal const int DataInvalidConstraint = unchecked((int)0x80131924);
internal const int DataMissingPrimaryKey = unchecked((int)0x80131925);
internal const int DataNoNullAllowed = unchecked((int)0x80131926);
internal const int DataReadOnly = unchecked((int)0x80131927);
internal const int DataRowNotInTable = unchecked((int)0x80131928);
internal const int DataVersionNotFound = unchecked((int)0x80131929);
internal const int DataConstraint = unchecked((int)0x8013192A);
internal const int StrongTyping = unchecked((int)0x8013192B);
// Managed Providers
internal const int SqlType = unchecked((int)0x80131930);
internal const int SqlNullValue = unchecked((int)0x80131931);
internal const int SqlTruncate = unchecked((int)0x80131932);
internal const int AdapterMapping = unchecked((int)0x80131933);
internal const int DataAdapter = unchecked((int)0x80131934);
internal const int DBConcurrency = unchecked((int)0x80131935);
internal const int OperationAborted = unchecked((int)0x80131936);
internal const int InvalidUdt = unchecked((int)0x80131937);
internal const int Metadata = unchecked((int)0x80131939);
internal const int InvalidQuery = unchecked((int)0x8013193A);
internal const int CommandCompilation = unchecked((int)0x8013193B);
internal const int CommandExecution = unchecked((int)0x8013193C);
internal const int SqlException = unchecked((int)0x80131904); // System.Data.SqlClient.SqlClientException
internal const int OdbcException = unchecked((int)0x80131937); // System.Data.Odbc.OdbcException
internal const int OracleException = unchecked((int)0x80131938); // System.Data.OracleClient.OracleException
internal const int ConnectionPlanException = unchecked((int)0x8013193d); // System.Data.SqlClient.ConnectionPlanException
// Configuration encryption
internal const int NteBadKeySet = unchecked((int)0x80090016);
// Win32
internal const int Win32AccessDenied = unchecked((int)0x80070005);
internal const int Win32InvalidHandle = unchecked((int)0x80070006);
#if !FEATURE_PAL
internal const int License = unchecked((int)0x80131901);
internal const int InternalBufferOverflow = unchecked((int)0x80131905);
internal const int ServiceControllerTimeout = unchecked((int)0x80131906);
internal const int Install = unchecked((int)0x80131907);
// Win32
internal const int EFail = unchecked((int)0x80004005);
#endif
}
}