src/Microsoft/Windows/ComponentObjectModel/Shell/_Library/ShellExtensionManager.cs
/// <summary>
/// Tests, if shell extensions needs to be approved by an administrator.
/// </summary>
/// <remarks>
/// <seealso href="https://docs.microsoft.com/en-us/windows/win32/shell/reg-shell-exts#registering-shell-extension-handlers-1">Registering Shell Extension Handlers - Microsoft Docs</seealso>
/// </remarks>
/// <returns>true, if approval is configured. Otherwise, false.</returns>
Tests, if shell extensions needs to be approved by an administrator.
Tests if shell extensions needs to be approved by an administrator .
public bool NeedsApproval() {
            using( IRegistryKey hiveKey = _registry.OpenBaseKey( RegistryHive.CurrentUser, RegistryView.Default ) ) {
                using( IRegistryKey explorerKey = hiveKey.OpenSubKey( @"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" ) ) {
                    if( null == explorerKey ) {
                        return false;
                    }
                    string value = explorerKey.GetString( "EnforceShellExtensionSecurity" );
                    if( null == value ) {
                        return false;
                    }
                    int v = int.Parse( value );
                    if( v == 0 ) {
                        return false;
                    }
                }
            }
            return true;
        }
public bool NeedsApproval ( ) { using ( IRegistryKey hiveKey = _registry . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Default ) ) { using ( IRegistryKey explorerKey = hiveKey . OpenSubKey ( @"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" ) ) { if ( null == explorerKey ) { return false ; } string value = explorerKey . GetString ( " " ) ; if ( null == value ) { return false ; } int v = int . Parse ( value ) ; if ( v == 0 ) { return false ; } } } return true ; }
Tests, if shell extensions needs to be approved by an administrator.
Tests if shell extensions needs to be approved by an administrator .
// Check, if Admin limited usage of shell extensions to approved extensions only.See also
true, if approval is configured. Otherwise, false.
true if approval is configured . Otherwise false .
remarks
Registering Shell Extension Handlers - Microsoft Docs
Registering Shell Extension Handlers - Microsoft Docs