954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Can't Read/Write to registry - works in VB6 not VB.Net - Err 5 writing, no data reads

I have several programs that must write to HKLM in XP and Windows 7/64 Pro.

The programs work in VB6 but not in VB.Net 2008 on target machines. It does works on our development machine.
Same exact windows.
User is an Administrator.
NOT using Run as.

Both programs are using the same function
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" _
(ByVal lngRootKey As Long, ByVal lpSubKey As String, phkResult As Long)
As Long
Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" _
(ByVal lngRootKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
etc.

for VB6

Changed Long to Integer for VB.NET

It works on the developement machine

VB6 works on BOTH machines.

VB.Net gets no data reading and err 5 trying to write.

On our development machine and also on the target machine the VB6 registry entry goes to
HKEY_CURRENT_USER\Software\Classes\VirtueSTore\Software\Wow6432Node\...

I just cannot figure out why VB6 works but .net doesn't and fails only on the target machine not the development machine.

Thanks

QuickBooksDev
Light Poster
47 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

Turning UAC off (lowest position) makes the .Net work like VB6.

QuickBooksDev
Light Poster
47 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: