Click here to Skip to main content
15,790,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can successfully write to (registry) and (system drive) on a 32 bit operating system, but cannot do the same on a 64 bit. The program was developed using VB.Net 2010 Professional on a 32 bit windows 7 machine. What could be the problem? Here is part of my code.

VB
If System.Environment.OSVersion.Version.Major >= 6 Then
   procInfo.Verb = "runas"
End If
Process.Start(procInfo)

It does show a User Account Control window, and I enter the correct admin password, then i get an access denied error message. I tried changing the 'target PC' option to 'Any CPU' or 'x64' but still, same thing. Any ideas?

[Edit - OP Code from "solution]
VB
Dim sDate as date
 My.Computer.Registry.LocalMachine.CreateSubKey("SOFTWARE\Test")
 My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "Date", sDate)
Posted
Updated 10-Jun-14 7:48am
v3
Comments
Richard MacCutchan 10-Jun-14 12:19pm    
Where is the code that writes to the registry?
CHill60 10-Jun-14 12:49pm    
By posting your code as a solution you have made your question drop out of the list of unanswered questions. I've updated your question using the "Improve question" link and will now delete your solution post so that your question comes back into the list
Sergey Alexandrovich Kryukov 10-Jun-14 18:15pm    
Are you sure both systems are Windows 7? Just checking... "x64" is a jargon term, usually for "x86-64".
Compare the registries on both system before the change. Is the key available on both?
—SA
vbGoof 11-Jun-14 4:44am    
Thanks Chill.Sergey yes i have tried it on Windows 7 Professional (32 bit) and Windows 7 Professional(64 bit) and Windows 8 professional. I have navigated to the C:\windows\system32. My file is NOT there. I have searched the registry under HKLM/software, my folder is NOT there. However when i do a search, in both locations they appear under the 'WOW' folders.

1 solution

Run that exe as "Run as Administrator" privilege.
this will resolve your problem
 
Share this answer
 
Comments
vbGoof 13-Jun-14 2:05am    
Hariom the "Run as Administrator" privilege Only works if I try to run the program 3 times, it doesn't work 1st kick, I wonder why. And it doesn't create folders in the correct destination, for instance, in registry it writes to [Wow6432Node] instead of [HKLM/Software]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900