Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RegOpenKeyEx Failing on HKLM
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
RegOpenKeyEx Failing on HKLM
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01605461
Message ID:
01605461
Vues:
39
Using the RegOpenKeyEx windows API to read registry entries:
#DEFINE HKEY_CURRENT_USER   0x80000001
#DEFINE HKEY_LOCAL_MACHINE  0x80000002
#DEFINE HKEY_USERS          0x80000003
#DEFINE KEY_READ            0x20019

DECLARE INTEGER RegOpenKeyEx IN advapi32;
        INTEGER   hKey,;
        STRING    lpSubKey,;
        INTEGER   ulOptions,;
        INTEGER   samDesired,;
        INTEGER @ phkResult

LOCAL nHKey,lcSubKey
nHKey=0
lcSubKey="SOFTWARE\ATI"
? RegOpenKeyEx(HKEY_LOCAL_MACHINE,lcSubKey,0,KEY_READ,@nhKey)
See attached screenshot. It succeeds and fails for no discernible reason:

lcSubKey="SOFTWARE\2X" returns 2 - failure
lcSubKey="SOFTWARE\Adobe" returns 0 - Success
lcSubKey="SOFTWARE\AGEIA Technologies" returns 0 - Success
lcSubKey="SOFTWARE\AMD" returns 2 - failure
lcSubKey="SOFTWARE\ATI" returns 0 - Success
lcSubKey="SOFTWARE\ATI Technologies" returns 0 - Success

and so on and so on. I've verified these registry entries are properly inheriting permissions.

Curiously, if I instead use the HKEY_CURRENT_USER hive and query that section of the registry the RegOpenKeyEx function always returns 0 Success.


I'm at a loss. Any ideas?
Brandon Harker
Sebae Data Solutions
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform