473,322 Members | 1,473 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,322 software developers and data experts.

Writing to the registry

Hi all and thanks for reading this. I can read anywhere in the registry,
but I can't write to the local machine (XP Pro, I am not the admin.). My
application needs to write to the registry the registration code, but
because of the permissions thing, it won't let me. Any ideas on how I can
resolve this??

Many thanks,
Steve.
Nov 21 '05 #1
6 1443
Steve,
Security is there for a reason so you won't be able to. Can you use the
Current User Hive or alternatively use an XML file to hold your local
settings.

Doug

"stephen coleman" <st***************@ntlworld.com> wrote in message
news:kr************@newsfe1-gui.ntli.net...
Hi all and thanks for reading this. I can read anywhere in the registry,
but I can't write to the local machine (XP Pro, I am not the admin.). My
application needs to write to the registry the registration code, but
because of the permissions thing, it won't let me. Any ideas on how I can
resolve this??

Many thanks,
Steve.

Nov 21 '05 #2
Hi,

You need to specify you want the sub key to writeable when you
open it otherwise you get a security error.

Try

Dim hku As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser

Dim PreventFocus As Microsoft.Win32.RegistryKey = hku.OpenSubKey("Control
Panel\desktop", True)

PreventFocus.SetValue("ForegroundLockTimeout", 200000)

Catch ex As Exception

Trace.WriteLine(ex.ToString)

End Try

This gives security error.

Try

Dim hku As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser

Dim PreventFocus As Microsoft.Win32.RegistryKey = hku.OpenSubKey("Control
Panel\desktop")

PreventFocus.SetValue("ForegroundLockTimeout", 200000)

Catch ex As Exception

Trace.WriteLine(ex.ToString)

End Try

Ken

-------------------------

"stephen coleman" <st***************@ntlworld.com> wrote in message
news:kr************@newsfe1-gui.ntli.net...
Hi all and thanks for reading this. I can read anywhere in the registry,
but I can't write to the local machine (XP Pro, I am not the admin.). My
application needs to write to the registry the registration code, but
because of the permissions thing, it won't let me. Any ideas on how I can
resolve this??

Many thanks,
Steve.

Nov 21 '05 #3
Thanks all for your help, sorted!!

"stephen coleman" <st***************@ntlworld.com> wrote in message
news:kr************@newsfe1-gui.ntli.net...
Hi all and thanks for reading this. I can read anywhere in the registry,
but I can't write to the local machine (XP Pro, I am not the admin.). My
application needs to write to the registry the registration code, but
because of the permissions thing, it won't let me. Any ideas on how I can
resolve this??

Many thanks,
Steve.

Nov 21 '05 #4
Thanks all for your help, sorted!!

"stephen coleman" <st***************@ntlworld.com> wrote in message
news:kr************@newsfe1-gui.ntli.net...
Hi all and thanks for reading this. I can read anywhere in the registry,
but I can't write to the local machine (XP Pro, I am not the admin.). My
application needs to write to the registry the registration code, but
because of the permissions thing, it won't let me. Any ideas on how I can
resolve this??

Many thanks,
Steve.

Nov 21 '05 #5
Ken,
If you read Steve's question, he is trying to write to the Local Machine
Hive without Admin Privledges.

Doug
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:el**************@TK2MSFTNGP10.phx.gbl...
Hi,

You need to specify you want the sub key to writeable when you
open it otherwise you get a security error.

Try

Dim hku As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser

Dim PreventFocus As Microsoft.Win32.RegistryKey = hku.OpenSubKey("Control
Panel\desktop", True)

PreventFocus.SetValue("ForegroundLockTimeout", 200000)

Catch ex As Exception

Trace.WriteLine(ex.ToString)

End Try

This gives security error.

Try

Dim hku As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser

Dim PreventFocus As Microsoft.Win32.RegistryKey = hku.OpenSubKey("Control
Panel\desktop")

PreventFocus.SetValue("ForegroundLockTimeout", 200000)

Catch ex As Exception

Trace.WriteLine(ex.ToString)

End Try

Ken

-------------------------

"stephen coleman" <st***************@ntlworld.com> wrote in message
news:kr************@newsfe1-gui.ntli.net...
Hi all and thanks for reading this. I can read anywhere in the registry,
but I can't write to the local machine (XP Pro, I am not the admin.). My
application needs to write to the registry the registration code, but
because of the permissions thing, it won't let me. Any ideas on how I can
resolve this??

Many thanks,
Steve.

Nov 21 '05 #6
Ken,
If you read Steve's question, he is trying to write to the Local Machine
Hive without Admin Privledges.

Doug
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:el**************@TK2MSFTNGP10.phx.gbl...
Hi,

You need to specify you want the sub key to writeable when you
open it otherwise you get a security error.

Try

Dim hku As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser

Dim PreventFocus As Microsoft.Win32.RegistryKey = hku.OpenSubKey("Control
Panel\desktop", True)

PreventFocus.SetValue("ForegroundLockTimeout", 200000)

Catch ex As Exception

Trace.WriteLine(ex.ToString)

End Try

This gives security error.

Try

Dim hku As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.CurrentUser

Dim PreventFocus As Microsoft.Win32.RegistryKey = hku.OpenSubKey("Control
Panel\desktop")

PreventFocus.SetValue("ForegroundLockTimeout", 200000)

Catch ex As Exception

Trace.WriteLine(ex.ToString)

End Try

Ken

-------------------------

"stephen coleman" <st***************@ntlworld.com> wrote in message
news:kr************@newsfe1-gui.ntli.net...
Hi all and thanks for reading this. I can read anywhere in the registry,
but I can't write to the local machine (XP Pro, I am not the admin.). My
application needs to write to the registry the registration code, but
because of the permissions thing, it won't let me. Any ideas on how I can
resolve this??

Many thanks,
Steve.

Nov 21 '05 #7

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

Similar topics

0
by: Pat Blair | last post by:
Sorry to anyone who read this post, but in case it's useful to anyone: Further experiments reveal that while a tuple comes back if you read a multi-line string, you set the value using a list (not...
2
by: Paul P | last post by:
I am having a problem writing errors to the application log on a Windows 2003 server running IIS 6 The error message is "InvalidOperationException: Cannot open log for source {0}." I have created...
6
by: msnews.microsoft.com | last post by:
Hi all, I was trying to find an easy way to write in the standard configuration (like app.config) xml-based files. I found classes that can be used to read this information (in...
2
by: glenn | last post by:
I am trying to write to the registry and the objects that are suppose to be handling this function are not working. Here is what is happening. I am issuing the following commands: RegistryKey...
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 =...
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: Sreppohcdoow | last post by:
I have a simple tool that I create that stores some settings in the Registry... however, if the user running it doesn't have Admin priveleges on the machine, the app fails when trying to write to...
0
by: Chris Mullins | last post by:
I have an application that installs some 64-bit binaries for development use in Visual Studio 2005. As such I want them to appear in the .Net References menu when someone attempts to "Add...
1
by: Chris Mullins | last post by:
I need to write to the 32-bit registry, and need to do so from a 64-bit MSI. It never occurred to me that this would be difficult... I have an application that installs some 64-bit binaries for...
1
by: projectVBA | last post by:
Hi , I wrote some add in for PowerPoint and i'm trying to find an automatic way to load it every time PowerPoint starts. I found Microsoft Code example (see below ) BUT the problem is : I can't...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.