---------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - FIX THE ACTIVATE MENU BAR NAME IN THE ON PAD COMMAND
                                  March 2021
                 ---------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In VFP 9.0 and earlier versions,  when we compile the code:
     ON PAD mymenutitlename OF mymenubarname ACTIVATE MENU mymenu
     the activate menu bar name is incorrect in the compiled p-code,
     it can't run correctly.

     There is the bug for the ON PAD ... OF ... ACTIVATE MENU ... command.
     There is no the bug for the following ON ... commands:
     ON PAD ... OF ... ACTIVATE POPUP ...
     ON BAR ... OF ... ACTIVATE MENU ...
     ON BAR ... OF ... ACTIVATE POPUP ...
     ON SELECTION PAD ... OF ... ACTIVATE MENU ...
     ON SELECTION PAD ... OF ... ACTIVATE POPUP ...
     ON SELECTION BAR ... OF ... ACTIVATE MENU ...
     ON SELECTION BAR ... OF ... ACTIVATE POPUP ...


2. CAUSE:

     In VFP 9.0 and earlier versions, the code:
     ON PAD mymenutitlename OF mymenubarname ACTIVATE MENU mymenu
     will be compiled to:
     15 00 31 BC-F7 00 00 C3-F7 01 00 BC-FB 06 00 6D-79 6D 65 6E-FE
     the activate menu bar name is 5 bytes ("mymen") in the compiled p-code,
     it is incorrect.

     In VFP Advanced, the code:
     ON PAD mymenutitlename OF mymenubarname ACTIVATE MENU mymenu
     will be compiled to:
     11 00 31 BC-F7 00 00 C3-F7 01 00 BC-1C F7 02 00-FE
     the activate menu bar name is 6 bytes ("mymenu") in the compiled p-code,
     it is correct.

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label574844 ::
             pushd 00h                                                       ;0x00574844 :        6a00
             pushd 01h                                                       ;0x00574846 :        6a01
             pushd 00h                                                       ;0x00574848 :        6a00
             push esi                                                        ;0x0057484a :        56
             inc edi                                                         ;0x0057484b :        47
             call Fun430428                                                  ;0x0057484c :        e8d7bbebff
             mov edx , edi                                                   ;0x00574851 :        8bd7
             mov ecx , esi                                                   ;0x00574853 :        8bce
             call Fun476835                                                  ;0x00574855 :        e8db1ff0ff
             test eax , eax                                                  ;0x0057485a :        85c0
             jl Label4b5fbf                                                  ;0x0057485c :        0f8c5d17f4ff
             je Label574770                                                  ;0x00574862 :        0f8408ffffff
             add edi , eax                                                   ;0x00574868 :        03f8
             lea ebp ,  dword ptr [ eax + 1 ]                                ;0x0057486a :        8d6801

     Label57486d ::
             push edi                                                        ;0x0057486d :        57
             mov ebx , 01BCh                                                 ;0x0057486e :        bbbc010000
             mov  byte ptr [esi] , 07h                                       ;0x00574873 :        c60607
             call Fun4345a7                                                  ;0x00574876 :        e82cfdebff
             test eax , eax                                                  ;0x0057487b :        85c0
             mov  byte ptr [esi] , 07h                                       ;0x0057487d :        c60607
             je Label5748d1                                                  ;0x00574880 :        744f
             inc edi                                                         ;0x00574882 :        47
             push edi                                                        ;0x00574883 :        57
             mov ebx , 02C6h                                                 ;0x00574884 :        bbc6020000
             call Fun4345a7                                                  ;0x00574889 :        e819fdebff


     ;
     ;                 ----------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE ACTIVATE MENU BAR NAME IN THE ON PAD COMMAND
     ;                                  March 2021
     ;                 ----------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Fix the activate menu bar name in the ON PAD command.
     ;
     ; 2021/3/5, by ccb
     ;

             cmp dword ptr vfpa_sys9054_data,00h
             je Label57488e
             test eax , eax
             jne Label5748a9
             jmp Label574896


     Label57488e ::
             test eax , eax                                                  ;0x0057488e :        85c0
             je Label4b5f64                                                  ;0x00574890 :        0f84ce16f4ff

     Label574896 ::
             push edi                                                        ;0x00574896 :        57
             mov ebx , 01Ch                                                  ;0x00574897 :        bb1c000000
             call Fun4345a7                                                  ;0x0057489c :        e806fdebff


     ;
     ;                 --------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE ACTIVATE MENU BAR NAME IN THE ON PAD COMMAND
     ;                                  March 2021
     ;                 --------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Fix the activate menu bar name in the ON PAD command.
     ;
     ; 2021/3/5, by ccb
     ;

             cmp dword ptr vfpa_sys9054_data,00h
             je Label5748a1
             test eax , eax
             jne Label5748a9
             jmp Label5748c4


     Label5748a1 ::
             test eax , eax                                                  ;0x005748a1 :        85c0
             jne Label4b5f64                                                 ;0x005748a3 :        0f85bb16f4ff

     Label5748a9 ::
             lea edx ,  dword ptr [ edi + 1 ]                                ;0x005748a9 :        8d5701
             mov ecx , esi                                                   ;0x005748ac :        8bce
             mov  byte ptr [esi] , 07h                                       ;0x005748ae :        c60607
             call Fun476835                                                  ;0x005748b1 :        e87f1ff0ff
             test eax , eax                                                  ;0x005748b6 :        85c0
             jl Label4b5fbf                                                  ;0x005748b8 :        0f8c0117f4ff
             jne Label57469b                                                 ;0x005748be :        0f85d7fdffff

     Label5748c4 ::
             mov eax , 0FFFFFF38h                                            ;0x005748c4 :        b838ffffff
             pop edi                                                         ;0x005748c9 :        5f
             pop esi                                                         ;0x005748ca :        5e
             pop ebp                                                         ;0x005748cb :        5d
             pop ebx                                                         ;0x005748cc :        5b
             mov esp , ebp                                                   ;0x005748cd :        8be5
             pop ebp                                                         ;0x005748cf :        5d
             ret                                                             ;0x005748d0 :        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_vfp9fix159.asp

     2, vfp.fr:
     http://www.vfp.fr/atoutfox.asp

     3, atoutfox.org:
     http://www.atoutfox.org/articles.asp?action=fconsulter&ID=0000000920


6. OTHER:

     For reference only, there is no guarantees.

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