-------------------------------------------------
                        VFP 9.0 FIX - ASTACKINFO() Function
                                 January 2018
                 -------------------------------------------------
                                    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 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
     ;

     ;         test  byte ptr [ ebx + 28 ] , 0Ah                               ;0x0065a785 :        f6431c0a
     ;         jne Label65aaf3                                                 ;0x0065a789 :        0f8564030000


             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


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

     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.