Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Access denied
Message
 
À
15/06/2000 20:16:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00381109
Message ID:
00381290
Vues:
14
>I setup the following code to check for the existance of a printer ( I intend to use the program as a postsetup call for vfp setup ). When I run it I get a response of 5 from the RegOpenKeyEx function. I have checked the path with regedit and it exists. I am confused :(
>
>Can the Klingons come to the rescue?
>
>Also, what is the 4th parameter for. It was defined as nSecurityAccess in the declaration but I can't find a list of what the numbers should mean.
>
>I know the registry class would make this simpler but I have the bit in my teeth now and I don't want to let go.
>
>Here is the code:
>
>**************************************************************************
>*** Add PDF printer IF it is NOT already there
>**************************************************************************
>*** Check registry for existance of 'DocuComm PDF Driver' checks for
>*** existance of:
>*** HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\Print\Printers\DocuCom PDF Driver
>*** registry entry.
>#INCLUDE Programs\Registry.H && Handles number parameter converting them to user
> * friendly names ie HKEY_LOCAL_MACHINE to -2147483646
>
>
>*** Setup structure for Win32API
>LOCAL lnHandle, lnSuccess
>
>DECLARE INTEGER RegOpenKeyEx IN Win32API ;
> INTEGER nStartHandle, ;
> STRING cKeyToOpen, ;
> INTEGER nReservedZero, ;
> INTEGER nSecurityAccess, ;
> INTEGER @nOpenHandle
>
>
>DECLARE INTEGER RegCloseKey IN Win32API ;
> INTEGER nHKey
>
>set step on
>
>STORE 0 TO lnHandle,lnSuccess
>*- Open the PDF printer key
>lnSuccess = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ;
> "SYSTEM\CurrentControlSet\Control\Print\Printers\DocuCom PDF Driver", 0, 0, @lnHandle)
>
>lnSuccess = RegCloseKey(lnHandle)

I think that the security parameter needs to be a combination of one or more of the following values:
#define KEY_QUERY_VALUE         0x0001
#define KEY_SET_VALUE           0x0002
#define KEY_CREATE_SUB_KEY      0x0004
#define KEY_ENUMERATE_SUB_KEYS  0x0008
#define KEY_NOTIFY              0x0010
#define KEY_CREATE_LINK         0x0020
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform