473,804 Members | 3,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

registry permissions

I am trying to write a program to switch off serial port enumerations
via the associated registry key. My code is:

RegistryPermiss ion permission = new
RegistryPermiss ion(RegistryPer missionAccess.W rite,
"HKEY_LOCAL_MAC HINE\\SYSTEM\\C urrentControlSe t\\Enum\\ACPI\\ PNP0501");
permission.Dema nd();
RegistryKey key =
Registry.LocalM achine.OpenSubK ey("SYSTEM\\Cur rentControlSet\ \Enum\\ACPI\\PN P0501",
true);
But the last line throws a Security Exception saying "Requested
security access is not allowed". What am I doing wrong?

Colin
Jun 3 '07 #1
4 3283

"Colin Priest" <co**********@n o.spam.comwrote in message
news:d2******** *************** *********@4ax.c om...
>I am trying to write a program to switch off serial port enumerations
via the associated registry key. My code is:

RegistryPermiss ion permission = new
RegistryPermiss ion(RegistryPer missionAccess.W rite,
"HKEY_LOCAL_MAC HINE\\SYSTEM\\C urrentControlSe t\\Enum\\ACPI\\ PNP0501");
permission.Dema nd();
RegistryKey key =
Registry.LocalM achine.OpenSubK ey("SYSTEM\\Cur rentControlSet\ \Enum\\ACPI\\PN P0501",
true);
But the last line throws a Security Exception saying "Requested
security access is not allowed". What am I doing wrong?
Does the user account that this program is running under have the
permissions to change the registry node?

Jun 3 '07 #2
Colin,

There are two things I can think of. First, the user account you are
running this under doesn't have the appropriate rights to access the
registry key. The second is that you are running the application from a
network share, or from the internet, and as a result, .NET is sandboxing the
application so that it doesn't do any harm.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Colin Priest" <co**********@n o.spam.comwrote in message
news:d2******** *************** *********@4ax.c om...
>I am trying to write a program to switch off serial port enumerations
via the associated registry key. My code is:

RegistryPermiss ion permission = new
RegistryPermiss ion(RegistryPer missionAccess.W rite,
"HKEY_LOCAL_MAC HINE\\SYSTEM\\C urrentControlSe t\\Enum\\ACPI\\ PNP0501");
permission.Dema nd();
RegistryKey key =
Registry.LocalM achine.OpenSubK ey("SYSTEM\\Cur rentControlSet\ \Enum\\ACPI\\PN P0501",
true);
But the last line throws a Security Exception saying "Requested
security access is not allowed". What am I doing wrong?

Colin
Jun 3 '07 #3
"Colin Priest" <co**********@n o.spam.comwrote in message
news:d2******** *************** *********@4ax.c om...
>I am trying to write a program to switch off serial port enumerations
via the associated registry key. My code is:

RegistryPermiss ion permission = new
RegistryPermiss ion(RegistryPer missionAccess.W rite,
"HKEY_LOCAL_MAC HINE\\SYSTEM\\C urrentControlSe t\\Enum\\ACPI\\ PNP0501");
permission.Dema nd();
RegistryKey key =
Registry.LocalM achine.OpenSubK ey("SYSTEM\\Cur rentControlSet\ \Enum\\ACPI\\PN P0501",
true);
But the last line throws a Security Exception saying "Requested
security access is not allowed". What am I doing wrong?

Colin


You don't have the right to open this key for write access, regular users,
including administrators, can only open this key for reading. This whole
registry tree is owned by the OS device manager, what exactly are you trying
to achieve?

Willy.

Jun 3 '07 #4
On Sun, 3 Jun 2007 19:32:38 +0200, "Willy Denoyette [MVP]"
<wi************ *@telenet.bewro te:
>"Colin Priest" <co**********@n o.spam.comwrote in message
news:d2******* *************** **********@4ax. com...
>>I am trying to write a program to switch off serial port enumerations
via the associated registry key. My code is:

RegistryPermiss ion permission = new
RegistryPermis sion(RegistryPe rmissionAccess. Write,
"HKEY_LOCAL_MA CHINE\\SYSTEM\\ CurrentControlS et\\Enum\\ACPI\ \PNP0501");
permission.Dema nd();
RegistryKey key =
Registry.Local Machine.OpenSub Key("SYSTEM\\Cu rrentControlSet \\Enum\\ACPI\\P NP0501",
true);
But the last line throws a Security Exception saying "Requested
security access is not allowed". What am I doing wrong?

Colin

You don't have the right to open this key for write access, regular users,
including administrators, can only open this key for reading. This whole
registry tree is owned by the OS device manager, what exactly are you trying
to achieve?

Willy.

Thank Willy. As I said above, I am trying to set the registry keys to
stop enumeration of serial devices. I need to do this to stop Windows
incorrectly recognising my serial device as a mouse etc.

The user account full administrator access. What else do I need?

Jun 4 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
7697
by: DJP | last post by:
Hi there I need to be able to programmatically set permissions on registry keys using VB / VBScript / VBA. So far I have had a look at doing this using the WScript.Shell object, API calls, and WMI but the only one of these that goes any where near registry permissions is WMI and that is only to get the permissions of a key (cannot set). I am also quite happy for the code to call an external program to perform the task but can't seem to...
1
3073
by: Daniel Passwater via DotNetMonster.com | last post by:
I'm working on a app that displays according to a registry key value. The user needs the ability to update the display, and hense the registry key (via a click event on a popup menu). This all worked just fine until some users were set up as power-users. I've tried to change the permissions on that key programatically, on the fly, but to no avail. Here's my question: While the user is logged in with limited permissions, will the...
21
10838
by: Kevin Swanson | last post by:
I'm attempting some remote registry manipulation via C#. I've written a test app to simply grab a specified key from a specified hive on a specified machine. The call to OpenSubKey is throwing System.SecurityException. Also of note: Sitting at my local box, I can open regedit and connect to the remote registry. I see three hives: _CLASSES_ROOT, _LOCAL_MACHINE, and _USERS. I can open all but HKEY_LOCAL_MACHINE. When I try to expand that...
3
3269
by: Dmitriy Kolesnik | last post by:
Hello all! I have problem with reading data from registry. I work on the one machine. My operation system is Windows XP SP2. I read data from registry with help OpenSubKey and SecurityException appeares for key HKEY_CURRENT_USER\Software\Microsoft\Protected Storage System provider\S-1-5-21-2025815041-1961764723-2087665911-3808. I saw permissions in this key - permissions for SYSTEM exist only. How I can read this key
1
2100
by: Kevin Burton | last post by:
I am using aspnet_setreg but the permissions that it sets the registry to leave the application unable to access the information. I want to add the ASPNET account on the machine that our application is being installed on with read privilege automatically. Does anyone know of a way to easily set registry permissions? I would prefer to use .NET (C#) but I can always wrap any code that does this. I am suspecting that this will involve C++ or...
8
5497
by: Al Kaufman | last post by:
I have a simple console app that uses: regSubKey = <some registry key> Dim reg As RegistryKey = Registry.ClassesRoot.OpenSubKey(regSubKey) Dim path As String path = CStr(reg.GetValue(""))
4
9118
by: Kevin L | last post by:
I store some application settings in the registry under HKEY_LOCAL_MACHINE\Software\MyApplication I want to allow full access to this key and subkeys. Currently, I manually change the permissions on the keys. How can I accomplish this through code?
1
6573
by: PiotrKolodziej | last post by:
Hi Here is the code: this.regPath = @"Software\FileManager\" ; System.Security.Permissions.RegistryPermission permissions = new System.Security.Permissions.RegistryPermission(System.Security.Permissions.RegistryPermissionAccess.AllAccess, @"HKEY_LOCAL_MACHINE\" + regPath);
3
2287
by: Sreppohcdoow | last post by:
I have a simple tool that I create that stores some settings in the Registry... however, if the user running it doesn't have Admin priveleges on the machine, the app fails when trying to write to the registry. I know there are applications out there that can read/write to the registry w/o Admin priveleges... is there some way to code around this in C#.NET? I.e., to have the program run the registry code in a different security context...
0
4009
by: tmsprowl | last post by:
Greetings! I was wondering if someone could help me with a problem I'm having. My department is just one of many within my organization. My organization has control over the network domain, but my department has a couple of web servers of our own that are part of my organization's domain. I am trying to read LDAP information on my organization's domain controller from a web application on one of my department's servers. I have been...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.