-------------------------------------------------
                        VFP 9.0 FIX - DO FORM COMMAND
                                 January 2018
                 -------------------------------------------------
                                     CCB



1. BUG:

     In vfp9, if we use the DO FORM command in the ON SELECTION BAR statement, sometimes VFP will crash.

     The bug only occurs in vfp9 sp2, it does not occur in vfp6, vfp7, vfp8 and vfp9 sp1.

     The bug was reported by Emerson Reed.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label49c145 ::
             mov  esi , dword ptr [ Data93e6f0 ]                             ;0x0049c145 :        8b35f0e69300
             test esi , esi                                                  ;0x0049c14b :        85f6
             je Label49c17a                                                  ;0x0049c14d :        742b


     ;
     ;                 -------------------------------------------------
     ;                        VFP 9.0 FIX - DO FORM COMMAND
     ;                                November 2017
     ;                 -------------------------------------------------
     ;                                     CCB
     ;
     ; If we use the DO FORM command in the ON SELECTION BAR statement, sometimes VFP will crash.
     ;
     ; 2017/11/30, by ccb
     ;

             mov  eax , dword ptr [esi]
             cmp  dword ptr [eax] , 00h
             jge Label49c158
             cmp  dword ptr [ eax + 12 ] , 00h
             je Label49c17a


             call Fun54977a                                                  ;0x0049c14f :        e826d60a00
             test eax , eax                                                  ;0x0049c154 :        85c0
             je Label49c17a                                                  ;0x0049c156 :        7422

     Label49c158 ::
             mov eax ,  dword ptr [ Data93e6f0 ]                             ;0x0049c158 :        a1f0e69300
             mov  ecx , dword ptr [eax]                                      ;0x0049c15d :        8b08
             mov  ecx , dword ptr [ecx]                                      ;0x0049c15f :        8b09
             lea eax ,  dword ptr [ ebp - 24 ]                               ;0x0049c161 :        8d45e8
             call Fun41975b                                                  ;0x0049c164 :        e8f2d5f7ff
             push edi                                                        ;0x0049c169 :        57
             lea edi ,  dword ptr [ ebp - 24 ]                               ;0x0049c16a :        8d7de8
             call Fun433e2f                                                  ;0x0049c16d :        e8bd7cf9ff
             test eax , eax                                                  ;0x0049c172 :        85c0
             jne Label5b7616                                                 ;0x0049c174 :        0f859cb41100

     Label49c17a ::
             mov  eax , dword ptr [ ebp - 32 ]                               ;0x0049c17a :        8b45e0
             test eax , eax                                                  ;0x0049c17d :        85c0
             mov  edi , dword ptr [ ebp + 0108h ]                            ;0x0049c17f :        8bbd08010000
             mov  ebx , dword ptr [ ebp + 0110h ]                            ;0x0049c185 :        8b9d10010000
             je Label5098c3                                                  ;0x0049c18b :        0f8432d70600
             mov edx , ebx                                                   ;0x0049c191 :        8bd3
             mov  byte ptr [ ebp - 28 ] , 050h                               ;0x0049c193 :        c645e450
             mov  dword ptr [edx] , offset Data93d5c0                                 ;0x0049c197 :        c702c0d59300
             jmp Label5098c3                                                 ;0x0049c19d :        e921d70600


4. APPLIES TO:

     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

     2, foxite.com:
     https://www.foxite.com/archives/another-vfp9-sp2-bug-0000150951.htm


6. OTHER:

     For reference only, there is no guarantees.

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