----------------------------------------------------------------------------------------------
[NEW.....] VFP 9.0 FIX - THE MESSAGE() FUNCTION RETURNS THE EXPRESSION ERROR MESSAGE
January 2026
----------------------------------------------------------------------------------------------
CCB
1. BUG:
If we enable the MESSAGE() function to return the expression error message (the default setting),
we can get the expression error message and the expression source code that caused the error.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun420bce :: ; proc near
push ebp ;0x00420bce : 55
mov ebp , esp ;0x00420bcf : 8bec
;
; -----------------------------------------------------------------------------------
; VFP 9.0 FIX - THE MESSAGE() FUNCTION RETURNS THE EXPRESSION ERROR MESSAGE
; April 2023
; -----------------------------------------------------------------------------------
; CCB
;
; The MESSAGE() function returns the expression error message.
;
; 2023/4/2, by ccb
;
; sub esp , 060h ;0x00420bd1 : 83ec60
sub esp , 070h ;0x00420bd1 : 83ec60
xor eax , eax
mov dword ptr [ ebp - 070h ][00h] , eax ;; vfpa_expressionerrormessage_ppcode.
mov dword ptr [ ebp - 070h ][04h] , eax ;; vfpa_expressionerrormessage_ppcode_old.
mov dword ptr [ ebp - 070h ][08h] , eax
mov dword ptr [ ebp - 070h ][0Ch] , eax
push ebx ;0x00420bd4 : 53
push esi ;0x00420bd5 : 56
mov esi , dword ptr [ Data9370f0 ] ;0x00420bd6 : 8b35f0709300
push edi ;0x00420bdc : 57
mov edi , dword ptr [ Data93936c ] ;0x00420bdd : 8b3d6c939300
mov ecx , esi ;0x00420be3 : 8bce
sub ecx , edi ;0x00420be5 : 2bcf
mov eax , 02E8BA2E9h ;0x00420be7 : b8e9a28b2e
imul ecx ;0x00420bec : f7e9
mov ecx , dword ptr [ Data939368 ] ;0x00420bee : 8b0d68939300
add ecx , 017h ;0x00420bf4 : 83c117
imul ecx , ecx , 02Ch ;0x00420bf7 : 6bc92c
sar edx , 03h ;0x00420bfa : c1fa03
mov eax , edx ;0x00420bfd : 8bc2
shr eax , 01Fh ;0x00420bff : c1e81f
add eax , edx ;0x00420c02 : 03c2
xor ebx , ebx ;0x00420c04 : 33db
add ecx , edi ;0x00420c06 : 03cf
cmp esi , ecx ;0x00420c08 : 3bf1
mov dword ptr [ ebp - 12 ] , eax ;0x00420c0a : 8945f4
mov dword ptr [ ebp - 8 ] , ebx ;0x00420c0d : 895df8
jnb Label5935fa ;0x00420c10 : 0f83e4291700
mov edx , dword ptr [ Data936f10 ] ;0x00420c16 : 8b15106f9300
mov eax , dword ptr [ ebp + 8 ] ;0x00420c1c : 8b4508
mov dword ptr [ Data936f10 ] , eax ;0x00420c1f : a3106f9300
mov dword ptr [ ebp - 4 ] , edx ;0x00420c24 : 8955fc
;
; -----------------------------------------------------------------------------------
; VFP 9.0 FIX - THE MESSAGE() FUNCTION RETURNS THE EXPRESSION ERROR MESSAGE
; April 2023
; -----------------------------------------------------------------------------------
; CCB
;
; The MESSAGE() function returns the expression error message.
;
; 2023/4/2, by ccb
;
mov eax , dword ptr [ Data9393ac ]
mov dword ptr [ ebp - 070h ][00h] , eax
lea edx , dword ptr [ ebp - 16 ] ;0x00420c27 : 8d55f0
lea eax , dword ptr [ ebp - 96 ] ;0x00420c2a : 8d45a0
call Fun42c27f ;0x00420c2d : e84db60000
push ebx ;0x00420c32 : 53
push eax ;0x00420c33 : 50
call Fun42c2be ;0x00420c34 : e885b60000
mov esi , eax ;0x00420c39 : 8bf0
add esp , 08h ;0x00420c3b : 83c408
cmp esi , ebx ;0x00420c3e : 3bf3
jne Label420cda ;0x00420c40 : 0f8594000000
mov ecx , dword ptr [ Data9393ac ] ;0x00420c46 : 8b0dac939300
mov dl , byte ptr [ecx] ;0x00420c4c : 8a11
xor edi , edi ;0x00420c4e : 33ff
inc ecx ;0x00420c50 : 41
cmp dl , 0FCh ;0x00420c51 : 80fafc
mov dword ptr [ Data936f14 ] , edi ;0x00420c54 : 893d146f9300
mov dword ptr [ Data9393ac ] , ecx ;0x00420c5a : 890dac939300
jne Label59363b ;0x00420c60 : 0f85d5291700
movzx eax ,byte ptr [ecx] ;0x00420c66 : 0fb601
cmp eax , 0FDh ;0x00420c69 : 3dfd000000
je Label420ca7 ;0x00420c6e : 7437
Label420c70 ::
inc ecx ;0x00420c70 : 41
cmp eax , 0100h ;0x00420c71 : 3d00010000
mov dword ptr [ Data9393ac ] , ecx ;0x00420c76 : 890dac939300
ja Label593604 ;0x00420c7c : 0f8782291700
call dword ptr [ 4 * eax + offset DataPtr919f90 ] ;0x00420c82 : ff1485909f9100
Label420c89 ::
mov edi , dword ptr [ Data936f14 ] ;0x00420c89 : 8b3d146f9300
cmp edi , ebx ;0x00420c8f : 3bfb
jne Label4f3372 ;0x00420c91 : 0f85db260d00
Label420c97 ::
mov ecx , dword ptr [ Data9393ac ] ;0x00420c97 : 8b0dac939300
movzx eax ,byte ptr [ecx] ;0x00420c9d : 0fb601
cmp eax , 0FDh ;0x00420ca0 : 3dfd000000
jne Label420c70 ;0x00420ca5 : 75c9
Label420ca7 ::
inc ecx ;0x00420ca7 : 41
mov dword ptr [ Data9393ac ] , ecx ;0x00420ca8 : 890dac939300
Label420cae ::
cmp byte ptr [ Data936f18 ] , bl ;0x00420cae : 381d186f9300
jne Label53e097 ;0x00420cb4 : 0f85ddd31100
Label420cba ::
mov ecx , dword ptr [ Data9370f0 ] ;0x00420cba : 8b0df0709300
mov al , byte ptr [ecx] ;0x00420cc0 : 8a01
cmp al , 047h ;0x00420cc2 : 3c47
je Label4ac12f ;0x00420cc4 : 0f8465b40800
cmp al , 04Ah ;0x00420cca : 3c4a
je Label4a6bea ;0x00420ccc : 0f84185f0800
cmp al , 05Ah ;0x00420cd2 : 3c5a
je Label593660 ;0x00420cd4 : 0f8486291700
Label420cda ::
mov eax , dword ptr [ Data937220 ] ;0x00420cda : a120729300
lea edx , dword ptr [ ebp - 96 ] ;0x00420cdf : 8d55a0
cmp edx , eax ;0x00420ce2 : 3bd0
jne Label5936f6 ;0x00420ce4 : 0f850c2a1700
mov eax , dword ptr [ Data937220 ] ;0x00420cea : a120729300
mov eax , dword ptr [ eax + 76 ] ;0x00420cef : 8b404c
cmp dword ptr [ ebp - 16 ] , eax ;0x00420cf2 : 3945f0
mov dword ptr [ Data937220 ] , eax ;0x00420cf5 : a320729300
jne Label593700 ;0x00420cfa : 0f85002a1700
cmp esi , ebx ;0x00420d00 : 3bf3
mov ecx , dword ptr [ ebp - 4 ] ;0x00420d02 : 8b4dfc
mov dword ptr [ Data936f10 ] , ecx ;0x00420d05 : 890d106f9300
jne Label451a3c ;0x00420d0b : 0f852b0d0300
Label420d11 ::
mov eax , dword ptr [ ebp - 8 ] ;0x00420d11 : 8b45f8
cmp eax , ebx ;0x00420d14 : 3bc3
jne Label420d3d ;0x00420d16 : 7525
cmp dword ptr [ Data936f14 ] , ebx ;0x00420d18 : 391d146f9300
jne Label4f3382 ;0x00420d1e : 0f855e260d00
cmp esi , ebx ;0x00420d24 : 3bf3
mov ecx , dword ptr [ Data9370f0 ] ;0x00420d26 : 8b0df0709300
jne Label593721 ;0x00420d2c : 0f85ef291700
Label420d32 ::
mov eax , ecx ;0x00420d32 : 8bc1
sub ecx , 02Ch ;0x00420d34 : 83e92c
mov dword ptr [ Data9370f0 ] , ecx ;0x00420d37 : 890df0709300
Label420d3d ::
pop edi ;0x00420d3d : 5f
pop esi ;0x00420d3e : 5e
pop ebx ;0x00420d3f : 5b
mov esp , ebp ;0x00420d40 : 8be5
pop ebp ;0x00420d42 : 5d
ret 04h ;0x00420d43 : c20400
Label451a3c ::
;
; -----------------------------------------------------------------------------------
; VFP 9.0 FIX - THE MESSAGE() FUNCTION RETURNS THE EXPRESSION ERROR MESSAGE
; April 2023
; -----------------------------------------------------------------------------------
; CCB
;
; The MESSAGE() function returns the expression error message.
;
; 2023/4/2, by ccb
;
cmp dword ptr vfpa_sys9129_data,00h
je Label451a3d
cmp esi,00h
je Label451a3d
mov dword ptr vfpa_expressionerrormessage_errornumber,esi
mov byte ptr vfpa_expressionerrormessage_errormessage,00h
mov byte ptr vfpa_expressionerrormessage_errorsource,00h
push 0FFh
lea eax,byte ptr vfpa_expressionerrormessage_errormessage
push eax
push dword ptr vfpa_expressionerrormessage_errornumber
call vfpa_geterrormessage
mov eax , dword ptr [ ebp - 070h ][00h]
cmp byte ptr [eax] , 0FCh
jne Label451a3d
mov eax , dword ptr [ Data9393ac ]
mov dword ptr [ ebp - 070h ][04h] , eax
mov eax , dword ptr [ ebp - 070h ][00h]
mov dword ptr [ Data9393ac ] , eax
lea ecx,byte ptr vfpa_expressionerrormessage_errorsource
mov edx , 01FFFh
push 01h
push edx
push ecx
call vfpa_geterrorsource
mov eax , dword ptr [ ebp - 070h ][04h]
mov dword ptr [ Data9393ac ] , eax
Label451a3d ::
test byte ptr [ ebp + 8 ] , 01h ;0x00451a3c : f6450801
jne Label59370a ;0x00451a40 : 0f85c41c1400
mov ecx , esi ;0x00451a46 : 8bce
call Fun544742 ;0x00451a48 : e8f52c0f00
Label4a6bea ::
mov eax , dword ptr [ ebp + 8 ] ;0x004a6bea : 8b4508
test byte ptr ah , 02h ;0x004a6bed : f6c402
je Label593695 ;0x004a6bf0 : 0f849fca0e00
jmp Label420cda ;0x004a6bf6 : e9dfa0f7ff
Label4ac12f ::
test byte ptr [ ebp + 8 ] , 040h ;0x004ac12f : f6450840
je Label5936c8 ;0x004ac133 : 0f848f750e00
jmp Label420cda ;0x004ac139 : e99c4bf7ff
Label4f3372 ::
;
; -----------------------------------------------------------------------------------
; VFP 9.0 FIX - THE MESSAGE() FUNCTION RETURNS THE EXPRESSION ERROR MESSAGE
; April 2023
; -----------------------------------------------------------------------------------
; CCB
;
; The MESSAGE() function returns the expression error message.
;
; 2023/4/2, by ccb
;
cmp dword ptr vfpa_sys9129_data,00h
je Label4f3373
cmp edi,00h
je Label4f3373
mov dword ptr vfpa_expressionerrormessage_errornumber,edi
mov byte ptr vfpa_expressionerrormessage_errormessage,00h
mov byte ptr vfpa_expressionerrormessage_errorsource,00h
push 0FFh
lea eax,byte ptr vfpa_expressionerrormessage_errormessage
push eax
push dword ptr vfpa_expressionerrormessage_errornumber
call vfpa_geterrormessage
mov eax , dword ptr [ ebp - 070h ][00h]
cmp byte ptr [eax] , 0FCh
jne Label4f3373
mov eax , dword ptr [ Data9393ac ]
mov dword ptr [ ebp - 070h ][04h] , eax
mov eax , dword ptr [ ebp - 070h ][00h]
mov dword ptr [ Data9393ac ] , eax
lea ecx,byte ptr vfpa_expressionerrormessage_errorsource
mov edx , 01FFFh
push 01h
push edx
push ecx
call vfpa_geterrorsource
mov eax , dword ptr [ ebp - 070h ][04h]
mov dword ptr [ Data9393ac ] , eax
Label4f3373 ::
mov al , byte ptr [ ebp + 8 ] ;0x004f3372 : 8a4508
test al , al ;0x004f3375 : 84c0
js Label59362e ;0x004f3377 : 0f88b1020a00
jmp Label420c97 ;0x004f337d : e915d9f2ff
Label4f3382 ::
mov edx , dword ptr [ ebp - 12 ] ;0x004f3382 : 8b55f4
mov ecx , dword ptr [ Data93936c ] ;0x004f3385 : 8b0d6c939300
imul edx , edx , 02Ch ;0x004f338b : 6bd22c
add edx , ecx ;0x004f338e : 03d1
mov ecx , dword ptr [ Data9370f0 ] ;0x004f3390 : 8b0df0709300
cmp ecx , edx ;0x004f3396 : 3bca
Label4f3398 ::
jne Label420d32 ;0x004f3398 : 0f8594d9f2ff
add ecx , 02Ch ;0x004f339e : 83c12c
jmp Label420d32 ;0x004f33a1 : e98cd9f2ff
Label529526 ::
mov cl , byte ptr [eax] ;0x00529526 : 8a08
cmp cl , 04Fh ;0x00529528 : 80f94f
je Label53e0b5 ;0x0052952b : 0f84844b0100
cmp cl , 052h ;0x00529531 : 80f952
je Label53e0b5 ;0x00529534 : 0f847b4b0100
cmp dword ptr [ eax + 12 ] , 0FFFFFFFDh ;0x0052953a : 83780cfd
je Label53e0b5 ;0x0052953e : 0f84714b0100
mov ecx , dword ptr [ eax + 36 ] ;0x00529544 : 8b4824
mov dword ptr [ eax + 36 ] , ebx ;0x00529547 : 895824
call Fun43b3af ;0x0052954a : e8601ef1ff
mov eax , dword ptr [ Data9370f0 ] ;0x0052954f : a1f0709300
jmp Label53e0b5 ;0x00529554 : e95c4b0100
Label53e097 ::
mov eax , dword ptr [ Data9370f0 ] ;0x0053e097 : a1f0709300
cmp byte ptr [eax] , 048h ;0x0053e09c : 803848
je Label53e0ac ;0x0053e09f : 740b
mov ecx , dword ptr [ eax + 32 ] ;0x0053e0a1 : 8b4820
cmp ecx , ebx ;0x0053e0a4 : 3bcb
jne Label53e633 ;0x0053e0a6 : 0f8587050000
Label53e0ac ::
cmp dword ptr [ eax + 36 ] , ebx ;0x0053e0ac : 395824
jne Label529526 ;0x0053e0af : 0f8571b4feff
Label53e0b5 ::
add eax , 02Ch ;0x0053e0b5 : 83c02c
call Fun53dffd ;0x0053e0b8 : e840ffffff
jmp Label420cba ;0x0053e0bd : e9f82beeff
Label53e633 ::
call Fun42c1e2 ;0x0053e633 : e8aadbeeff
mov ecx , dword ptr [ Data9370f0 ] ;0x0053e638 : 8b0df0709300
mov dword ptr [ ecx + 32 ] , ebx ;0x0053e63e : 895920
mov eax , dword ptr [ Data9370f0 ] ;0x0053e641 : a1f0709300
jmp Label53e0ac ;0x0053e646 : e961faffff
Label5935fa ::
mov ecx , 0D2h ;0x005935fa : b9d2000000
call Fun544742 ;0x005935ff : e83e11fbff
Label593604 ::
test byte ptr [ Data936f10 ] , 01h ;0x00593604 : f605106f930001
je Label593624 ;0x0059360b : 7417
cmp edi , ebx ;0x0059360d : 3bfb
jne Label420c89 ;0x0059360f : 0f8574d6e8ff
mov dword ptr [ Data936f14 ] , 03E7h ;0x00593615 : c705146f9300e7030000
jmp Label420c89 ;0x0059361f : e965d6e8ff
Label593624 ::
mov ecx , 03E7h ;0x00593624 : b9e7030000
call Fun544742 ;0x00593629 : e81411fbff
Label59362e ::
mov eax , dword ptr [ Data9370f0 ] ;0x0059362e : a1f0709300
mov dword ptr [ ebp - 8 ] , eax ;0x00593633 : 8945f8
jmp Label420cda ;0x00593636 : e99fd6e8ff
Label59363b ::
mov eax , dword ptr [ ebp - 4 ] ;0x0059363b : 8b45fc
test al , 01h ;0x0059363e : a801
mov dword ptr [ Data936f10 ] , eax ;0x00593640 : a3106f9300
je Label593656 ;0x00593645 : 740f
mov dword ptr [ Data936f14 ] , 0386h ;0x00593647 : c705146f930086030000
jmp Label420cae ;0x00593651 : e958d6e8ff
Label593656 ::
mov ecx , 0386h ;0x00593656 : b986030000
call Fun544742 ;0x0059365b : e8e210fbff
Label593660 ::
test byte ptr [ ebp + 8 ] , 02h ;0x00593660 : f6450802
jne Label420cda ;0x00593664 : 0f8570d6e8ff
mov eax , ecx ;0x0059366a : 8bc1
call Label748407 ;0x0059366c : e8964d1b00
test byte ptr [ Data936f10 ] , 01h ;0x00593671 : f605106f930001
je Label5936c1 ;0x00593678 : 7447
cmp dword ptr [ Data936f14 ] , ebx ;0x0059367a : 391d146f9300
jne Label420cda ;0x00593680 : 0f8554d6e8ff
mov dword ptr [ Data936f14 ] , 012Eh ;0x00593686 : c705146f93002e010000
jmp Label420cda ;0x00593690 : e945d6e8ff
Label593695 ::
mov eax , ecx ;0x00593695 : 8bc1
mov dword ptr [ eax + 8 ] , ebx ;0x00593697 : 895808
test byte ptr [ Data936f10 ] , 01h ;0x0059369a : f605106f930001
mov byte ptr [ecx] , 04Ch ;0x005936a1 : c6014c
je Label5936c1 ;0x005936a4 : 741b
cmp dword ptr [ Data936f14 ] , ebx ;0x005936a6 : 391d146f9300
jne Label420cda ;0x005936ac : 0f8528d6e8ff
mov dword ptr [ Data936f14 ] , 012Eh ;0x005936b2 : c705146f93002e010000
jmp Label420cda ;0x005936bc : e919d6e8ff
Label5936c1 ::
mov ecx , 012Eh ;0x005936c1 : b92e010000
jmp Label5936f1 ;0x005936c6 : eb29
Label5936c8 ::
test byte ptr [ Data936f10 ] , 01h ;0x005936c8 : f605106f930001
je Label5936ec ;0x005936cf : 741b
cmp dword ptr [ Data936f14 ] , ebx ;0x005936d1 : 391d146f9300
jne Label420cda ;0x005936d7 : 0f85fdd5e8ff
mov dword ptr [ Data936f14 ] , 0390h ;0x005936dd : c705146f930090030000
jmp Label420cda ;0x005936e7 : e9eed5e8ff
Label5936ec ::
mov ecx , 0390h ;0x005936ec : b990030000
Label5936f1 ::
call Fun544742 ;0x005936f1 : e84c10fbff
Label5936f6 ::
mov ecx , 0Eh ;0x005936f6 : b90e000000
call Fun544742 ;0x005936fb : e84210fbff
Label593700 ::
mov ecx , 0Eh ;0x00593700 : b90e000000
call Fun544742 ;0x00593705 : e83810fbff
Label59370a ::
cmp dword ptr [ Data936f14 ] , ebx ;0x0059370a : 391d146f9300
jne Label420d11 ;0x00593710 : 0f85fbd5e8ff
mov dword ptr [ Data936f14 ] , esi ;0x00593716 : 8935146f9300
jmp Label420d11 ;0x0059371c : e9f0d5e8ff
Label593721 ::
mov eax , dword ptr [ ebp - 12 ] ;0x00593721 : 8b45f4
mov esi , dword ptr [ Data93936c ] ;0x00593724 : 8b356c939300
imul eax , eax , 02Ch ;0x0059372a : 6bc02c
add eax , esi ;0x0059372d : 03c6
cmp ecx , eax ;0x0059372f : 3bc8
jmp Label4f3398 ;0x00593731 : e962fcf5ff
4. APPLIES TO:
VFP 10 (VFP Advanced)
5. REFERENCE WEBSITES:
1, baiyujia.com:
http://www.baiyujia.com
http://www.baiyujia.com/vfpdocuments/f_vfp9fix263.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix253.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix254.asp
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|