Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Dénier l’accès au registre

Modifier,ou,créer,une,source,d'événement
{filelink=15690}

using System;
using Microsoft.Win32;
using System.Security.Permissions;
 
class RegistreRefuserAcces
{
  static void Main(string[] args)
  {
      RegistryPermission regPermission = new RegistryPermission(RegistryPermissionAccess.AllAccess,@"HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersion");
      regPermission.Deny();
 
      RegistryKey myRegKey=Registry.LocalMachine;
      myRegKey=myRegKey.OpenSubKey (@"SOFTWAREMicrosoftWindowsNTCurrentVersion");
 
      Object oValue = myRegKey.GetValue("PathName");
      Console.WriteLine("SE Pathname: {0}", oValue.ToString());
  }
}

No comments yet.

Leave a Comment