--------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - THE NUMBER OF TIMES TO TRY AGAIN AFTER CREATE TABLE FILE FAILED
                                September 2024
                 --------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), somtimes the CREATE TABLE command runs failed on Windows Vista or later.


2. CAUSE:

     There are some compatible problems when the CREATE TABLE command calls the CreateFileA Windows API
     for the Windows Defender program or the antivirus programs.
     Now if the CREATE TABLE command calls the CreateFileA Windows API failed,
     it will call the CreateFileA Windows API many times again.

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label52b12c ::
             lea eax ,  dword ptr [ ebp + 08B4h ]                            ;0x0052b12c :        8d85b4080000
             push eax                                                        ;0x0052b132 :        50
             xor edi , edi                                                   ;0x0052b133 :        33ff
             mov ebx , offset Data919ea0                                              ;0x0052b135 :        bba09e9100
             call Fun52a205                                                  ;0x0052b13a :        e8c6f0ffff
             test eax , eax                                                  ;0x0052b13f :        85c0
             jl Label52b14c                                                  ;0x0052b141 :        7c09
             cmp eax , 02h                                                   ;0x0052b143 :        83f802
             jle Label5e4dd7                                                 ;0x0052b146 :        0f8e8b9c0b00

     Label52b14c ::
             lea eax ,  dword ptr [ ebp + 08B4h ]                            ;0x0052b14c :        8d85b4080000
             push eax                                                        ;0x0052b152 :        50
             call Fun52b1a8                                                  ;0x0052b153 :        e850000000
             test eax , eax                                                  ;0x0052b158 :        85c0
             jne Label5e4dfe                                                 ;0x0052b15a :        0f859e9c0b00
             lea eax ,  dword ptr [ ebp + 09BCh ]                            ;0x0052b160 :        8d85bc090000
             call Fun52b0e4                                                  ;0x0052b166 :        e879ffffff
             mov ebx , eax                                                   ;0x0052b16b :        8bd8
             test ebx , ebx                                                  ;0x0052b16d :        85db
             mov  dword ptr [ ebp + 44 ] , ebx                               ;0x0052b16f :        895d2c
             jne Label5e4e0a                                                 ;0x0052b172 :        0f85929c0b00

     Label52b178 ::


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE NUMBER OF TIMES TO TRY AGAIN AFTER CREATE TABLE FILE FAILED
     ;                                September 2024
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; The number of times to try again after create table file (the CREATE TABLE command) failed.
     ;
     ; 2024/9/19, by ccb
     ;

             mov dword ptr vfpa_createtablefile_iscreatetablefile,01h


             xor ecx , ecx                                                   ;0x0052b178 :        33c9
             lea edx ,  dword ptr [ ebp + 08B4h ]                            ;0x0052b17a :        8d95b4080000
             call Fun52a2ee                                                  ;0x0052b180 :        e869f1ffff


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE NUMBER OF TIMES TO TRY AGAIN AFTER CREATE TABLE FILE FAILED
     ;                                September 2024
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; The number of times to try again after create table file (the CREATE TABLE command) failed.
     ;
     ; 2024/9/19, by ccb
     ;

     Label52b184 ::
             mov dword ptr vfpa_createtablefile_iscreatetablefile,00h


     Label52b185 ::
             test eax , eax                                                  ;0x0052b185 :        85c0
             jne Label5e4e44                                                 ;0x0052b187 :        0f85b79c0b00
             pushd 01h                                                       ;0x0052b18d :        6a01
             lea eax ,  dword ptr [ ebp + 08B4h ]                            ;0x0052b18f :        8d85b4080000
             push eax                                                        ;0x0052b195 :        50
             call Fun52a2da                                                  ;0x0052b196 :        e83ff1ffff
             test eax , eax                                                  ;0x0052b19b :        85c0
             je Label5310f6                                                  ;0x0052b19d :        0f84535f0000
             jmp Label530fc9                                                 ;0x0052b1a3 :        e9215e0000


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)
     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_vfp9fix350.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix65.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix66.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix67.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix68.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix69.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix70.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix71.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix72.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix73.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix74.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix84.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix85.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix107.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix108.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix109.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix110.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix143.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix144.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix145.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix146.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix147.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix148.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix149.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix150.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix203.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix261.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix262.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix269.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix270.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix278.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix279.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix348.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix349.asp

     2, microsoft.com:
     https://devblogs.microsoft.com/oldnewthing/20120907-00/?p=6663


6. OTHER:

     For reference only, there is no guarantees.

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