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.