-------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - READ DATA FROM THE FILE IN AN EXECUTABLE FILE WHEN END-OF-FILE
                                 January 2024
                 -------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp6, vfp7, vfp8, VFP 9.0.0.2412 and VFP 9.0.0.3504 (SP1), vfp will read data from the file in an executable file when end-of-file.

     In VFP 9.0.0.4611 (SP2) and later, vfp will not read data from the file in an executable file when end-of-file.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label43e445 ::
             mov  eax , dword ptr [ ebx + 48 ]                               ;0x0043e445 :        8b4330
             test eax , eax                                                  ;0x0043e448 :        85c0
             je Label42d17e                                                  ;0x0043e44a :        0f842eedfeff


     ;
     ;                 --------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - READ DATA FROM THE FILE IN AN EXECUTABLE FILE WHEN END-OF-FILE
     ;                                  August 2019
     ;                 --------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Read data from the file in an executable file when end-of-file.
     ;
     ; 2019/8/21, by ccb
     ;

             cmp dword ptr vfpa_sys9024_data,00h
             jne Label42d17e


             mov  ecx , dword ptr [ ebx + 4 ]                                ;0x0043e450 :        8b4b04
             mov  eax , dword ptr [ebx]                                      ;0x0043e453 :        8b03
             lea edx ,  dword ptr [ ecx + ebp ]                              ;0x0043e455 :        8d1429
             cmp edx , eax                                                   ;0x0043e458 :        3bd0
             jg Label56e42d                                                  ;0x0043e45a :        0f8fcdff1200
             jmp Label42d17e                                                 ;0x0043e460 :        e919edfeff


4. APPLIES TO:

     VFP 6.0.8167.0
     VFP 6.0.8961.0 (SP5)

     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)

     The bug has been fixed in VFP Advanced.


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix89.asp


6. OTHER:

     For reference only, there is no guarantees.

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