Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@@ -6,7 +6,7 @@
//
// File: RegistryOptions.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>JFREE</OWNER>
//
// Implements Microsoft.Win32.RegistryOptions
//
@@ -27,4 +27,4 @@ namespace Microsoft.Win32 {
/// BackupRestore = Win32Native.REG_OPTION_BACKUP_RESTORE,// 0x0004
};
}
#endif // !FEATURE_PAL
#endif // !FEATURE_PAL

View File

@@ -6,7 +6,7 @@
//
// File: RegistryOptions.cs
//
// <OWNER>[....]</OWNER>
// <OWNER>JFREE</OWNER>
//
// Implements Microsoft.Win32.RegistryView
//
@@ -21,4 +21,4 @@ namespace Microsoft.Win32 {
Registry32 = Win32Native.KEY_WOW64_32KEY, // 0x0200 operate on the 32-bit registry view
};
}
#endif // !FEATURE_PAL
#endif // !FEATURE_PAL

View File

@@ -305,6 +305,18 @@ namespace Microsoft.Win32 {
return CreateSubKeyInternal(subkey, permissionCheck, null, options);
}
[ComVisible(false)]
public RegistryKey CreateSubKey(String subkey, bool writable)
{
return CreateSubKeyInternal(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, null, RegistryOptions.None);
}
[ComVisible(false)]
public RegistryKey CreateSubKey(String subkey, bool writable, RegistryOptions options)
{
return CreateSubKeyInternal(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, null, options);
}
#if FEATURE_MACL
[ComVisible(false)]
@@ -755,6 +767,13 @@ namespace Microsoft.Win32 {
return InternalOpenSubKey(name, permissionCheck, GetRegistryKeyAccess(permissionCheck));
}
[System.Security.SecuritySafeCritical]
[ComVisible(false)]
public RegistryKey OpenSubKey(String name, RegistryRights rights)
{
return InternalOpenSubKey(name, this.checkMode, (int)rights);
}
[System.Security.SecuritySafeCritical] // auto-generated
[ComVisible(false)]
[ResourceExposure(ResourceScope.Machine)]
@@ -795,8 +814,8 @@ namespace Microsoft.Win32 {
return null;
}
#endif
#endif
// This required no security checks. This is to get around the Deleting SubKeys which only require
// write permission. They call OpenSubKey which required read. Now instead call this function w/o security checks
[System.Security.SecurityCritical] // auto-generated
@@ -830,6 +849,9 @@ namespace Microsoft.Win32 {
*/
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
#if FEATURE_CORECLR
[System.Security.SecurityCritical]
#endif
public RegistryKey OpenSubKey(String name) {
return OpenSubKey(name, false);
}

View File

@@ -31,6 +31,11 @@ namespace Microsoft.Win32.SafeHandles {
SetHandle(preexistingHandle);
}
#if MOBILE
override protected bool ReleaseHandle() {
return true;
}
#else
[System.Security.SecurityCritical]
override protected bool ReleaseHandle() {
return (RegCloseKey(handle) == Win32Native.ERROR_SUCCESS);
@@ -41,6 +46,7 @@ namespace Microsoft.Win32.SafeHandles {
ResourceExposure(ResourceScope.None),
ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal static extern int RegCloseKey(IntPtr hKey);
#endif
}
}
#endif // !FEATURE_PAL

View File

@@ -29,21 +29,6 @@ namespace Microsoft.Win32.SafeHandles {
[System.Security.SecurityCritical] // auto-generated_required
public sealed class SafeWaitHandle : SafeHandleZeroOrMinusOneIsInvalid
{
// Special case flags for Mutexes enables workaround for known OS bug at
// http://support.microsoft.com/default.aspx?scid=kb;en-us;889318
// One machine-wide mutex serializes all OpenMutex and CloseHandle operations.
// bIsMutex: if true, we need to grab machine-wide mutex before doing any Close ops.
// Initialized to false by the runtime.
private bool bIsMutex;
// bIsMutex: if true, we need to avoid grabbing the machine-wide mutex before Close ops,
// since that mutex is, of course, this very handle.
// Initialized to false by the runtime.
private bool bIsReservedMutex;
// Called by P/Invoke marshaler
private SafeWaitHandle() : base(true)
{
@@ -63,42 +48,9 @@ namespace Microsoft.Win32.SafeHandles {
#if MONO
NativeEventCalls.CloseEvent_internal (handle);
return true;
#else
#if !FEATURE_CORECLR
if (!bIsMutex || Environment.HasShutdownStarted)
return Win32Native.CloseHandle(handle);
bool bReturn = false;
bool bMutexObtained = false;
try
{
if (!bIsReservedMutex)
{
Mutex.AcquireReservedMutex(ref bMutexObtained);
}
bReturn = Win32Native.CloseHandle(handle);
}
finally
{
if (bMutexObtained)
Mutex.ReleaseReservedMutex();
}
return bReturn;
#else
return Win32Native.CloseHandle(handle);
#endif
#endif
}
internal void SetAsMutex()
{
bIsMutex = true;
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal void SetAsReservedMutex()
{
bIsReservedMutex = true;
}
}
}

View File

@@ -94,6 +94,8 @@ namespace Microsoft.Win32 {
internal const int ERROR_NOT_ENOUGH_MEMORY = 8;
internal const int ERROR_MORE_DATA = 0xEA;
internal const int ERROR_NOT_SUPPORTED = 50;
internal const int ERROR_INVALID_PARAMETER = 0x57;
//
// ETW Methods
@@ -167,10 +169,32 @@ namespace Microsoft.Win32 {
public int Type;
};
/// <summary>
/// Call the ETW native API EventWriteTransfer and checks for invalid argument error.
/// The implementation of EventWriteTransfer on some older OSes (Windows 2008) does not accept null relatedActivityId.
/// So, for these cases we will retry the call with an empty Guid.
/// </summary>
internal static int EventWriteTransferWrapper(long registrationHandle,
ref EventDescriptor eventDescriptor,
Guid* activityId,
Guid* relatedActivityId,
int userDataCount,
EventProvider.EventData* userData)
{
int HResult = EventWriteTransfer(registrationHandle, ref eventDescriptor, activityId, relatedActivityId, userDataCount, userData);
if (HResult == ERROR_INVALID_PARAMETER && relatedActivityId == null)
{
Guid emptyGuid = Guid.Empty;
HResult = EventWriteTransfer(registrationHandle, ref eventDescriptor, activityId, &emptyGuid, userDataCount, userData);
}
return HResult;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteTransfer", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks
internal static extern int EventWriteTransfer(
private static extern int EventWriteTransfer(
[In] long registrationHandle,
[In] ref EventDescriptor eventDescriptor,
[In] Guid* activityId,
@@ -193,7 +217,23 @@ namespace Microsoft.Win32 {
[SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks
internal static extern int EventActivityIdControl([In] ActivityControl ControlCode, [In][Out] ref Guid ActivityId);
// Support for EnumerateTraceGuidsEx
internal enum EVENT_INFO_CLASS
{
BinaryTrackInfo,
SetEnableAllKeywords,
SetTraits,
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventSetInformation", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks
internal static extern int EventSetInformation(
[In] long registrationHandle,
[In] EVENT_INFO_CLASS informationClass,
[In] void* eventInformation,
[In] int informationLength);
// Support for EnumerateTraceGuidsEx
internal enum TRACE_QUERY_INFO_CLASS
{
TraceGuidQueryList,
@@ -241,7 +281,7 @@ namespace Microsoft.Win32 {
ref int ReturnLength);
}
#if !FEATURE_PAL && !FEATURE_CORECLR
#if FEATURE_COMINTEROP
[SecurityCritical]
[DllImport("combase.dll", PreserveSig = true)]
internal static extern int RoGetActivationFactory(

View File

@@ -1 +1 @@
4a257e119ae905e5fb449f7709050e0aa08969be
9c2df18a2daf5d191612169f1bcc5d0cb9f10b82