--------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - FIX THE COLUMN.DYNAMICCURRENTCONTROL PROPERTY
                                January 2024
                 --------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9, if ALLTRIM(EVALUATE(Column.DynamicCurrentControl))=="", sometimes vfp will crash.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun676706 :: ; proc near
             push ebp                                                        ;0x00676706 :        55
             mov ebp , esp                                                   ;0x00676707 :        8bec
             sub esp , 01Ch                                                  ;0x00676709 :        83ec1c
             test  byte ptr [ ebx + 92 ] , 040h                              ;0x0067670c :        f6435c40
             push esi                                                        ;0x00676710 :        56
             push edi                                                        ;0x00676711 :        57
             je Label676738                                                  ;0x00676712 :        7424
             mov  eax , dword ptr [ ebx + 0320h ]                            ;0x00676714 :        8b8320030000
             mov  eax , dword ptr [eax]                                      ;0x0067671a :        8b00
             mov  ecx , dword ptr [ eax + 0B0h ]                             ;0x0067671c :        8b88b0000000
             mov  eax , dword ptr [ eax + 0B4h ]                             ;0x00676722 :        8b80b4000000
             and  dword ptr [ ebp - 24 ] , 00h                               ;0x00676728 :        8365e800
             and  dword ptr [ ebp - 20 ] , 00h                               ;0x0067672c :        8365ec00
             mov  dword ptr [ ebp - 16 ] , ecx                               ;0x00676730 :        894df0
             mov  dword ptr [ ebp - 12 ] , eax                               ;0x00676733 :        8945f4
             jmp Label676742                                                 ;0x00676736 :        eb0a

     Label676738 ::
             lea esi ,  dword ptr [ ebx + 40 ]                               ;0x00676738 :        8d7328
             lea edi ,  dword ptr [ ebp - 24 ]                               ;0x0067673b :        8d7de8
             movsd                                                           ;0x0067673e :        a5
             movsd                                                           ;0x0067673f :        a5
             movsd                                                           ;0x00676740 :        a5
             movsd                                                           ;0x00676741 :        a5

     Label676742 ::
             mov  ecx , dword ptr [ ebx + 12 ]                               ;0x00676742 :        8b4b0c
             test ecx , ecx                                                  ;0x00676745 :        85c9
             je Label676751                                                  ;0x00676747 :        7408
             call Fun41ebcf                                                  ;0x00676749 :        e88184daff
             mov  dword ptr [ ebp - 8 ] , eax                                ;0x0067674e :        8945f8

     Label676751 ::
             test  byte ptr [ ebx + 88 ] , 01h                               ;0x00676751 :        f6435801
             je Label6767f0                                                  ;0x00676755 :        0f8495000000
             mov  eax , dword ptr [ ebx + 090h ]                             ;0x0067675b :        8b8390000000
             imul eax , eax , 0158h                                          ;0x00676761 :        69c058010000
             cmp  dword ptr [ eax + ebx + 0868h ] , 00h                      ;0x00676767 :        83bc186808000000
             je Label6767f0                                                  ;0x0067676f :        747f
             test  byte ptr [ ebx + 98 ] , 080h                              ;0x00676771 :        f6436280
             je Label676789                                                  ;0x00676775 :        7412
             lea edx ,  dword ptr [ ebx + 066Ch ]                            ;0x00676777 :        8d936c060000
             lea esi ,  dword ptr [ ebp - 24 ]                               ;0x0067677d :        8d75e8
             call Fun4589b2                                                  ;0x00676780 :        e82d22deff
             test eax , eax                                                  ;0x00676785 :        85c0
             je Label6767f0                                                  ;0x00676787 :        7467

     Label676789 ::
             mov eax , ebx                                                   ;0x00676789 :        8bc3
             call Fun67ab3b                                                  ;0x0067678b :        e8ab430000
             mov  eax , dword ptr [ ebx + 090h ]                             ;0x00676790 :        8b8390000000
             imul eax , eax , 0158h                                          ;0x00676796 :        69c058010000
             mov  eax , dword ptr [ eax + ebx + 0868h ]                      ;0x0067679c :        8b841868080000


     ;
     ;                 ---------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE COLUMN.DYNAMICCURRENTCONTROL PROPERTY
     ;                                  March 2023
     ;                 ---------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, if ALLTRIM(EVALUATE(Column.DynamicCurrentControl))=="", sometimes vfp will crash.
     ;
     ; 2023/3/17, by ccb
     ;

             test eax , eax
             je Label6767f0


             call Fun50d098                                                  ;0x006767a3 :        e8f068e9ff
             test eax , eax                                                  ;0x006767a8 :        85c0
             je Label6767d0                                                  ;0x006767aa :        7424
             mov  eax , dword ptr [ ebx + 090h ]                             ;0x006767ac :        8b8390000000
             push  dword ptr [ ebp + 8 ]                                     ;0x006767b2 :        ff7508
             imul eax , eax , 0158h                                          ;0x006767b5 :        69c058010000
             mov  edx , dword ptr [ eax + ebx + 0868h ]                      ;0x006767bb :        8b941868080000
             pushd 0362h                                                     ;0x006767c2 :        6862030000
             call Fun8c4620                                                  ;0x006767c7 :        e854de2400
             pop ecx                                                         ;0x006767cc :        59
             pop ecx                                                         ;0x006767cd :        59
             jmp Label6767f0                                                 ;0x006767ce :        eb20

     Label6767d0 ::
             mov  edx , dword ptr [ ebx + 090h ]                             ;0x006767d0 :        8b9390000000
             mov  eax , dword ptr [ ebp + 8 ]                                ;0x006767d6 :        8b4508
             imul edx , edx , 0158h                                          ;0x006767d9 :        69d258010000
             mov  edx , dword ptr [ edx + ebx + 0868h ]                      ;0x006767df :        8b941a68080000
             mov ecx , 0362h                                                 ;0x006767e6 :        b962030000
             call Fun4f6226                                                  ;0x006767eb :        e836fae7ff

     Label6767f0 ::
             test  byte ptr [ ebx + 93 ] , 02h                               ;0x006767f0 :        f6435d02
             jne Label6767fb                                                 ;0x006767f4 :        7505
             call Fun4a2067                                                  ;0x006767f6 :        e86cb8e2ff

     Label6767fb ::
             cmp  dword ptr [ ebx + 12 ] , 00h                               ;0x006767fb :        837b0c00
             je Label676809                                                  ;0x006767ff :        7408
             mov  ecx , dword ptr [ ebp - 8 ]                                ;0x00676801 :        8b4df8
             call Fun41ebcf                                                  ;0x00676804 :        e8c683daff

     Label676809 ::
             or  byte ptr [ ebx + 89 ] , 040h                                ;0x00676809 :        804b5940
             pushd 04h                                                       ;0x0067680d :        6a04
             pop eax                                                         ;0x0067680f :        58
             pop edi                                                         ;0x00676810 :        5f
             pop esi                                                         ;0x00676811 :        5e
             leave                                                           ;0x00676812 :        c9
             ret 04h                                                         ;0x00676813 :        c20400


4. APPLIES TO:

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

     2, foxite.com:
     https://www.foxite.com/archives/fatal-error-set-date-american-0000493905.htm


6. OTHER:

     For reference only, there is no guarantees.

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