---------------------------------------------------------------------------------------------
[ENHANCED] VFP 9.0 FIX - THE VERSION() FUNCTION RETURNS THE NEW VERSION INFORMATION
January 2026
---------------------------------------------------------------------------------------------
CCB
1. BUG:
In vfp9, usually the VERSION() function returns "Visual FoxPro 09.00.0000.7423 for Windows",
and the _VFP.VERSION property returns "9.0".
In VFP Advanced, usually the VERSION() function returns "Visual FoxPro 10.00.0000.yymm for Windows",
and the _VFP.VERSION property returns "10.0".
For backward compatibility, we can disable the VERSION() function returns the new version information,
then the VERSION() function will return "Visual FoxPro 09.00.0000.7423 for Windows",
and the _VFP.VERSION property will return "9.0".
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun5000e2 :: ; proc near
;
; ----------------------------------------------------------------------------------
; VFP 9.0 FIX - THE VERSION() FUNCTION RETURNS THE NEW VERSION INFORMATION
; March 2019
; ----------------------------------------------------------------------------------
; CCB
;
; The VERSION() function returns the new version information.
;
; 2019/3/12, by ccb
;
; pushd 01CFFh ;0x005000e2 : 68ff1c0000
; pushd 00h ;0x005000e7 : 6a00
; pushd 00h ;0x005000e9 : 6a00
; pushd 09h ;0x005000e9 : 6a09
cmp dword ptr vfpa_sys9018_data,00h
jne Label5000e3
pushd 01CFFh
pushd 00h
pushd 00h
pushd 09h
jmp Label5000ed
Label5000e3 ::
mov eax,offset Data920200
xor ecx,ecx
mov cl,byte ptr [eax+0Ah]
sub cl,30h
mov edx,ecx
shl edx,03h
add edx,ecx
add edx,ecx
mov eax,offset Data920200
xor ecx,ecx
mov cl,byte ptr [eax+0Bh]
sub cl,30h
add edx,ecx
mov ecx,edx
shl edx,03h
add edx,ecx
add edx,ecx
mov ecx,edx
shl edx,03h
add edx,ecx
add edx,ecx
Label5000e3_month_start ::
mov eax,offset Data920200
xor ecx,ecx
Label5000e3_month_Jan ::
cmp dword ptr [eax],"naJ["
jne Label5000e3_month_Feb
mov cl,01h
jmp Label5000e3_month_end
Label5000e3_month_Feb ::
cmp dword ptr [eax],"beF["
jne Label5000e3_month_Mar
mov cl,02h
jmp Label5000e3_month_end
Label5000e3_month_Mar ::
cmp dword ptr [eax],"raM["
jne Label5000e3_month_Apr
mov cl,03h
jmp Label5000e3_month_end
Label5000e3_month_Apr ::
cmp dword ptr [eax],"rpA["
jne Label5000e3_month_May
mov cl,04h
jmp Label5000e3_month_end
Label5000e3_month_May ::
cmp dword ptr [eax],"yaM["
jne Label5000e3_month_Jun
mov cl,05h
jmp Label5000e3_month_end
Label5000e3_month_Jun ::
cmp dword ptr [eax],"nuJ["
jne Label5000e3_month_Jul
mov cl,06h
jmp Label5000e3_month_end
Label5000e3_month_Jul ::
cmp dword ptr [eax],"luJ["
jne Label5000e3_month_Aug
mov cl,07h
jmp Label5000e3_month_end
Label5000e3_month_Aug ::
cmp dword ptr [eax],"guA["
jne Label5000e3_month_Sep
mov cl,08h
jmp Label5000e3_month_end
Label5000e3_month_Sep ::
cmp dword ptr [eax],"peS["
jne Label5000e3_month_Oct
mov cl,09h
jmp Label5000e3_month_end
Label5000e3_month_Oct ::
cmp dword ptr [eax],"tcO["
jne Label5000e3_month_Nov
mov cl,0Ah
jmp Label5000e3_month_end
Label5000e3_month_Nov ::
cmp dword ptr [eax],"voN["
jne Label5000e3_month_Dec
mov cl,0Bh
jmp Label5000e3_month_end
Label5000e3_month_Dec ::
cmp dword ptr [eax],"ceD["
jne Label5000e3_month_other
mov cl,0Ch
jmp Label5000e3_month_end
Label5000e3_month_other ::
mov cl,01h
jmp Label5000e3_month_end
Label5000e3_month_end ::
add edx,ecx
push edx
pushd 00h
pushd 00h
pushd 0Ah
jmp Label5000ed
Label5000ed ::
pushd offset Data921d80 ;0x005000ed : 68801d9200
push dword ptr [ esp + 24 ] ;0x005000f2 : ff742418
call Fun43089c ;0x005000f6 : e8a107f3ff
add esp , 018h ;0x005000fb : 83c418
ret 04h ;0x005000fe : c20400
4. APPLIES TO:
VFP 10 (VFP Advanced)
IMPORTANT NOTE:
Please use the VERSION property carefully.
For example, the following code can not run fine in VFP Advanced:
IF _VFP.VERSION >= "9.0" && _VFP.VERSION = "10.0" in VFP Advanced, it's wrong!
IF APPLICATION.VERSION >= "9.0" && APPLICATION.VERSION = "10.0" in VFP Advanced, it's wrong!
Recommend to use the following code:
IF VAL(_VFP.VERSION) >= 9.0 && VAL(_VFP.VERSION) = 10.0 in VFP Advanced, it's ok.
IF VAL(APPLICATION.VERSION) >= 9.0 && VAL(APPLICATION.VERSION) = 10.0 in VFP Advanced, it's ok.
IF VAL(VERSION(4)) >= 9.0 && VAL(VERSION(4)) = 10.0 in VFP Advanced, it's ok.
IF VERSION(4) >= "09.0" && VERSION(4) = "10.0" in VFP Advanced, it's ok.
IF VERSION(5) >= 900 && VERSION(5) = 1000 in VFP Advanced, it's ok.
5. REFERENCE WEBSITES:
1, baiyujia.com:
http://www.baiyujia.com
http://www.baiyujia.com/vfpdocuments/f_vfp9fix76.asp
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|