PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Gian Young on May 24, 2012, 09:57:56 AM

Title: Help needed with Registry Commands
Post by: Gian Young on May 24, 2012, 09:57:56 AM
Hi,

I have been using the command Value$ = FF_GetRegistryString(%HKEY_LOCAL_MACHINE,"SOFTWARE\DBS\DbMyKey", "Clsid1", "Not Found") quite successfully to query if a particular Registry Key exists.

If the Registry Key does not exist then Value$ = "Not Found"

The above has worked well for me with XP until I come across Vista/W7 and the command completely fails.

Windows informs me that the command has failed ??

Can anyone advise me of a way around this.

Regards
Gian Young
Title: Re: Help needed with Registry Commands
Post by: Paul Squires on May 24, 2012, 11:23:29 AM
It would appear that UAC may be causing failure to read/write to keys stored in HKEY_LOCAL_MACHINE. I usually store keys in HKEY_CURRENT_USER instead.

A search of the Net revealed this:
http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/3d8e17cd-a00e-4c2c-8e2d-c99681056627

Try modifying the FF_GetRegistryString by changing:

If (RegOpenKeyEx(hLocation, Trim$(sSubKeys, "\"), 0, %KEY_READ, hKey) = %ERROR_SUCCESS) Then


To:

If (RegOpenKeyEx(hLocation, Trim$(sSubKeys, "\"), 0, %KEY_READ OR %KEY_ALL_ACCESS, hKey) = %ERROR_SUCCESS) Then