------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - CLOSE THE FILE HANDLE _TEXT BEFORE ENTER THE ON ERROR ROUTINE
                                 January 2024
                 ------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9, vfp will close the file handle _TEXT before enter the ON ERROR routine.

     The bug only occurs in vfp9, it does not occur in vfp6, vfp7 and vfp8.

     The bug was reported by Mrs Martina Jindrova.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label58cd3f ::


     ;
     ;                 -------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - CLOSE THE FILE HANDLE _TEXT BEFORE ENTER THE ON ERROR ROUTINE
     ;                                  August 2019
     ;                 -------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Close the file handle _TEXT before enter the ON ERROR routine.
     ;
     ; 2019/8/17, by ccb
     ;

             cmp dword ptr vfpa_sys9023_data,00h
             je Label4cecb3


             mov esi , eax                                                   ;0x0058cd3f :        8bf0
             push esi                                                        ;0x0058cd41 :        56
             call Fun45340a                                                  ;0x0058cd42 :        e8c366ecff
             test eax , eax                                                  ;0x0058cd47 :        85c0
             je Label58cd52                                                  ;0x0058cd49 :        7407
             mov ecx , esi                                                   ;0x0058cd4b :        8bce
             call Fun42ddf2                                                  ;0x0058cd4d :        e8a010eaff

     Label58cd52 ::
             mov  dword ptr [ Data9382c0 ] , 0FFFFFFFFh                      ;0x0058cd52 :        c705c0829300ffffffff
             xor esi , esi                                                   ;0x0058cd5c :        33f6
             jmp Label4cecb3                                                 ;0x0058cd5e :        e9501ff4ff


4. APPLIES TO:

     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_vfp9fix87.asp


6. OTHER:

     For reference only, there is no guarantees.

     Any questions or suggestions, please send me an email at ccb2000@163.com.