-------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - THE NUMBER OF TIMES TO TRY AGAIN AFTER REMOVE DIRECTORY FAILED
                                 January 2024
                 -------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

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


2. CAUSE:

     There are some compatible problems when the RMDIR (or RD) command calls the _rmdir Windows API
     for the Windows Defender program or the antivirus programs.
     Now if the RMDIR (or RD) command calls the _rmdir Windows API failed,
     it will call the _rmdir Windows API many times again.

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label75fcb2 ::
             call Fun42c1e2                                                  ;0x0075fcb2 :        e82bc5ccff


     ;
     ;                 --------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE NUMBER OF TIMES TO TRY AGAIN AFTER REMOVE DIRECTORY FAILED
     ;                                  March 2019
     ;                 --------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; The number of times to try again after remove directory failed.
     ;
     ; 2019/3/6, by ccb
     ;

     ;         lea eax ,  dword ptr [ esp + 16 ]                               ;0x0075fcb7 :        8d442410
     ;         push eax                                                        ;0x0075fcbb :        50
     ;         call  _rmdir                                      ;0x0075fcbc :        ff1524799100
     ;         add esp , 04h                                                   ;0x0075fcc2 :        83c404
     ;         call Label42d319                                                ;0x0075fcc5 :        e84fd6ccff

             mov dword ptr vfpa_rmdir_rmdir_cnt,00h

     Label75fcb7 ::
             lea eax ,  dword ptr [ esp + 16 ]
             push eax
             call  _rmdir
             add esp , 04h
             call Label42d319
             test eax , eax
             je Label75fcca
             cmp eax , 078h
             je Label75fcca
             mov ecx,dword ptr vfpa_sys9017_data
             inc dword ptr vfpa_rmdir_rmdir_cnt
             cmp dword ptr vfpa_rmdir_rmdir_cnt,ecx
             ja Label75fcca
             push dword ptr vfpa_sys9074_data
             call  Sleep
             jmp Label75fcb7


     Label75fcca ::
             cmp eax , 078h                                                  ;0x0075fcca :        83f878
             jne Label75fcd6                                                 ;0x0075fccd :        7507
             mov eax , 03C3h                                                 ;0x0075fccf :        b8c3030000
             jmp Label75fcda                                                 ;0x0075fcd4 :        eb04

     Label75fcd6 ::
             test eax , eax                                                  ;0x0075fcd6 :        85c0
             je Label75fce1                                                  ;0x0075fcd8 :        7407

     Label75fcda ::
             mov ecx , eax                                                   ;0x0075fcda :        8bc8
             call Fun544742                                                  ;0x0075fcdc :        e8614adeff

     Label75fce1 ::
             mov  ecx , dword ptr [ esp + 011Ch ]                            ;0x0075fce1 :        8b8c241c010000
             call Fun42bf1d                                                  ;0x0075fce8 :        e830c2ccff
             pop edi                                                         ;0x0075fced :        5f
             pop esi                                                         ;0x0075fcee :        5e
             mov esp , ebp                                                   ;0x0075fcef :        8be5
             pop ebp                                                         ;0x0075fcf1 :        5d
             ret                                                             ;0x0075fcf2 :        c3


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_vfp9fix73.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_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
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix350.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix351.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.