------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - ASTACKINFO() Function
January 2026
------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp7, vfp8), the ASTACKINFO() function can not return the call stack information for the ON statements,
for example, ON ERROR, ON KEY LABEL, ON SELECTION, etc.
The bug occurs in the following commands:
ON BAR command
ON ERROR command
ON ESCAPE command
ON EXIT BAR command
ON EXIT MENU command
ON EXIT PAD command
ON EXIT POPUP command
ON KEY command
ON KEY LABEL command
ON PAD command
ON PAGE command
ON READERROR command
ON SELECTION BAR command
ON SELECTION MENU command
ON SELECTION PAD command
ON SELECTION POPUP command
ON SHUTDOWN command
The bug was reported by Tomas Tamm.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Label65a785 ::
;
; -------------------------------------------------
; VFP 9.0 FIX - ASTACKINFO() Function
; November 2017
; -------------------------------------------------
; CCB
;
; Returns the call stack information for the ON statements (ON ERROR, ON KEY LABEL, ON SELECTION, etc.).
;
; 2017/11/29, by ccb
;
cmp dword ptr vfpa_sys9111_data,00h
je Label65a786
cmp dword ptr vfpa_sys9111_data,02h
je Label65a78f
test byte ptr [ ebx + 28 ] , 08h
jne Label65aaf3
test byte ptr [ ebx + 28 ] , 02h
je Label65a78f
mov eax , dword ptr [ebx]
mov eax , dword ptr [eax]
cmp byte ptr [ eax + 18 ] , 015h
je Label65aaf3
jmp Label65a78f
Label65a786 ::
test byte ptr [ ebx + 28 ] , 0Ah ;0x0065a785 : f6431c0a
jne Label65aaf3 ;0x0065a789 : 0f8564030000
Label65a78f ::
cmp ebx , dword ptr [ Data9370e8 ] ;0x0065a78f : 3b1de8709300
jne Label65a79c ;0x0065a795 : 7505
mov ebx , offset Data93e6f0 ;0x0065a797 : bbf0e69300
Label65a79c ::
inc dword ptr [ ebp + 0FFFFFD24h ] ;0x0065a79c : ff8524fdffff
mov eax , dword ptr [ ebp + 0FFFFFD24h ] ;0x0065a7a2 : 8b8524fdffff
inc dword ptr [ ebp + 0FFFFFD08h ] ;0x0065a7a8 : ff8508fdffff
push esi ;0x0065a7ae : 56
lea edx , dword ptr [ ebp + 0FFFFFCFCh ] ;0x0065a7af : 8d95fcfcffff
lea ecx , dword ptr [ ebp + 0FFFFFF48h ] ;0x0065a7b5 : 8d8d48ffffff
mov byte ptr [ ebp + 0FFFFFF48h ] , 049h ;0x0065a7bb : c68548ffffff49
mov dword ptr [ ebp + 0FFFFFF4Ch ] , 0Ah ;0x0065a7c2 : c7854cffffff0a000000
mov dword ptr [ ebp + 0FFFFFF54h ] , eax ;0x0065a7cc : 898554ffffff
call Fun52bf26 ;0x0065a7d2 : e84f17edff
mov eax , dword ptr [ebx] ;0x0065a7d7 : 8b03
lea edx , dword ptr [ ebp + 0FFFFFD34h ] ;0x0065a7d9 : 8d9534fdffff
call Fun527b20 ;0x0065a7df : e83cd3ecff
lea eax , dword ptr [ ebp + 0FFFFFD34h ] ;0x0065a7e4 : 8d8534fdffff
mov dword ptr [ ebp + 0FFFFFF4Ch ] , esi ;0x0065a7ea : 89b54cffffff
mov byte ptr [ ebp + 0FFFFFF48h ] , 048h ;0x0065a7f0 : c68548ffffff48
lea esi , dword ptr [ eax + 1 ] ;0x0065a7f7 : 8d7001
Label65a7fa ::
mov cl , byte ptr [eax] ;0x0065a7fa : 8a08
inc eax ;0x0065a7fc : 40
test cl , cl ;0x0065a7fd : 84c9
jne Label65a7fa ;0x0065a7ff : 75f9
sub eax , esi ;0x0065a801 : 2bc6
pushd 07h ;0x0065a803 : 6a07
mov dword ptr [ ebp + 0FFFFFF50h ] , eax ;0x0065a805 : 898550ffffff
call Fun42bf2a ;0x0065a80b : e81a17ddff
mov ecx , dword ptr [ ebp + 0FFFFFF50h ] ;0x0065a810 : 8b8d50ffffff
mov dword ptr [ ebp + 0FFFFFF68h ] , eax ;0x0065a816 : 898568ffffff
mov edi , dword ptr [eax] ;0x0065a81c : 8b38
mov eax , ecx ;0x0065a81e : 8bc1
shr ecx , 02h ;0x0065a820 : c1e902
lea esi , dword ptr [ ebp + 0FFFFFD34h ] ;0x0065a823 : 8db534fdffff
rep movsd ;0x0065a829 : f3a5
mov ecx , eax ;0x0065a82b : 8bc8
and ecx , 03h ;0x0065a82d : 83e103
rep movsb ;0x0065a830 : f3a4
inc dword ptr [ ebp + 0FFFFFD08h ] ;0x0065a832 : ff8508fdffff
xor edi , edi ;0x0065a838 : 33ff
push edi ;0x0065a83a : 57
lea edx , dword ptr [ ebp + 0FFFFFCFCh ] ;0x0065a83b : 8d95fcfcffff
lea ecx , dword ptr [ ebp + 0FFFFFF48h ] ;0x0065a841 : 8d8d48ffffff
call Fun52bf26 ;0x0065a847 : e8da16edff
mov ecx , dword ptr [ ebp + 0FFFFFF68h ] ;0x0065a84c : 8b8d68ffffff
call Fun42c1e2 ;0x0065a852 : e88b19ddff
mov ecx , dword ptr [ ebp + 0FFFFFD20h ] ;0x0065a857 : 8b8d20fdffff
mov eax , dword ptr [ ecx + 40 ] ;0x0065a85d : 8b4128
cmp eax , edi ;0x0065a860 : 3bc7
je Label65a878 ;0x0065a862 : 7414
mov esi , dword ptr [ ecx + 44 ] ;0x0065a864 : 8b712c
xor ecx , ecx ;0x0065a867 : 33c9
cmp eax , esi ;0x0065a869 : 3bc6
setne cl ;0x0065a86b : 0f95c1
push ecx ;0x0065a86e : 51
push ebx ;0x0065a86f : 53
push esi ;0x0065a870 : 56
call Fun4e3f39 ;0x0065a871 : e8c396e8ff
jmp Label65a883 ;0x0065a876 : eb0b
4. APPLIES TO:
VFP 7.0.0.9262
VFP 7.0.0.9465 (SP1)
VFP 8.0.0.2521
VFP 8.0.0.3117 (SP1)
VFP 9.0.0.2412
VFP 9.0.0.3504 (SP1)
VFP 9.0.0.4611 (SP2)
VFP 9.0.0.5015 (SP2)
VFP 9.0.0.5411 (SP2)
VFP 9.0.0.5721 (SP2)
VFP 9.0.0.5815 (SP2)
VFP 9.0.0.6303 (SP2)
VFP 9.0.0.6602 (SP2)
VFP 9.0.0.7423 (SP2)
The bug has been fixed in VFP Advanced.
5. REFERENCE WEBSITES:
1, baiyujia.com:
http://www.baiyujia.com
http://www.baiyujia.com/vfpdocuments/f_vfp9fix229.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix239.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix240.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix376.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix377.asp
2, foxite.com:
https://www.foxite.com/archives/astackinfo-wrong-intermittently-0000398512.htm
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|