---------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - FIX THE FILE NAME SEPARATED BY COMMAS IN THE DELETE FILE COMMAND
                                  January 2024
                 ---------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In VFP 9.0 and earlier versions, when we run the code:
     DELETE FILE *,TMP (or ERASE *,TMP)
     it will delete all files (*)!!!

     In VFP 9.0 and earlier versions, when we compile the code:
     COMPILE *,tmp
     COPY FILE *,tmp TO *,tm2
     DIR *,tmp
     DISPLAY FILES *,tmp
     LIST FILES *,tmp
     MODIFY COMMAND *,tmp
     MODIFY FILE *,tmp
     RENAME *,tmp TO *,tm2
     REMOVE TABLE *,tmp
     it will cause the error "Command contains unrecognized phrase/keyword (Error 36)",
     the code will not run.

     There is the bug for the DELETE FILE command, the ERASE command and the DROP TABLE command.
     There is no the bug for other commands that support wildcards.

     The bug was reported by Rajesh Samadia.


2. CAUSE:

     In VFP 9.0 and earlier versions, the code:
     DELETE FILE *,TMP (or ERASE *,TMP)
     will be compiled to:
     DELETE FILE * (or ERASE *)
     so it will delete all files (*)!!!

     In VFP Advanced,
     when we compile the code:
     DELETE FILE *,TMP
     ERASE *,TMP
     DROP TABLE *,TMP
     it will cause the error "Command contains unrecognized phrase/keyword (Error 36)",
     the code will not run.

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun43d764 :: ; proc near
             sub esp , 010h                                                  ;0x0043d764 :        83ec10
             push ebx                                                        ;0x0043d767 :        53
             push ebp                                                        ;0x0043d768 :        55
             push esi                                                        ;0x0043d769 :        56
             mov esi , ecx                                                   ;0x0043d76a :        8bf1
             lea edx ,  dword ptr [ esi + 40 ]                               ;0x0043d76c :        8d5628
             xor ebp , ebp                                                   ;0x0043d76f :        33ed
             push edi                                                        ;0x0043d771 :        57


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE FILE NAME SEPARATED BY COMMAS IN THE DELETE FILE COMMAND
     ;                                February 2021
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Fix the file name separated by commas in the DELETE FILE command.
     ;
     ; 2021/2/10, by ccb
     ;

             mov dword ptr vfpa_compiledeletefile_commas_cnt,00h


             mov edi , eax                                                   ;0x0043d772 :        8bf8
             mov  byte ptr [ esp + 19 ] , 00h                                ;0x0043d774 :        c644241300
             mov  dword ptr [ esp + 20 ] , ebp                               ;0x0043d779 :        896c2414
             mov  dword ptr [ esp + 24 ] , edx                               ;0x0043d77d :        89542418
             mov  byte ptr [edx] , 00h                                       ;0x0043d781 :        c60200

     Label43d784 ::
             mov  ecx , dword ptr [ esi + 32 ]                               ;0x0043d784 :        8b4e20
             mov  al , byte ptr [ecx]                                        ;0x0043d787 :        8a01
             cmp al , 020h                                                   ;0x0043d789 :        3c20
             je Label43d8d0                                                  ;0x0043d78b :        0f843f010000
             cmp al , 09h                                                    ;0x0043d791 :        3c09
             je Label43d8d0                                                  ;0x0043d793 :        0f8437010000
             mov  eax , dword ptr [ esi + 32 ]                               ;0x0043d799 :        8b4620
             mov  bl , byte ptr [eax]                                        ;0x0043d79c :        8a18
             movzx ecx , bl                                                  ;0x0043d79e :        0fb6cb
             cmp ecx , 05Bh                                                  ;0x0043d7a1 :        83f95b
             ja Label43d7b4                                                  ;0x0043d7a4 :        770e
             movzx ecx ,byte ptr [ ecx + offset Data415294 ]                          ;0x0043d7a6 :        0fb68994524100
             jmp  dword ptr [ 4 * ecx + offset DataPtr43d754 ]                           ;0x0043d7ad :        ff248d54d74300

     Label43d7b4 ::
             mov  byte ptr [ esp + 18 ] , 020h                               ;0x0043d7b4 :        c644241220

     Label43d7b9 ::
             mov  al , byte ptr [ esp + 18 ]                                 ;0x0043d7b9 :        8a442412
             cmp bl , al                                                     ;0x0043d7bd :        3ad8
             movzx ecx , al                                                  ;0x0043d7bf :        0fb6c8
             mov  dword ptr [ esi + 4 ] , ecx                                ;0x0043d7c2 :        894e04
             je Label43d861                                                  ;0x0043d7c5 :        0f8496000000
             mov  cl , byte ptr [ Data93b8c0 ]                               ;0x0043d7cb :        8a0dc0b89300
             jmp Label43d807                                                 ;0x0043d7d1 :        eb34

     Label43d7d3 ::


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE FILE NAME SEPARATED BY COMMAS IN THE DELETE FILE COMMAND
     ;                                February 2021
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Fix the file name separated by commas in the DELETE FILE command.
     ;
     ; 2021/2/10, by ccb
     ;

             cmp dword ptr vfpa_sys9051_data,00h
             je Label43d7d6
             cmp dword ptr [ esp + 20h ] , offset Label54a0e5 ;; Fun54a07d .. ; proc near
             jne Label43d7d6
             cmp dword ptr [ esp + 20h + (4+00h+14Ch) ] , offset Label45365d ;; Label4535fc ..
             je Label43d7d4
             cmp dword ptr [ esp + 20h + (4+00h+14Ch) ] , offset Label46348c ;; Label46347a ..
             je Label43d7d4
             jmp Label43d7d6
     Label43d7d4 ::
             cmp byte ptr [ Data93e720 ] , 20h
             je Label43d7d5
             cmp byte ptr [ Data93e720 ] , 14h
             jne Label43d7d6
             test edi , edi
             je Label43d7d6
             cmp byte ptr [ edi-1 ] , 12h
             jne Label43d7d6
             jmp Label43d7d5
     Label43d7d5 ::
             cmp bl , 02Ch
             jne Label43d7d8
             inc dword ptr vfpa_compiledeletefile_commas_cnt
             jmp Label43d7d8


     Label43d7d6 ::
             cmp bl , 02Ch                                                   ;0x0043d7d3 :        80fb2c
             je Label43d837                                                  ;0x0043d7d6 :        745f

     Label43d7d8 ::
             cmp bl , 09h                                                    ;0x0043d7d8 :        80fb09
             je Label45e161                                                  ;0x0043d7db :        0f8480090200
             cmp bl , 022h                                                   ;0x0043d7e1 :        80fb22
             je Label45f746                                                  ;0x0043d7e4 :        0f845c1f0200

     Label43d7ea ::
             mov  eax , dword ptr [ esp + 20 ]                               ;0x0043d7ea :        8b442414
             mov  byte ptr [edx] , bl                                        ;0x0043d7ee :        881a
             mov  ebx , dword ptr [ esi + 32 ]                               ;0x0043d7f0 :        8b5e20
             inc edx                                                         ;0x0043d7f3 :        42
             inc eax                                                         ;0x0043d7f4 :        40
             inc ebx                                                         ;0x0043d7f5 :        43
             mov  dword ptr [ esp + 20 ] , eax                               ;0x0043d7f6 :        89442414
             mov eax , ebx                                                   ;0x0043d7fa :        8bc3
             mov  dword ptr [ esi + 32 ] , ebx                               ;0x0043d7fc :        895e20
             mov  bl , byte ptr [eax]                                        ;0x0043d7ff :        8a18
             cmp  bl , byte ptr [ esp + 18 ]                                 ;0x0043d801 :        3a5c2412
             je Label43d83c                                                  ;0x0043d805 :        7435

     Label43d807 ::
             cmp bl , 0Ah                                                    ;0x0043d807 :        80fb0a
             je Label43d83c                                                  ;0x0043d80a :        7430
             test bl , bl                                                    ;0x0043d80c :        84db
             je Label43d83c                                                  ;0x0043d80e :        742c
             cmp  dword ptr [ esp + 20 ] , 0FFh                              ;0x0043d810 :        817c2414ff000000
             jnb Label5d9bd3                                                 ;0x0043d818 :        0f83b5c31900

     Label43d81e ::
             cmp  byte ptr [ esp + 18 ] , 020h                               ;0x0043d81e :        807c241220
             jne Label4153a3                                                 ;0x0043d823 :        0f857a7bfdff
             test cl , cl                                                    ;0x0043d829 :        84c9
             je Label43d7d3                                                  ;0x0043d82b :        74a6
             cmp bl , cl                                                     ;0x0043d82d :        3ad9
             je Label5d9c21                                                  ;0x0043d82f :        0f84ecc31900
             jmp Label43d7d3                                                 ;0x0043d835 :        eb9c

     Label43d837 ::
             mov  byte ptr [ esp + 18 ] , 02Ch                               ;0x0043d837 :        c64424122c

     Label43d83c ::
             mov  al , byte ptr [ esp + 19 ]                                 ;0x0043d83c :        8a442413
             test al , al                                                    ;0x0043d840 :        84c0
             jne Label5d9c28                                                 ;0x0043d842 :        0f85e0c31900

     Label43d848 ::
             mov  al , byte ptr [ esp + 18 ]                                 ;0x0043d848 :        8a442412
             cmp bl , al                                                     ;0x0043d84c :        3ad8
             je Label43d861                                                  ;0x0043d84e :        7411
             cmp al , 020h                                                   ;0x0043d850 :        3c20
             jne Label5d9c39                                                 ;0x0043d852 :        0f85e1c31900
             cmp bl , 0Ah                                                    ;0x0043d858 :        80fb0a
             jne Label5d9c31                                                 ;0x0043d85b :        0f85d0c31900

     Label43d861 ::
             cmp bl , 0Ah                                                    ;0x0043d861 :        80fb0a
             mov  byte ptr [edx] , 00h                                       ;0x0043d864 :        c60200
             jne Label4152f0                                                 ;0x0043d867 :        0f85837afdff

     Label43d86d ::
             test edi , edi                                                  ;0x0043d86d :        85ff
             mov  eax , dword ptr [ esp + 20 ]                               ;0x0043d86f :        8b442414
             mov  byte ptr [ esi + 1 ] , al                                  ;0x0043d873 :        884601
             mov  byte ptr [esi] , 02h                                       ;0x0043d876 :        c60602
             jne Label54a245                                                 ;0x0043d879 :        0f85c6c91000

     Label43d87f ::
             pop edi                                                         ;0x0043d87f :        5f
             pop esi                                                         ;0x0043d880 :        5e
             pop ebp                                                         ;0x0043d881 :        5d
             xor eax , eax                                                   ;0x0043d882 :        33c0


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE FILE NAME SEPARATED BY COMMAS IN THE DELETE FILE COMMAND
     ;                                February 2021
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Fix the file name separated by commas in the DELETE FILE command.
     ;
     ; 2021/2/10, by ccb
     ;

             cmp dword ptr vfpa_sys9051_data,00h
             je Label43d884
             cmp dword ptr vfpa_compiledeletefile_commas_cnt,00h
             je Label43d884
             mov eax,0FFFFFF25h


     Label43d884 ::
             pop ebx                                                         ;0x0043d884 :        5b
             add esp , 010h                                                  ;0x0043d885 :        83c410
             ret                                                             ;0x0043d888 :        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_vfp9fix153.asp

     2, foxite.com:
     https://www.foxite.com/archives/erase-causing-blunder-0000480090.htm


6. OTHER:

     For reference only, there is no guarantees.

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