Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Writing to the Registry
Message
From
22/07/2005 13:37:54
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01032326
Message ID:
01035198
Views:
13
Thanks!

Didn't think what I was doing was right.

Chris

>AFAIK, the RegWrite method doesn't have return value (it always returns Null). Take a look at Checking Registry Subkey Access Rights at http://www.microsoft.com/technet/scriptcenter/guide/sas_reg_dlby.mspx
>
>>
>>I have the following code that writes to the registry:
>>
>>
>>LOCAL loRegistry, lcRegBase, lcLoginServer
>>loRegistry = CREATEOBJECT("WScript.Shell")
>>lcRegBase = "some key"
>>lcLoginServer = "some value"
>>
>>IF VARTYPE(loRegistry) == "O"
>>  Registry.RegWrite(lcRegBase + "Server Name", lcLoginServer, "REG_SZ")
>>ENDIF
>>
>>
>>
>>It works but I found that it doesn't work if the user logged into windows does not have administrator access. I gludged my way around it with the following code:
>>
>>
>>LOCAL loRegistry, lcRegBase, lcLoginServer, luRetVal
>>loRegistry = CREATEOBJECT("WScript.Shell")
>>lcRegBase = "some key"
>>lcLoginServer = "some value"
>>
>>IF VARTYPE(loRegistry) == "O"
>>  luRetVal = .NULL.
>>  luRetVal = loRegistry.RegWrite(lcRegBase + "Server Name", lcLoginServer, "REG_SZ")
>>  IF VARTYPE(luRetVal) <> "C"
>>    MESSAGEBOX("You don't have enough windows security access...")
>>  ENDIF
>>ENDIF
>>
>>
>>
>>I was wondering if there is a better way to test if the user has enough security access on windows to write to the registry?
>>
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform