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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.