Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access denied
Message
 
To
16/06/2000 11:48:35
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00381109
Message ID:
00381444
Views:
16
>>>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
>
>
>Well that will keep me chewing for a while. Do you know why I am getting the "5 - Access Denied" return value?

It's a SWAG, but I'd say because you're not passing the necessary security flags.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform