--------------------------------------------------------------------------
                      VFP 9.0 FIX - EXPAND THE SPECIAL TERMS IN THE CONFIGURATION FILE
                                  March 2019
                 --------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), it never expands the special terms in the configuration file at startup.

     In VFP Advanced, it always expands the special terms in the configuration file at startup.

     The suggestion came from John Ryan.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label40a540 ::
             cmp  dword ptr [ ebp + 0FFFFFF3Ch ] , 06D1h                     ;0x0040a540 :        81bd3cffffffd1060000
             je Label5d615c                                                  ;0x0040a54a :        0f840cbc1c00
             lea eax ,  dword ptr [ ebp + 0FFFFFF40h ]                       ;0x0040a550 :        8d8540ffffff
             lea ecx ,  dword ptr [ ebp + 0FFFFFF60h ]                       ;0x0040a556 :        8d8d60ffffff
             call Fun415309                                                  ;0x0040a55c :        e8a8ad0000


     ;
     ;                 --------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - EXPAND THE SPECIAL TERMS IN THE CONFIGURATION FILE
     ;                                  March 2019
     ;                 --------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Expand the special terms in the configuration file.
     ;
     ; 2019/3/14, by ccb
     ;

             cmp dword ptr vfpa_sys9020_data,00h
             je Label40a561
             mov  dword ptr [ ebp + 0FFFFFD18h ] , eax
             push 100h
             push dword ptr [ ebp + 0FFFFFF58h ]
             call vfpa_expandconfigterms
             mov  eax , dword ptr [ ebp + 0FFFFFD18h ]


     Label40a561 ::
             cmp eax , 07h                                                   ;0x0040a561 :        83f807
             mov  dword ptr [ ebp + 0FFFFFD18h ] , eax                       ;0x0040a564 :        898518fdffff
             je Label40a5e2                                                  ;0x0040a56a :        7476
             cmp eax , 067h                                                  ;0x0040a56c :        83f867
             je Label40a5e2                                                  ;0x0040a56f :        7471
             cmp eax , 030h                                                  ;0x0040a571 :        83f830
             je Label5d61b3                                                  ;0x0040a574 :        0f8439bc1c00
             mov  edi , strncmp                                ;0x0040a57a :        8b3dcc799100
             pushd 04h                                                       ;0x0040a580 :        6a04
             lea eax ,  dword ptr [ ebp + 0FFFFFE38h ]                       ;0x0040a582 :        8d8538feffff
             pushd offset Data9191dc                                                  ;0x0040a588 :        68dc919100
             push eax                                                        ;0x0040a58d :        50
             call edi                                                        ;0x0040a58e :        ffd7
             add esp , 0Ch                                                   ;0x0040a590 :        83c40c
             test eax , eax                                                  ;0x0040a593 :        85c0
             je Label5d61fb                                                  ;0x0040a595 :        0f8460bc1c00
             pushd 05h                                                       ;0x0040a59b :        6a05
             lea eax ,  dword ptr [ ebp + 0FFFFFE38h ]                       ;0x0040a59d :        8d8538feffff
             pushd offset Data91cc84                                                  ;0x0040a5a3 :        6884cc9100
             push eax                                                        ;0x0040a5a8 :        50
             call edi                                                        ;0x0040a5a9 :        ffd7
             add esp , 0Ch                                                   ;0x0040a5ab :        83c40c
             test eax , eax                                                  ;0x0040a5ae :        85c0
             je Label5d61fb                                                  ;0x0040a5b0 :        0f8445bc1c00

     Label40a5b6 ::
             cmp  dword ptr [ ebp + 120 ] , ebx                              ;0x0040a5b6 :        395d78
             je Label40a5e2                                                  ;0x0040a5b9 :        7427
             push ebx                                                        ;0x0040a5bb :        53
             xor edi , edi                                                   ;0x0040a5bc :        33ff
             inc edi                                                         ;0x0040a5be :        47
             push edi                                                        ;0x0040a5bf :        57
             push ebx                                                        ;0x0040a5c0 :        53
             lea eax ,  dword ptr [ ebp + 0FFFFFF38h ]                       ;0x0040a5c1 :        8d8538ffffff
             push eax                                                        ;0x0040a5c7 :        50
             call Fun430428                                                  ;0x0040a5c8 :        e85b5e0200
             cmp eax , edi                                                   ;0x0040a5cd :        3bc7
             jne Label5d6256                                                 ;0x0040a5cf :        0f8581bc1c00
             cmp  dword ptr [ ebp + 0FFFFFF3Ch ] , 010h                      ;0x0040a5d5 :        83bd3cffffff10
             jne Label5d6256                                                 ;0x0040a5dc :        0f8574bc1c00

     Label40a5e2 ::
             mov  eax , dword ptr [ ebp + 0FFFFFD18h ]                       ;0x0040a5e2 :        8b8518fdffff
             cmp eax , 0F6h                                                  ;0x0040a5e8 :        3df6000000
             ja Label5d6273                                                  ;0x0040a5ed :        0f8780bc1c00
             movzx eax ,byte ptr [ eax + offset Data413716 ]                          ;0x0040a5f3 :        0fb68016374100
             jmp  dword ptr [ 4 * eax + offset DataPtr413526 ]                           ;0x0040a5fa :        ff248526354100


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


6. OTHER:

     For reference only, there is no guarantees.

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