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
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