Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get all the settings in IDE vs. run-time?
Message
From
03/02/2017 03:07:45
 
 
To
02/02/2017 16:52:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01647262
Message ID:
01647400
Views:
47
>the buffer initializing the variables
>
>STORE SPACE(256) TO lpbData, lpszValue 
>
>traversing the APIs (RegEnumValue,RegEnumKey) are returned as their exact values.
>in the cursor returned by code above i see that there is only path registered key as key might be too long than 256 chars.
>
>in my vfp i have not a path >256 chars
>if the case, increasing this value can solve the problem (to confirm).
>
>can you confirm also the error pointed in this code in your case (independent of registry.prg)
> http://www.news2news.com/vfp/?example=131&function=194
>


The Registry.prg uses the winapi32 functions. As News2News defines, the string buffer is a DWORD (unsign 32bit). This is a maximum length. I can create a Key (TestMe) in the vfp9.0 registry section with a string length >256 (1000 bytes). When executing the Registry.prg function, the error occurs when the buffer is initialized to 256. Error stating that string would not fit in the buffer, and was truncated to the size of the buffer. Normally, if the resulting string is less then size of the buffer, the string is copied (plus a 0x00 terminator) to the buffer. The buffer itself will still be 256 bytes, but the string is zero terminated (this is a C thing) in the buffer. VFP only recognizes the returned string to either the zero terminator or the defined length of the buffer.

My guess is that when the Registry.prg was written, the system was 16bit. The thought of a string being over 256 was unheard of. But, now, in the new world, it it safe to have larger strings.

I added preprocessor declaration at the beginning of the file
#DEFINE REG_BUFFER_SIZE    4096
and replace all the 256 buffer size references to REG_BUFFER_SIZE.


>
>if you execute regedit.exe as administrator and go to this key (in my windows 10)
>
>HKEY_CURRENT_USER\Software\Microsoft\VisualFoxPro\9.0\Options
>
>you can see all the vfp 9 options settings in registry.
>can capture all options set simply by rightclick on "options " key and choose "export" to txt file.
>this is a manual way to return all vfp 9 options settings.
Greg Reichert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform