src/Microsoft/Windows/ComponentObjectModel/Shell/_Library/ShellExtensionManager.cs
/// <summary>
/// Add a shell extension to the list of approved extensions.
/// </summary>
/// <param name="clsid">The clsid of the shell extension.</param>
/// <param name="serverName">The name of the shell extension.</param>
/// <remarks>
/// This call may fail, when invoking process has no administrative privileges or the process is not elevated.
/// </remarks>
Add a shell extension to the list of approved extensions.
Add a shell extension to the list of approved extensions .
public void AddApproval( string clsid, string serverName ) {
            using( IRegistryKey hiveKey = _registry.OpenBaseKey( RegistryHive.LocalMachine, RegistryView.Default ) ) {
                using( IRegistryKey approvedKey = hiveKey.OpenSubKey( @"Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved", true ) ) {
                    approvedKey.SetValue( clsid, serverName, RegistryValueKind.String );
                }
            }
        }
public void AddApproval ( string clsid , string serverName ) { using ( IRegistryKey hiveKey = _registry . OpenBaseKey ( RegistryHive . LocalMachine , RegistryView . Default ) ) { using ( IRegistryKey approvedKey = hiveKey . OpenSubKey ( @"Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" , true ) ) { approvedKey . SetValue ( clsid , serverName , RegistryValueKind . String ) ; } } }
Add a shell extension to the list of approved extensions.
Add a shell extension to the list of approved extensions .
clsid
string
The clsid of the shell extension.
The clsid of the shell extension .
serverName
string
The name of the shell extension.
The name of the shell extension .
remarks
This call may fail, when invoking process has no administrative privileges or the process is not elevated.
This call may fail when invoking process has no administrative privileges or the process is not elevated .