I had this question after viewing Variable type declaration in VFP
My goal to to query a value in a remote computer's registry from within my VFP 8 program.
The only API functions I could find was OpenRemoteBaseKey (.NET Framework) and RegConnectRegistry (Advapi32.dll)
The C++ construction:
LONG WINAPI RegConnectRegistry(
_In_opt_ LPCTSTR lpMachineName,
_In_ HKEY hKey,
_Out_ PHKEY phkResult
is a string variable like "\\remotecomputer"
can be one of these hex constants (the hex value is shown with a &H
HKEY_USERS , &H80000003
is described as: A pointer to a variable that receives a key handle identifying the predefined handle on the remote computer.
In VFP I tried this:
DECLARE INTEGER RegConnectRegistry IN win32api ;
STRING lpMachineName, ;
INTEGER hKey, ;
ln_HKEY_USERS = 0x80000003
ln_Ret = RegConnectRegistry("\\EPCW
IN10", ln_HKEY_USERS, @ln_result)
ln_Ret returns 1780
, according to Winerror.h that means: "A null reference pointer was passed to the stub"
The remote registry service is running on \\EPCWIN10
I'm thinking I can't simply convert hex to decimal.
What am I doing wrong? Is there some other way to programmatically read a value from a remote registry?