---------------------------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - INPUT SOME CONTROL CHARACTERS IN EDITOR WHEN THE VISUAL FOXPRO DEBUGGER IS RUNNING
                                 January 2025
                 ---------------------------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), when the Visual FoxPro Debugger is not running in a separate frame,
     we can input the following control characters in Editor, the Command window and the EditBox control:
     CTRL+H
     CTRL+K
     CTRL+T
     CTRL+Y

     In vfp9 (and vfp6, vfp7, vfp8), when the Visual FoxPro Debugger is running in a separate frame,
     we can input the following control characters in Editor, the Command window and the EditBox control:
     CTRL+C
     CTRL+H
     CTRL+K
     CTRL+R
     CTRL+S
     CTRL+T
     CTRL+U
     CTRL+X
     CTRL+Y
     CTRL+Z
     there are some differences.

     The bug only occurs when the Visual FoxPro Debugger is running in a separate frame (Tools --> Options --> Debug --> Environment: Debug Frame),
     it does not occur when the Visual FoxPro Debugger is running in the main Visual FoxPro frame (Tools --> Options --> Debug --> Environment: FoxPro Frame).

     In Visual FoxPro Advanced, when the Visual FoxPro Debugger is not running in a separate frame,
     we can input the following control characters in Editor, the Command window and the EditBox control:
     CTRL+H
     CTRL+K
     CTRL+T
     CTRL+Y

     In Visual FoxPro Advanced, when the Visual FoxPro Debugger is running in a separate frame,
     we can input the following control characters in Editor, the Command window and the EditBox control:
     CTRL+H
     CTRL+K
     CTRL+T
     CTRL+Y
     we can't input the following control characters in Editor, the Command window and the EditBox control:
     CTRL+C
     CTRL+R
     CTRL+S
     CTRL+U
     CTRL+X
     CTRL+Z
     it is the same as the Visual FoxPro Debugger is not running in a separate frame.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label5a31d0 ::
             mov  eax , dword ptr [edi]                                      ;0x005a31d0 :        8b07
             mov  edx , dword ptr [ ebp + 12 ]                               ;0x005a31d2 :        8b550c
             push esi                                                        ;0x005a31d5 :        56
             push  dword ptr [ ebp + 16 ]                                    ;0x005a31d6 :        ff7510
             mov ecx , ebx                                                   ;0x005a31d9 :        8bcb
             push  dword ptr [ eax + 8 ]                                     ;0x005a31db :        ff7008
             call Fun4a00cc                                                  ;0x005a31de :        e8e9ceefff
             test eax , eax                                                  ;0x005a31e3 :        85c0
             jg Label49ff2f                                                  ;0x005a31e5 :        0f8f44cdefff
             cmp ebx , 0144h                                                 ;0x005a31eb :        81fb44010000
             jne Label49ff7f                                                 ;0x005a31f1 :        0f8588cdefff
             mov  eax , dword ptr [ ebp + 24 ]                               ;0x005a31f7 :        8b4518
             mov  ebx , dword ptr [eax]                                      ;0x005a31fa :        8b18
             mov ecx , 02000h                                                ;0x005a31fc :        b900200000
             mov eax , ebx                                                   ;0x005a3201 :        8bc3
             call Fun42e572                                                  ;0x005a3203 :        e86ab3e8ff
             test eax , eax                                                  ;0x005a3208 :        85c0
             jne Label5a3226                                                 ;0x005a320a :        751a
             mov  eax , dword ptr [ebx]                                      ;0x005a320c :        8b03
             mov  ecx , dword ptr [ eax + 0150h ]                            ;0x005a320e :        8b8850010000
             test ecx , ecx                                                  ;0x005a3214 :        85c9
             je Label5a322d                                                  ;0x005a3216 :        7415
             pushd 00h                                                       ;0x005a3218 :        6a00
             pushd 06Eh                                                      ;0x005a321a :        6a6e
             pop edx                                                         ;0x005a321c :        5a
             call Fun436ddb                                                  ;0x005a321d :        e8b93be9ff
             test eax , eax                                                  ;0x005a3222 :        85c0
             je Label5a322d                                                  ;0x005a3224 :        7407

     Label5a3226 ::
             mov  eax , dword ptr [ ebp + 16 ]                               ;0x005a3226 :        8b4510
             mov  dword ptr [eax] , edi                                      ;0x005a3229 :        8938
             jmp Label5a3247                                                 ;0x005a322b :        eb1a

     Label5a322d ::
             mov  ebx , dword ptr [ ebp + 8 ]                                ;0x005a322d :        8b5d08
             jmp Label49ff7f                                                 ;0x005a3230 :        e94acdefff

     Label5a3235 ::
             mov eax ,  dword ptr [ Data937794 ]                             ;0x005a3235 :        a194779300
             mov  dword ptr [ ebp - 4 ] , eax                                ;0x005a323a :        8945fc
             jmp Label49ff99                                                 ;0x005a323d :        e957cdefff

     Label5a3242 ::
             mov  ecx , dword ptr [ ebp + 16 ]                               ;0x005a3242 :        8b4d10
             mov  dword ptr [ecx] , eax                                      ;0x005a3245 :        8901

     Label5a3247 ::
             or  dword ptr [esi] , 0FFFFFFFFh                                ;0x005a3247 :        830eff
             pushd 03h                                                       ;0x005a324a :        6a03
             pop eax                                                         ;0x005a324c :        58
             jmp Label49ff2f                                                 ;0x005a324d :        e9ddccefff

     Label5a3252 ::


     ;
     ;                 ----------------------------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - INPUT SOME CONTROL CHARACTERS IN EDITOR WHEN THE VISUAL FOXPRO DEBUGGER IS RUNNING
     ;                                December 2024
     ;                 ----------------------------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9 (and vfp6, vfp7, vfp8), when the Visual FoxPro Debugger is not running in a separate frame, we can input a few control characters in Editor,
     ; when the Visual FoxPro Debugger is running in a separate frame, we can input more control characters in Editor, there are some differences.
     ; In Visual FoxPro Advanced, when the Visual FoxPro Debugger is not running in a separate frame, we can input a few control characters in Editor,
     ; when the Visual FoxPro Debugger is running in a separate frame, we can't input more control characters in Editor,
     ; it is the same as the Visual FoxPro Debugger is not running in a separate frame.
     ;
     ; 2024/12/23, by ccb
     ;

             cmp dword ptr vfpa_sys9180_data,00h
             jne Label5a3253
             cmp dword ptr [ Data937794 ],00h
             je Label5a3253
             cmp dword ptr [ Data93c2cc ],00h
             je Label5a3253
             mov  ecx , dword ptr [ Data937794 ]
             mov  ecx , dword ptr [ecx]
             cmp  eax , dword ptr [ ecx + 72 ]
             jae Label4a1e0f
             mov  ecx , dword ptr [ Data93c2cc ]
             mov  ecx , dword ptr [ecx]
             cmp  eax , dword ptr [ ecx + 72 ]
             jae Label4a1e0f
             jmp Label5a3253


     Label5a3253 ::
             or eax , 0FFFFFFFFh                                             ;0x005a3252 :        83c8ff
             jmp Label49ff2f                                                 ;0x005a3255 :        e9d5ccefff

     Label5a325a ::
             mov  ecx , dword ptr [ ebp + 24 ]                               ;0x005a325a :        8b4d18
             mov  dword ptr [ecx] , ebx                                      ;0x005a325d :        8919
             jmp Label49ff2f                                                 ;0x005a325f :        e9cbccefff

     Label5a3264 ::
             and  dword ptr [ ebp + 24 ] , 00h                               ;0x005a3264 :        83651800
             jmp Label4a1ea0                                                 ;0x005a3268 :        e933ecefff

     Label5a326d ::
             xor eax , eax                                                   ;0x005a326d :        33c0
             inc eax                                                         ;0x005a326f :        40
             jmp Label49ff2f                                                 ;0x005a3270 :        e9baccefff


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_vfp9fix371.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix92.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix155.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix156.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix307.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix308.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix316.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix317.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix318.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix352.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix353.asp


6. OTHER:

     For reference only, there is no guarantees.

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