473,785 Members | 2,221 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Registry access

Hi,

My C# app uses the registry for storing DB params, but under Windows XP
SP2, a normal user cannot write to this key (a .NET exception is thrown
when the app is run, but only under this OS).
My question is, can a certain area of the registry get accessed by
normal users. The key I am currently using is:

SYSTEM\CurrentC ontrolSet\Servi ces\

Any help on this would be appreciated. I have already suggested that the
customer enable this key for access by the normal user, but that has not
been accepted :|

Regards,

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
6 1718
hi,

can you post some code to write values int the regestry.
I'm intrested in this, i would like my program to startup when windows is
started

thanks Maarten

"Steven Blair" <st**********@b tinternet.com> schreef in bericht
news:uQ******** ******@TK2MSFTN GP15.phx.gbl...
Hi,

My C# app uses the registry for storing DB params, but under Windows XP
SP2, a normal user cannot write to this key (a .NET exception is thrown
when the app is run, but only under this OS).
My question is, can a certain area of the registry get accessed by
normal users. The key I am currently using is:

SYSTEM\CurrentC ontrolSet\Servi ces\

Any help on this would be appreciated. I have already suggested that the
customer enable this key for access by the normal user, but that has not
been accepted :|

Regards,

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2
Hi,

You want to see my registry code?

If so, here it is:

private static string REGISTRY_PATH =
@"SYSTEM\Curren tControlSet\Ser vices\MyKey";

RegistryKey hklm = Registry.LocalM achine;
RegistryKey MyKey;

MyKey= hklm.OpenSubKey (REGISTRY_PATH, true);

MyKey.SetValue( "DBName",m_DBNa me);

MyKey.Close();

Regards,

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4
Thanks
I'll try it out

regards Maarten

"Steven Blair" <st**********@b tinternet.com> schreef in bericht
news:eJ******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

You want to see my registry code?

If so, here it is:

private static string REGISTRY_PATH =
@"SYSTEM\Curren tControlSet\Ser vices\MyKey";

RegistryKey hklm = Registry.LocalM achine;
RegistryKey MyKey;

MyKey= hklm.OpenSubKey (REGISTRY_PATH, true);

MyKey.SetValue( "DBName",m_DBNa me);

MyKey.Close();

Regards,

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #5
In Windows 2000 and XP certain keys can only be written to if your code is
running with Administrator privileges. For example, HKEY_LOCAL_MACH INE. The
HKEY_CURRENT_US ER key, however does not require Administrator privileges. You
may want to change your code to write your software preferences to something
like:
HKEY_CURRENT_US ER\Software\<Co mpanyName>\<Pro duct>Settings

One thing to be aware of, keys written to the HKEY_CURRENT_US ER key are
bound to a user, so if one user logs in, runs your software that writes
settings to this key, logs out, and then another user logs in, those settings
are tied to the other user and will not be there for the new user. This may
be desirable depending on your situation.

My rule of thumb is, write static software settings that will not change
after your software has been installed in
HKEY_LOCAL_MACH INE\Software\<C ompany Name>\<Product> \Settings
Typically, an Admin will be installing the software and thus, your software
will be running with Admin privileges and your software will be able to write
to this key.

Write user preferences in
HKEY_CURRENT_US ER\Software\<Co mpany Name>\<Product> \Settings

Anything else, write in a config file.

It’s considered bad to make your users run your software all the time as
Admin since this fails the security rule of running with the least privileges
as possible.

Hope this helps.
Regards
"Steven Blair" wrote:
Hi,

My C# app uses the registry for storing DB params, but under Windows XP
SP2, a normal user cannot write to this key (a .NET exception is thrown
when the app is run, but only under this OS).
My question is, can a certain area of the registry get accessed by
normal users. The key I am currently using is:

SYSTEM\CurrentC ontrolSet\Servi ces\

Any help on this would be appreciated. I have already suggested that the
customer enable this key for access by the normal user, but that has not
been accepted :|

Regards,

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #6
In addition to what dlgproc said, your should only ever write in the
SOFTWARE folders, never in SYSTEM.

"Steven Blair" <st**********@b tinternet.com> wrote in message
news:uQ******** ******@TK2MSFTN GP15.phx.gbl...
Hi,

My C# app uses the registry for storing DB params, but under Windows XP
SP2, a normal user cannot write to this key (a .NET exception is thrown
when the app is run, but only under this OS).
My question is, can a certain area of the registry get accessed by
normal users. The key I am currently using is:

SYSTEM\CurrentC ontrolSet\Servi ces\

Any help on this would be appreciated. I have already suggested that the
customer enable this key for access by the normal user, but that has not
been accepted :|

Regards,

Steven

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #7

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

Similar topics

2
436
by: Tim Blizard | last post by:
I know this topic has been discussed before but I couldn't find any thread more recent than about 18 months and was interested in what conclusions people had come to recently. Invariably 3 advantages of XML config files are promoted; 1. The .NET framework provides built-in support for reading application configuration data from .config files very easily 2. Using these files makes it possible to deploy an application using
0
354
by: vincemoon | last post by:
Below is an excerpt from my Registry Log, created by Redmon, showing the process whereby TweakUI added the compressed folder option to the new sub-menu in the right click context menu for open folders and desktop. I hope someone can help me to better understand what this log excerpt means, or point me to info sources that do a good job of explaining how to interpret exactly what the various phrases, words, and numbers in the log mean.
21
10835
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
1533
by: techmaccoy | last post by:
I am trying to access a entry under HKEY_Current_USER/Software. In My code it List seven subkeys under there. Actually there are lot more and the entry i wanted to access in seen in the Registry, but not listed in my code. I checked under the HKEY_USERS Key there are many users listed. and each have a Software entry. The list i get through my ASPCode belongs to one of the user. But the entry i a m seeking is under a different User.
1
1741
by: Yoshitha | last post by:
Hi I am developing web application through which i've to write and read the values from the registry. When i set impersonate property to "false" it is displaying exception " Requested Registry Access is not allowed" so then i changed impersonate to "true" and it is reading values from the registry and writing into the registry. but when i runing the same aplication in same system now am getting the exception "requested registry access...
8
5492
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(""))
0
12067
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry key 'Temporary (volatile) Jet DSN for process
1
6571
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);
1
3145
by: UK1967 | last post by:
I wrote a ASP.NET application (Windows 2003 Enterprise Server, IIS, .NET Framework 1.1). This application use the Windows (AD) account and impersonation. Some functions in this application contact, read and change the remote registry (HKLM/Software/...) of some internal server. After installing SP1 on the web server (IIS) all functions with registry access don't run and generate the following error: "Requested registry access is not...
3
8324
by: JB | last post by:
I am trying to access a registry key on computer like so: key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, computerName).OpenSubKey(Subkey); There are two keys I am trying to read, 1 works, and the other gives me the "Requested registry access is not allowed." i've narrowed it down to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office It doesnt let me access that path, but the permissions are the same.
0
9647
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
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10162
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...
1
10100
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6744
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
5396
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...
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.