Changing the registry permissions

  • Thread starter Thread starter Daniel Passwater via DotNetMonster.com
  • Start date Start date
D

Daniel Passwater via DotNetMonster.com

I have an app(banner) that displays different text according to a registry
key. It is updatable by the user via a popup menu. It works fine as long as
the user has administrator privileges, but a power-user lacks privileges to
update the registry.

Can the app change the registry permissions while being run by a power-user?
I tried:
try
{
RegistryPermission regPerm = new RegistryPermission(
RegistryPermissionAccess.AllAccess,
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\IEDirtyFlags");

regPerm.AddPathList(
RegistryPermissionAccess.Create & RegistryPermissionAccess.Read,
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\IEDirtyFlags");

regPerm.AddPathList(RegistryPermissionAccess.Write ,
@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\IEDirtyFlags");

// Open registry key.
RegistryKey rk = Registry.LocalMachine;
RegistryKey subKey = rk.OpenSubKey
(@"SOFTWARE\Microsoft\Cryptography\IEDirtyFlags\",true);

// Update key value.
subKey.SetValue("dirtiest", Convert.ToString(updateInt));

// Close access to registry.
rk.Close();
}
catch(System.Exception e)
{
MessageBox.Show("The user is not authorized to update: " + e);
}

Thanks for the help in advance.
Daniel
 
I'm confused. There is no concept of "Admin" or "Power User" or any user
role for that matter under CE.

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
 
Back
Top