Search code examples
.netcommentsclr.net-4.8

What does 'has a SUC' mean?


I was reading some .NET Code and I found the following in DispatcherSynchronizationContext

/// 
///     Wait for a set of handles.
/// 
///  
///     Critical - Calls WaitForMultipleObjectsEx which has a SUC.
///  
[SecurityCritical] 
[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.ControlPolicy|SecurityPermissionFlag.ControlEvidence)]
public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) 
{
    if(_dispatcher._disableProcessingCount > 0)
    {
        // Call into native code directly in order to avoid the default 
        // CLR locking behavior which pumps messages under contention.
        // Even though they try to pump only the COM messages, any 
        // messages that have been SENT to the window are also 
        // dispatched.  This can lead to unpredictable reentrancy.
        return MS.Win32.UnsafeNativeMethods.WaitForMultipleObjectsEx(waitHandles.Length, waitHandles, waitAll, millisecondsTimeout, false); 
    }
    else
    {
        return SynchronizationContext.WaitHelper(waitHandles, waitAll, millisecondsTimeout); 
    }
} 

What does "has a SUC" mean?


Solution

  • It appears to stand for the SuppressUnmanagedCodeSecurity attribute. See the source code for WaitForMultipleObjectsEx

    ///<SecurityNote>
    /// Critical as this code performs an elevation.
    ///</SecurityNote>
    [SecurityCritical]
    [SuppressUnmanagedCodeSecurity]
    [DllImport(ExternDll.Kernel32, EntryPoint="WaitForMultipleObjectsEx", SetLastError = true, CharSet = CharSet.Auto)]
    private static extern int IntWaitForMultipleObjectsEx(int nCount, IntPtr[] pHandles, bool bWaitAll, int dwMilliseconds, bool bAlertable);