473,320 Members | 2,083 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,320 software developers and data experts.

write to registry in vb.net and vista

sd
hello
I need to keep my app entry under HKEY_LOCAL_MACHINE\Software\MyApp.
(to support for all users).I need to update one key under MYApp.
When I attempt to set value for this key
My.Computer.Registry.LocalMachine.CreateSubKey("so ftware
\MyApp").SetValue("Licence", "Success")

I get error stating Access to HKEY_LOCAL_MACHINE\Software\MYapp denied
for Vista only.For XP no problem.If for Vista I give full control to
Myapp reg folder ,everything works fine.Is it possible to create the
registry key with full controls permission in vb.net? or is there any
other way to solve this problem through vb.net.I don't want to give
permissions manually on reg key.
Thanks
Jun 27 '08 #1
6 6665
I'd say your best way to accomplish this is to find some way to not
write to the registry. Vista's security makes it rough to write to
the registry. I know we had an app that had to be installed on a
regular user machine but because of all the registry writing we had to
give the user administrator rights which is a huge no-no.
Jun 27 '08 #2
If you limit writing to HKEY_LOCAL_USER, then you'll be fine. It's probably
easier to modify your app to write separately per user than to switch to
using files.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
Java to VB & C#
Instant C#: convert VB to C#
Instant VB: convert C# to VB
Instant C++: VB, C#, or Java to C++/CLI
"cfps.Christian" wrote:
I'd say your best way to accomplish this is to find some way to not
write to the registry. Vista's security makes it rough to write to
the registry. I know we had an app that had to be installed on a
regular user machine but because of all the registry writing we had to
give the user administrator rights which is a huge no-no.
Jun 27 '08 #3
I wouldn't expect you to have problems if this were run as a part of a custom
action in a setup project. It appears though you are trying to set this as
the application is run by individual users. Maybe your example is just to
help explain it, but wouldn't the license only need checking at install, and
from then on the install is considered valid? Perhaps you are implimenting a
license expiration date. If so, that could just be handled in code without
registry modification.

"sd" wrote:
hello
I need to keep my app entry under HKEY_LOCAL_MACHINE\Software\MyApp.
(to support for all users).I need to update one key under MYApp.
When I attempt to set value for this key
My.Computer.Registry.LocalMachine.CreateSubKey("so ftware
\MyApp").SetValue("Licence", "Success")

I get error stating Access to HKEY_LOCAL_MACHINE\Software\MYapp denied
for Vista only.For XP no problem.If for Vista I give full control to
Myapp reg folder ,everything works fine.Is it possible to create the
registry key with full controls permission in vb.net? or is there any
other way to solve this problem through vb.net.I don't want to give
permissions manually on reg key.
Thanks
Jun 27 '08 #4
I had the same problem a while back with my app. Is this app installed on a
computer that is part of a domain? I found that some of the users on the
computer couldn't run the app as well because they were not added to the
machine as a domain user but a local user only. Our IT Admin had to add
everyone as a domain user. I hope that makes sense.

Tony K.
"sd" <ds********@gmail.comwrote in message
news:99**********************************@p39g2000 prm.googlegroups.com...
hello
I need to keep my app entry under HKEY_LOCAL_MACHINE\Software\MyApp.
(to support for all users).I need to update one key under MYApp.
When I attempt to set value for this key
My.Computer.Registry.LocalMachine.CreateSubKey("so ftware
\MyApp").SetValue("Licence", "Success")

I get error stating Access to HKEY_LOCAL_MACHINE\Software\MYapp denied
for Vista only.For XP no problem.If for Vista I give full control to
Myapp reg folder ,everything works fine.Is it possible to create the
registry key with full controls permission in vb.net? or is there any
other way to solve this problem through vb.net.I don't want to give
permissions manually on reg key.
Thanks

Jun 27 '08 #5
I am not sure if it is easier in respect to security and Vista or if
there isn't some other pitfall but I have always had an issue with
putting things in the registry if I didn't HAVE to do it. Config
files are nice but they may not suit every situation. I have solved a
similar situation by storing the value in question as an environment
variable, As long as the information isn't sensitive it can work.
On May 9, 2:07 pm, "Tony K" <myfirstn...@kingprogramming.comwrote:
>
hello
I need to keep my app entry under HKEY_LOCAL_MACHINE\Software\MyApp.
(to support for all users).I need to update one key under MYApp.
When I attempt to set value for this key
My.Computer.Registry.LocalMachine.CreateSubKey("so ftware
\MyApp").SetValue("Licence", "Success")
I get error stating Access to HKEY_LOCAL_MACHINE\Software\MYapp denied
for Vista only.For XP no problem.If for Vista I give full control to
Myapp reg folder ,everything works fine.Is it possible to create the
registry key with full controls permission in vb.net? or is there any
other way to solve this problem through vb.net.I don't want to give
permissions manually on reg key.
Thanks
Jun 27 '08 #6
sd wrote:
I need to keep my app entry under HKEY_LOCAL_MACHINE\Software\MyApp.
(to support for all users). I need to update one key under MYApp.
When I attempt to set value for this key
My.Computer.Registry.LocalMachine.CreateSubKey("so ftware
\MyApp").SetValue("Licence", "Success")
HLKM can only be updated (reliably) on Vista by an Administrator. An
"ordinary" User /cannot/ do so.

You could separate your "licencing" function into a separate program and
launch that from your main program if it finds itself "unlicenced", but
this will still require "Elevation" and the dreaded UAC Dialog.
I get error stating Access to HKEY_LOCAL_MACHINE\Software\MYapp denied
for Vista only.For XP no problem.
"Being" an Administrator means different things on Vista than it did on XP:

On XP, logging on and "being" an Administrator meant you executed every
process /as/ an Administrator. Risky.

On Vista, logging on and "being" an Administrator counts for /nothing/.
To run any process /as/ an Administrator, you have to do so
explicitly, via the UAC Dialog.
If for Vista I give full control to Myapp reg folder ,everything
works fine.
No surprise there.
Is it possible to create the registry key with full controls
permission in vb.net?
Probably but, because you're working under HKLM, /only/ from an Elevated
process, i.e. one run /by/ and /as/ an Administrator.

BTW, Installers should always be run in this way, so that might be a
good place to think about doing this.
is there any other way to solve this problem through vb.net.
Possibilities:
Use an Elevated "licensing" program.
Don't put values under HKLM.
Don't put values into the Registry /at all/. It's getting to be a
nightmare in there.
I don't want to give permissions manually on reg key.
Good. :-)

HTH,
Phill W.
Jun 27 '08 #7

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

Similar topics

9
by: BigAbility | last post by:
is there registry in Longhorn( vista) ? i heard about Registry will disappear in longhorn. is it true?
6
by: Steve Teeples | last post by:
I have a piece of code (written is Visual Studio 2005) that is only reading the Security EventLog. On Windows XP Professiona/Home this code works just fine. int numberOfEntries =...
11
by: vovan | last post by:
I'm using this approach to read from registry. Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess, _ "HKEY_LOCAL_MACHINE\SOFTWARE\SRS Enterprises\Coordinator\Settings") 'Vlad...
2
by: =?Utf-8?B?QW5qYW5h?= | last post by:
Hello we creating a web application in ASP .net 2.0. we are trying to read font file path from registry as below Microsoft.Win32.RegistryKey registryKeyParen registryKeyChild =...
3
by: Rob Latour | last post by:
The following snippet (vb.net 2005) is working just fine in xp but not in vista in xp it lists all related sub keys in the registry just fine. in vista it doesn't list certain ones (like...
2
by: =?Utf-8?B?UGV0ZQ==?= | last post by:
Hi, I have developed a VB application in VS2005 and deployed it sucessfully to XP using an MSI file built with a standard VS setup project. The MSI creates some keys under...
2
by: terryastone | last post by:
I have an application that reads some registry values stored in the Local Machine\Software\... key. In XP, I can see these values using RegEdit. In my application I can read the values at...
3
by: thephatp | last post by:
This is incredibly strange. I used regedit and went to HKEY_LOCAL_MACHINE and create a new subkey under "Software". I added a few more, then went into code to try to read them. I kept getting...
1
by: MrShadow | last post by:
G'Day, I've been trying to find an answer to this for a long time now and haven't been making any headway. I have a maintenance application that runs a defrag, checkdisk, windows updates etc in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.