473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Reading from registry

Hi,
Is possible to read from HKEY_LOCAL_MACHINE whithout beeing loged in as
administrator or power user?
Have tried using the following code, but if loged in as User there is a
security matter.

Dim regKey As RegistryKey = Registry.LocalMachine
Dim strCheckTime As String
regKey = regKey.CreateSubKey(SubKeyOPCProgid)
strCheckTime = regKey.GetValue("CheckTime", strCheckTime)
If it's not possible to read from LocalMachine withourt beeing loged in as
Administrator or power user, where is the right place to store app settings
available to all users ?

Tnx
Totto
Nov 20 '05 #1
6 1191
Yes, you cannot mitigate Win32 security.

OHM

Totto wrote:
Hi,
Is possible to read from HKEY_LOCAL_MACHINE whithout beeing loged in
as administrator or power user?
Have tried using the following code, but if loged in as User there is
a security matter.

Dim regKey As RegistryKey = Registry.LocalMachine
Dim strCheckTime As String
regKey = regKey.CreateSubKey(SubKeyOPCProgid)
strCheckTime = regKey.GetValue("CheckTime", strCheckTime)
If it's not possible to read from LocalMachine withourt beeing loged
in as Administrator or power user, where is the right place to store
app settings available to all users ?

Tnx
Totto


--
Best Regards - OHM
one.handed.man{at}BTInternet{dot}com
Nov 20 '05 #2
* "One Handed Man" <Ch************************@CuzIHateSpam.com> scripsit:
Yes, you cannot mitigate Win32 security.


What exactly does that mean?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Totto,
Note you are attempting to WRITE to the registry, not read it!

The Administrator would need to give each user access to specific keys under
HKEY_LOCAL_MACHINE using regedit.exe to allow them to read & write there. I
believe a setup program could also set the permission (possible with a
custom Installer class). I would recommend having the setup program create
the respective keys and set the respective permissions.

Alternatively you may be able to use
System.Windows.Forms.Application.CommonAppDataPath or
System.Windows.Form.Application.CommonAppDataRegis try to store settings for
your app shared by all users.

Hope this helps
Jay

"Totto" <ta*********@norcon.no> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
Is possible to read from HKEY_LOCAL_MACHINE whithout beeing loged in as
administrator or power user?
Have tried using the following code, but if loged in as User there is a
security matter.

Dim regKey As RegistryKey = Registry.LocalMachine
Dim strCheckTime As String
regKey = regKey.CreateSubKey(SubKeyOPCProgid)
strCheckTime = regKey.GetValue("CheckTime", strCheckTime)
If it's not possible to read from LocalMachine withourt beeing loged in as
Administrator or power user, where is the right place to store app settings available to all users ?

Tnx
Totto

Nov 20 '05 #4
Tanks Jay,
Big help

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> skrev i melding
news:OM*************@tk2msftngp13.phx.gbl...
Totto,
Note you are attempting to WRITE to the registry, not read it!

The Administrator would need to give each user access to specific keys under HKEY_LOCAL_MACHINE using regedit.exe to allow them to read & write there. I believe a setup program could also set the permission (possible with a
custom Installer class). I would recommend having the setup program create
the respective keys and set the respective permissions.

Alternatively you may be able to use
System.Windows.Forms.Application.CommonAppDataPath or
System.Windows.Form.Application.CommonAppDataRegis try to store settings for your app shared by all users.

Hope this helps
Jay

"Totto" <ta*********@norcon.no> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
Is possible to read from HKEY_LOCAL_MACHINE whithout beeing loged in as
administrator or power user?
Have tried using the following code, but if loged in as User there is a
security matter.

Dim regKey As RegistryKey = Registry.LocalMachine
Dim strCheckTime As String
regKey = regKey.CreateSubKey(SubKeyOPCProgid)
strCheckTime = regKey.GetValue("CheckTime", strCheckTime)
If it's not possible to read from LocalMachine withourt beeing loged in as Administrator or power user, where is the right place to store app

settings
available to all users ?

Tnx
Totto


Nov 20 '05 #5
It means that Win32 security will stop him doing this unless he has been
given explicit privilages to do so.

Regards
Herfried K. Wagner [MVP] wrote:
* "One Handed Man" <Ch************************@CuzIHateSpam.com>
scripsit:
Yes, you cannot mitigate Win32 security.


What exactly does that mean?


--
Best Regards - OHM
one.handed.man{at}BTInternet{dot}com
Nov 20 '05 #6
* "One Handed Man" <Ch************************@CuzIHateSpam.com> scripsit:
It means that Win32 security will stop him doing this unless he has been
given explicit privilages to do so.


Thank you for the explanation!

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7

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

Similar topics

1
by: Duncan Allen | last post by:
I'm trying to use aspnet_setreg to encrypt user names & password used in the web.config file for use in the indentity element. When the website runs I get the message 'Error reading the password...
5
by: Dhilip Kumar | last post by:
Hi All, I'm writing a Windows Service app using C#. I need to read some configuration settings before the service starts up. These settings will be used by the service in its operation. ...
6
by: Bry | last post by:
I'm having problems writing (and reading) boolean data to the registry. // Write a boolean value to the registry // I've not included the obvious bits of code in these samples bool myBool =...
1
by: Peter John | last post by:
I am using the following code to read from and write to the registry. The writing works fine but reading always fails. Can anyone suggest what is going wrong? Imports Microsoft.Win32 Public...
11
by: Larry Bird | last post by:
I'm trying to read a registry key using VB.Net. I have posted the code below that I'm using: Dim DBConnect As RegistryKey = Registry.CurrentUser.OpenSubKey _ ("Software\VB and VBA Program...
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
2
by: zoneal | last post by:
my program it's just tools for my little home network.. Only thing I have left to do is reading the registy key to check the path to the shared folder.. this path is always updated so I will...
5
by: UJ | last post by:
I have a system that has five programs that all communicate with each other via Message Queues. Works well. One program is a watchdog that will make sure the others are up and going. Currently I...
3
by: Aussie Rules | last post by:
Hi, I want to store some data in the registry, however I have not been able to do this, and think my logic maybe flawed. Firstly I try to open the registry and read in any existing values....
0
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,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...
0
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...

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.