473,804 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

registry HKEY_LOCAL_MACH INE and user rights

Can my program access the HKEY_LOCAL_MACH INE/Software section of the
registry when being used by a user with restricted rights (not with admin
rights)?

If so, how? I have a program that functions just fine when run by an
administrator but generates an exception when run by a restricted user. The
program accesses the HKEY_LOCAL_MACH INE/Software section to set or get
application settings that are not user specific.

Thanks,

Dennis

Nov 16 '05 #1
7 16520
Hi Dennis,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to change the credential to
another user in a winform application. If there is any misunderstandin g,
please feel free to let me know.

As far as I know, there isn't such method available in .net framework.
However, we can achieve that with Win32 SDK Call. LogonUser is such an API
that can do this.

http://msdn.microsoft.com/library/de...us/secauthn/se
curity/logonuser.asp

Here is a good KB article, which contains detailed information about how to
do this with implementation code. HTH

http://support.microsoft.com/?id=306158

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #2
Try using this to build impersonation into your program and then run
it.

http://www.codeproject.com/csharp/cpimpersonation1.asp

It might help to just use the source code already provided to see if
you can access the regex. That way you dont have to modify your own
code if it doesnt work, which i doubt.

:-)
Sushant

"Dennis C. Drumm" <de*******@prim acode.com> wrote in message news:<#C******* *******@TK2MSFT NGP09.phx.gbl>. ..
Can my program access the HKEY_LOCAL_MACH INE/Software section of the
registry when being used by a user with restricted rights (not with admin
rights)?

If so, how? I have a program that functions just fine when run by an
administrator but generates an exception when run by a restricted user. The
program accesses the HKEY_LOCAL_MACH INE/Software section to set or get
application settings that are not user specific.

Thanks,

Dennis

Nov 16 '05 #3
A regular user can only read settings from HKLM, you need to be poweruser or
admin to write values to that part of registry. This is the default,
however, if these are your own settings in your own application you could
make the installation program change the security of your key so regular
users may change values in your application's section.

Another way would be to use a configuration file instead. Although I don't
see why regular users should be allowed to change settings that would effect
all users...
Arild

"Dennis C. Drumm" <de*******@prim acode.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Can my program access the HKEY_LOCAL_MACH INE/Software section of the
registry when being used by a user with restricted rights (not with admin
rights)?

If so, how? I have a program that functions just fine when run by an
administrator but generates an exception when run by a restricted user.
The program accesses the HKEY_LOCAL_MACH INE/Software section to set or get
application settings that are not user specific.

Thanks,

Dennis

Nov 16 '05 #4
You should never store volatile application data in HKEY_LOCAL_MACH INE - you are guaranteeing that only administrators will be able to use your program

The appropriate place to put shared data in the registry is exposed via

System.Windows. Forms.Applicati on.CommonAppDat aRegistry

and user data via

System.Windows. Forms.Applicati on.UserAppDataR egistry

under both of these you should have keys for <companyname>\< product>

this is the standard non-admin required way of storing information in the registry

For storing files there are equivelent areas of the file system exposed by the Application class too.

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog

nntp://news.microsoft. com/microsoft.publi c.dotnet.langua ges.csharp/<2c************ **************@ posting.google. com>

Try using this to build impersonation into your program and then run
it.

http://www.codeproject.com/csharp/cpimpersonation1.asp

It might help to just use the source code already provided to see if
you can access the regex. That way you dont have to modify your own
code if it doesnt work, which i doubt.

:-)
Sushant

"Dennis C. Drumm" <de*******@prim acode.com> wrote in message news:<#C******* *******@TK2MSFT NGP09.phx.gbl>. ..
Can my program access the HKEY_LOCAL_MACH INE/Software section of the
registry when being used by a user with restricted rights (not with admin
rights)?

If so, how? I have a program that functions just fine when run by an
administrator but generates an exception when run by a restricted user. The
program accesses the HKEY_LOCAL_MACH INE/Software section to set or get
application settings that are not user specific.

Thanks,

Dennis


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004

[microsoft.publi c.dotnet.langua ges.csharp]
Nov 16 '05 #5
Thanks to everyone for the responses.

Richard, since the Application.Com monAppDataRegis try puts information in a
key associated with an application version, is there a way to retrieve
common user data from keys created for previous versions of the application?

Thanks,

Dennis

"Richard Blewett [DevelopMentor]" <ri******@devel op.com> wrote in message
news:OO******** ******@tk2msftn gp13.phx.gbl...
You should never store volatile application data in HKEY_LOCAL_MACH INE -
you are guaranteeing that only administrators will be able to use your
program

The appropriate place to put shared data in the registry is exposed via

System.Windows. Forms.Applicati on.CommonAppDat aRegistry

and user data via

System.Windows. Forms.Applicati on.UserAppDataR egistry

under both of these you should have keys for <companyname>\< product>

this is the standard non-admin required way of storing information in the
registry

For storing files there are equivelent areas of the file system exposed by
the Application class too.

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog
nntp://news.microsoft. com/microsoft.publi c.dotnet.langua ges.csharp/<2c************ **************@ posting.google. com>

Try using this to build impersonation into your program and then run
it.

http://www.codeproject.com/csharp/cpimpersonation1.asp

It might help to just use the source code already provided to see if
you can access the regex. That way you dont have to modify your own
code if it doesnt work, which i doubt.

:-)
Sushant

"Dennis C. Drumm" <de*******@prim acode.com> wrote in message
news:<#C******* *******@TK2MSFT NGP09.phx.gbl>. ..
Can my program access the HKEY_LOCAL_MACH INE/Software section of the
registry when being used by a user with restricted rights (not with
admin
rights)?

If so, how? I have a program that functions just fine when run by an
administrator but generates an exception when run by a restricted user.
The
program accesses the HKEY_LOCAL_MACH INE/Software section to set or get
application settings that are not user specific.

Thanks,

Dennis


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004

[microsoft.publi c.dotnet.langua ges.csharp]

Nov 16 '05 #6
Actually looking at the DACL on CommonAppDataRe gistry, a user won't be able to write to that. So so should write to teh file system CommonAppDataPa th (which maps to documents and settings\all users) whose DACL allows users to write. You should write the CommonAppDataRe gistry on application installation for installation option data. Everything else should go in the usr settings prefereable as different users will want different options potentially. To get to previous version settings just go to the registry directly and and read the settings then write them for the new version on installation

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog

nntp://news.microsoft. com/microsoft.publi c.dotnet.langua ges.csharp/<uN************ *@TK2MSFTNGP09. phx.gbl>

Thanks to everyone for the responses.

Richard, since the Application.Com monAppDataRegis try puts information in a
key associated with an application version, is there a way to retrieve
common user data from keys created for previous versions of the application?

Thanks,

Dennis

"Richard Blewett [DevelopMentor]" <ri******@devel op.com> wrote in message
news:OO******** ******@tk2msftn gp13.phx.gbl...
You should never store volatile application data in HKEY_LOCAL_MACH INE -
you are guaranteeing that only administrators will be able to use your
program

The appropriate place to put shared data in the registry is exposed via

System.Windows. Forms.Applicati on.CommonAppDat aRegistry

and user data via

System.Windows. Forms.Applicati on.UserAppDataR egistry

under both of these you should have keys for <companyname>\< product>

this is the standard non-admin required way of storing information in the
registry

For storing files there are equivelent areas of the file system exposed by
the Application class too.

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog
nntp://news.microsoft. com/microsoft.publi c.dotnet.langua ges.csharp/<2c************ **************@ posting.google. com>

Try using this to build impersonation into your program and then run
it.

http://www.codeproject.com/csharp/cpimpersonation1.asp

It might help to just use the source code already provided to see if
you can access the regex. That way you dont have to modify your own
code if it doesnt work, which i doubt.

:-)
Sushant

"Dennis C. Drumm" <de*******@prim acode.com> wrote in message
news:<#C******* *******@TK2MSFT NGP09.phx.gbl>. ..
Can my program access the HKEY_LOCAL_MACH INE/Software section of the
registry when being used by a user with restricted rights (not with
admin
rights)?

If so, how? I have a program that functions just fine when run by an
administrator but generates an exception when run by a restricted user.
The
program accesses the HKEY_LOCAL_MACH INE/Software section to set or get
application settings that are not user specific.

Thanks,

Dennis


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004

[microsoft.publi c.dotnet.langua ges.csharp]


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004

[microsoft.publi c.dotnet.langua ges.csharp]
Nov 16 '05 #7
Hi Dennis,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 16 '05 #8

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

Similar topics

0
2255
by: Mark1 | last post by:
Hi, as I did not find a group for MySQL I try my luck here. Plz tell me, if there is a better cathegory for MySQL... I´ve got several MySQL Databases running on a Linux 8.1 Server. User rights and access to those databases are made by MySQL Database rights. On the other side I´ve got some applications that are running with permissions over a LDAP server.
1
329
by: simo sentissi | last post by:
Hello I have a vb.net app from where I send emails using the smtp .net class. I was developping it under my user rights (admin), but when I run it as a normal user it faces an error of the sort of can't load cdo...... I checked and all the cdo dlls are installed. doe anybody have an idea ? I check on the internet and many people have the same problem ? simo
12
1975
by: Quentin Huo | last post by:
Hi: I am working in win 2003 and ASP.NET. I tried to modify the user rights from an ASPX (writen in C#) page through running xcacls. But failed. What I did is: Process myProcess = new Process(); myProcess.StartInfo.FileName = "cmd.exe";
5
1612
by: Andy | last post by:
Hi What user rights are necessary to run Vb.net 2005? I've tried to have only ordinary user rights when I start VB.net the first time and get some strange messages. /A.
0
1256
by: poli | last post by:
Hi, I have a urgent problem. I want to end a running application before I start another one (in c# code). I see that all these function GetProcesses() ,GetProcessesByName(), run only if I have admin rights. But I have power user rights. Considering this, how can I kill a process? Thank you vry much for help! Poli
0
1954
by: Keita | last post by:
Hi everyone. I'm using a socket-based application for Windows platforms (using winsock). Everything works fine when trying to connect in Administrator mode, but when I'm in User mode no communication can be made...this is a dumb question but do I "need" specifically to be in Administrator mode or can I access this app with normal User rights? The only thing it does is a "read" from the servers. Does creating a socket (or actions after it like...
1
1869
by: nabilj45 | last post by:
Does anyone have a query that will list all the users and user rights for a sqlserver database. Thanks so much!
1
3712
by: yellowblueyellow | last post by:
Hey ,, I wanted to List user rights assignment programmatically using c#.. the function should list the privilege and the user it has been granted to. I think it can be done using PInvoke . Is there another way?. if not can someone give me a hint as to how to proceed. thanks
2
1546
by: Jassim Rahma | last post by:
I have an application in C# and I want to assign rights based on the user login. I have users table in the database and I wnat to know what is the best way to manage the user rights?
1
3768
by: Jason7899 | last post by:
hi, i need configure user rights in windows server 2008 i have the groups already defined by default but now i want creat a group and configure all permisions on that group where can i find that options i have search in active directory but i can´t find anothing, thanks a lot for your help :)
0
9576
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
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
10074
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
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();...
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
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.