Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ internal static partial class Interop
{
internal static partial class GlobalizationInterop
{
[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCase")]
internal unsafe static extern void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseInvariant")]
internal unsafe static extern void ChangeCaseInvariant(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseTurkish")]
internal unsafe static extern void ChangeCaseTurkish(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,41 @@ internal static partial class Interop
{
internal static partial class GlobalizationInterop
{
[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortHandle")]
internal unsafe static extern ResultCode GetSortHandle(byte[] localeName, out SafeSortHandle sortHandle);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CloseSortHandle")]
internal unsafe static extern void CloseSortHandle(IntPtr handle);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareString")]
internal unsafe static extern int CompareString(SafeSortHandle sortHandle, char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len, CompareOptions options);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOf")]
internal unsafe static extern int IndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_LastIndexOf")]
internal unsafe static extern int LastIndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOfOrdinalIgnoreCase")]
internal unsafe static extern int IndexOfOrdinalIgnoreCase(string target, int cwTargetLength, char* pSource, int cwSourceLength, bool findLast);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")]
[return: MarshalAs(UnmanagedType.Bool)]
internal unsafe static extern bool StartsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")]
[return: MarshalAs(UnmanagedType.Bool)]
internal unsafe static extern bool EndsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortKey")]
internal unsafe static extern int GetSortKey(SafeSortHandle sortHandle, string str, int strLength, byte* sortKey, int sortKeyLength, CompareOptions options);

[SecurityCritical]
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareStringOrdinalIgnoreCase")]
internal unsafe static extern int CompareStringOrdinalIgnoreCase(char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len);

[DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetSortVersion")]
internal static extern int GetSortVersion();

[SecurityCritical]
internal class SafeSortHandle : SafeHandle
{
private SafeSortHandle() :
Expand All @@ -66,11 +55,9 @@ private SafeSortHandle() :

public override bool IsInvalid
{
[SecurityCritical]
get { return handle == IntPtr.Zero; }
}

[SecurityCritical]
protected override bool ReleaseHandle()
{
CloseSortHandle(handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Microsoft.Win32.SafeHandles
{
[System.Security.SecurityCritical]
public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
{
/// <summary>A handle value of -1.</summary>
Expand Down Expand Up @@ -83,7 +82,6 @@ internal static SafeFileHandle Open(Func<SafeFileHandle> fdFunc)
return handle;
}

[System.Security.SecurityCritical]
protected override bool ReleaseHandle()
{
// When the SafeFileHandle was opened, we likely issued an flock on the created descriptor in order to add
Expand Down Expand Up @@ -111,7 +109,6 @@ protected override bool ReleaseHandle()

public override bool IsInvalid
{
[System.Security.SecurityCritical]
get
{
long h = (long)handle;
Expand Down
7 changes: 0 additions & 7 deletions src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ internal static int GetTwoDigitYearMax(CalendarId calendarId)
}

// Call native side to figure out which calendars are allowed
[SecuritySafeCritical]
internal static int GetCalendars(string localeName, bool useUserOverride, CalendarId[] calendars)
{
// NOTE: there are no 'user overrides' on Linux
Expand All @@ -87,7 +86,6 @@ private static bool SystemSupportsTaiwaneseCalendar()

// PAL Layer ends here

[SecuritySafeCritical]
private static bool GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, out string calendarString)
{
return Interop.CallStringMethod(
Expand Down Expand Up @@ -239,7 +237,6 @@ private static int CountOccurrences(string input, char value, ref int index)
return index - startIndex;
}

[SecuritySafeCritical]
private static bool EnumMonthNames(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] monthNames)
{
monthNames = null;
Expand All @@ -261,7 +258,6 @@ private static bool EnumMonthNames(string localeName, CalendarId calendarId, Cal
return result;
}

[SecuritySafeCritical]
private static bool EnumEraNames(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] eraNames)
{
bool result = EnumCalendarInfo(localeName, calendarId, dataType, out eraNames);
Expand All @@ -277,7 +273,6 @@ private static bool EnumEraNames(string localeName, CalendarId calendarId, Calen
return result;
}

[SecuritySafeCritical]
internal static bool EnumCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] calendarData)
{
calendarData = null;
Expand All @@ -292,7 +287,6 @@ internal static bool EnumCalendarInfo(string localeName, CalendarId calendarId,
return result;
}

[SecuritySafeCritical]
private static bool EnumCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, CallbackContext callbackContext)
{
GCHandle context = GCHandle.Alloc(callbackContext);
Expand All @@ -306,7 +300,6 @@ private static bool EnumCalendarInfo(string localeName, CalendarId calendarId, C
}
}

[SecuritySafeCritical]
private static void EnumCalendarInfoCallback(string calendarString, IntPtr context)
{
CallbackContext callbackContext = (CallbackContext)((GCHandle)context).Target;
Expand Down
7 changes: 0 additions & 7 deletions src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ internal partial class CultureData
/// This method uses the sRealName field (which is initialized by the constructor before this is called) to
/// initialize the rest of the state of CultureData based on the underlying OS globalization library.
/// </summary>
[SecuritySafeCritical]
private unsafe bool InitCultureData()
{
Debug.Assert(_sRealName != null);
Expand Down Expand Up @@ -87,7 +86,6 @@ private unsafe bool InitCultureData()
return true;
}

[SecuritySafeCritical]
internal static bool GetLocaleName(string localeName, out string windowsName)
{
// Get the locale name from ICU
Expand All @@ -104,7 +102,6 @@ internal static bool GetLocaleName(string localeName, out string windowsName)
return true;
}

[SecuritySafeCritical]
internal static bool GetDefaultLocaleName(out string windowsName)
{
// Get the default (system) locale name from ICU
Expand All @@ -129,7 +126,6 @@ private string GetLocaleInfo(LocaleStringData type)

// For LOCALE_SPARENT we need the option of using the "real" name (forcing neutral names) instead of the
// "windows" name, which can be specific for downlevel (< windows 7) os's.
[SecuritySafeCritical]
private string GetLocaleInfo(string localeName, LocaleStringData type)
{
Debug.Assert(localeName != null, "[CultureData.GetLocaleInfo] Expected localeName to be not be null");
Expand All @@ -155,7 +151,6 @@ private string GetLocaleInfo(string localeName, LocaleStringData type)
return StringBuilderCache.GetStringAndRelease(sb);
}

[SecuritySafeCritical]
private int GetLocaleInfo(LocaleNumberData type)
{
Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo(LocaleNumberData)] Expected _sWindowsName to be populated already");
Expand All @@ -179,7 +174,6 @@ private int GetLocaleInfo(LocaleNumberData type)
return value;
}

[SecuritySafeCritical]
private int[] GetLocaleInfo(LocaleGroupingData type)
{
Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo(LocaleGroupingData)] Expected _sWindowsName to be populated already");
Expand All @@ -205,7 +199,6 @@ private string GetTimeFormatString()
return GetTimeFormatString(false);
}

[SecuritySafeCritical]
private string GetTimeFormatString(bool shortFormat)
{
Debug.Assert(_sWindowsName != null, "[CultureData.GetTimeFormatString(bool shortFormat)] Expected _sWindowsName to be populated already");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ public Object Clone()

public String AMDesignator
{
// auto-generated
get
{
if (this.amDesignator == null)
Expand Down Expand Up @@ -1031,7 +1030,6 @@ public String MonthDayPattern

public String PMDesignator
{
// auto-generated
get
{
if (this.pmDesignator == null)
Expand Down
2 changes: 0 additions & 2 deletions src/mscorlib/corefx/System/Globalization/RegionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public RegionInfo(String name)
SetName(name);
}

[System.Security.SecuritySafeCritical] // auto-generated
public RegionInfo(int culture)
{
if (culture == CultureInfo.LOCALE_INVARIANT) //The InvariantCulture has no matching region
Expand Down Expand Up @@ -132,7 +131,6 @@ private void SetName(string name)
[OnSerializing]
private void OnSerializing(StreamingContext ctx) { }

[System.Security.SecurityCritical] // auto-generated
[OnDeserialized]
private void OnDeserialized(StreamingContext ctx)
{
Expand Down
2 changes: 0 additions & 2 deletions src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ private void FinishInitialization(string textInfoName)
{
}

[SecuritySafeCritical]
private unsafe string ChangeCase(string s, bool toUpper)
{
Debug.Assert(s != null);
Expand Down Expand Up @@ -78,7 +77,6 @@ private unsafe string ChangeCase(string s, bool toUpper)
return result;
}

[SecuritySafeCritical]
private unsafe char ChangeCase(char c, bool toUpper)
{
char dst = default(char);
Expand Down
1 change: 0 additions & 1 deletion src/mscorlib/src/Microsoft/Win32/Registry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace Microsoft.Win32 {
* @security(checkClassLinking=on)
*/
//This class contains only static members and does not need to be serializable.
[ComVisible(true)]
internal static class Registry {
static Registry()
{
Expand Down
3 changes: 0 additions & 3 deletions src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ namespace Microsoft.Win32
* @security(checkDllCalls=off)
* @security(checkClassLinking=on)
*/
[ComVisible(true)]
internal sealed class RegistryKey : MarshalByRefObject, IDisposable
{

Expand Down Expand Up @@ -512,7 +511,6 @@ public Object GetValue(String name, Object defaultValue) {
return InternalGetValue(name, defaultValue, false, true);
}

[ComVisible(false)]
public Object GetValue(String name, Object defaultValue, RegistryValueOptions options) {
if( options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames) {
throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options), nameof(options));
Expand Down Expand Up @@ -765,7 +763,6 @@ public void SetValue(String name, Object value) {
SetValue(name, value, RegistryValueKind.Unknown);
}

[ComVisible(false)]
public unsafe void SetValue(String name, Object value, RegistryValueKind valueKind) {
if (value==null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
Expand Down
2 changes: 0 additions & 2 deletions src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


namespace Microsoft.Win32 {
[System.Runtime.InteropServices.ComVisible(true)]
internal enum RegistryValueKind {
String = Win32Native.REG_SZ,
ExpandString = Win32Native.REG_EXPAND_SZ,
Expand All @@ -13,7 +12,6 @@ internal enum RegistryValueKind {
MultiString = Win32Native.REG_MULTI_SZ,
QWord = Win32Native.REG_QWORD,
Unknown = 0, // REG_NONE is defined as zero but BCL
[System.Runtime.InteropServices.ComVisible(false)]
None = unchecked((int)0xFFFFFFFF), // mistakingly overrode this value.
} // Now instead of using Win32Native.REG_NONE we use "-1" and play games internally.
}
Expand Down
7 changes: 0 additions & 7 deletions src/mscorlib/src/System/AppDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ namespace System
using System.Diagnostics.Contracts;
using System.Runtime.ExceptionServices;

[ComVisible(true)]
public class ResolveEventArgs : EventArgs
{
private String _Name;
Expand Down Expand Up @@ -70,7 +69,6 @@ public ResolveEventArgs(String name, Assembly requestingAssembly)
}
}

[ComVisible(true)]
public class AssemblyLoadEventArgs : EventArgs
{
private Assembly _LoadedAssembly;
Expand All @@ -88,15 +86,12 @@ public AssemblyLoadEventArgs(Assembly loadedAssembly)
}

[Serializable]
[ComVisible(true)]
public delegate Assembly ResolveEventHandler(Object sender, ResolveEventArgs args);

[Serializable]
[ComVisible(true)]
public delegate void AssemblyLoadEventHandler(Object sender, AssemblyLoadEventArgs args);

[Serializable]
[ComVisible(true)]
internal delegate void AppDomainInitializer(string[] args);

internal class AppDomainInitializerInfo
Expand Down Expand Up @@ -187,7 +182,6 @@ internal sealed class AppDomain
#pragma warning disable 169
private Object[] _Policies; // Called from the VM.
#pragma warning restore 169
[method: System.Security.SecurityCritical]
public event AssemblyLoadEventHandler AssemblyLoad;

private ResolveEventHandler _TypeResolve;
Expand Down Expand Up @@ -254,7 +248,6 @@ public event ResolveEventHandler AssemblyResolve
}

#if FEATURE_REFLECTION_ONLY_LOAD
[method: System.Security.SecurityCritical]
public event ResolveEventHandler ReflectionOnlyAssemblyResolve;
#endif // FEATURE_REFLECTION_ONLY

Expand Down
1 change: 0 additions & 1 deletion src/mscorlib/src/System/AppDomainAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace System {

[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
internal enum LoaderOptimization
{
NotSpecified = 0,
Expand Down
1 change: 0 additions & 1 deletion src/mscorlib/src/System/AppDomainManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace System
using System.Security;
using System.Runtime.InteropServices;

[System.Runtime.InteropServices.ComVisible(true)]
internal class AppDomainManager : MarshalByRefObject
{
public AppDomainManager () {}
Expand Down
2 changes: 0 additions & 2 deletions src/mscorlib/src/System/AppDomainSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ namespace System
using System.Collections.Generic;

[Serializable]
[ClassInterface(ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComVisible(true)]
internal sealed class AppDomainSetup
{
[Serializable]
Expand Down
1 change: 0 additions & 1 deletion src/mscorlib/src/System/AppDomainUnloadedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace System {

using System.Runtime.Serialization;

[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
internal class AppDomainUnloadedException : SystemException {
public AppDomainUnloadedException()
Expand Down
Loading