--------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - CONVERT INVALID CHARACTERS TO UPPERCASE FOR THE TEXTBOX CONTROL
                                 February 2021
                 --------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In VFP 9.0 and earlier versions, if we set TextBox.Format = "!" (converts alphabetic characters to uppercase),
     when we press an invalid character (for example, a Function key),
     it will be converted to a rare character (CHR(159)).

     There is the bug for the TextBox control, the ComboBox control, the Column control and the @ ... GET command.
     There is no the bug for the EditBox control.

     The bug was reported by Francisco Prieto.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label5dbef8 ::
             mov  al , byte ptr [ ebx + 8 ]                                  ;0x005dbef8 :        8a4308
             cmp al , 043h                                                   ;0x005dbefb :        3c43
             mov esi , 0103h                                                 ;0x005dbefd :        be03010000
             jne Label5dbf31                                                 ;0x005dbf02 :        752d
             mov  eax , dword ptr [ ebx + 0B4h ]                             ;0x005dbf04 :        8b83b4000000
             test al , 040h                                                  ;0x005dbf0a :        a840
             je Label5dbf1b                                                  ;0x005dbf0c :        740d


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - CONVERT INVALID CHARACTERS TO UPPERCASE FOR THE TEXTBOX CONTROL
     ;                                February 2021
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Convert invalid characters to uppercase for the TextBox control.
     ;
     ; 2021/2/15, by ccb
     ;

             cmp dword ptr vfpa_sys9052_data,00h
             jne Label5dbf0e
             cmp ecx , 07FFFh
             jne Label5dbf0e
             jmp Label5dbf1b


     Label5dbf0e ::
             movzx ecx , cl                                                  ;0x005dbf0e :        0fb6c9
             movzx ecx ,byte ptr [ ecx + offset Data9375a0 ]                          ;0x005dbf11 :        0fb689a0759300
             mov  dword ptr [ ebp - 84 ] , ecx                               ;0x005dbf18 :        894dac

     Label5dbf1b ::
             test al , 020h                                                  ;0x005dbf1b :        a820
             je Label5dbf31                                                  ;0x005dbf1d :        7412
             movzx eax , cl                                                  ;0x005dbf1f :        0fb6c1
             test  word ptr [ 2 * eax + offset Data937360 ] , si                      ;0x005dbf22 :        6685344560739300
             jne Label5dbf31                                                 ;0x005dbf2a :        7505
             mov ecx , edi                                                   ;0x005dbf2c :        8bcf
             mov  dword ptr [ ebp - 84 ] , ecx                               ;0x005dbf2e :        894dac

     Label5dbf31 ::
             xor eax , eax                                                   ;0x005dbf31 :        33c0
             cmp  byte ptr [ ebp + 01F7h ] , 07h                             ;0x005dbf33 :        80bdf701000007
             sete al                                                         ;0x005dbf3a :        0f94c0
             mov  dword ptr [ ebp - 100 ] , eax                              ;0x005dbf3d :        89459c
             movzx eax ,byte ptr [ ebp + 01F7h ]                             ;0x005dbf40 :        0fb685f7010000
             cmp eax , 048h                                                  ;0x005dbf47 :        83f848
             jg Label5dc181                                                  ;0x005dbf4a :        0f8f31020000
             je Label5dc174                                                  ;0x005dbf50 :        0f841e020000
             cmp eax , 05h                                                   ;0x005dbf56 :        83f805
             je Label5dc22e                                                  ;0x005dbf59 :        0f84cf020000
             cmp eax , 021h                                                  ;0x005dbf5f :        83f821
             je Label5dc164                                                  ;0x005dbf62 :        0f84fc010000
             cmp eax , 022h                                                  ;0x005dbf68 :        83f822
             jle Label5dc23a                                                 ;0x005dbf6b :        0f8ec9020000
             cmp eax , 024h                                                  ;0x005dbf71 :        83f824
             jle Label5dbfbc                                                 ;0x005dbf74 :        7e46
             cmp eax , 02Ah                                                  ;0x005dbf76 :        83f82a
             je Label5dbfbc                                                  ;0x005dbf79 :        7441
             cmp eax , 039h                                                  ;0x005dbf7b :        83f839
             je Label5dbf99                                                  ;0x005dbf7e :        7419
             cmp eax , 041h                                                  ;0x005dbf80 :        83f841
             jne Label5dc23a                                                 ;0x005dbf83 :        0f85b1020000
             movzx eax , cl                                                  ;0x005dbf89 :        0fb6c1
             test  word ptr [ 2 * eax + offset Data937360 ] , si                      ;0x005dbf8c :        6685344560739300
             jmp Label5dc238                                                 ;0x005dbf94 :        e99f020000


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


6. OTHER:

     For reference only, there is no guarantees.

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