------------------------------------------------------------------------
                      VFP 9.0 FIX - THE NEW DEFAULT VALUE FOR THE SYS(3055) FUNCTION
                                 October 2019
                 ------------------------------------------------------------------------
                                     CCB



1. THE SYS(3055) FUNCTION (from dv_foxhelp9.chm):

     Visual FoxPro Advanced (10.0.0.0) Language Reference.
     SYS(3055) - FOR and WHERE Clause Complexity

     Sets the complexity level of the FOR and WHERE clauses in commands and functions that support those clauses.
     SYS(3055 [, nComplexity])

     Parameters
     nComplexity
     Specifies the complexity level. The valid range for nComplexity is 320 to 2040.
     The default value is 320 in Visual FoxPro 9.0 and earlier versions.
     The default value is 2000 in Visual FoxPro Advanced (to support long command line).
     If you specify an odd value, it is rounded down to the closest even integer.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Func00352b :: ; proc near
             push ebp                                                        ;0x0c00352b :        55
             lea ebp ,  dword ptr [ esp + 0FFFFF3ECh ]                       ;0x0c00352c :        8dac24ecf3ffff
             sub esp , 0C9Ch                                                 ;0x0c003533 :        81ec9c0c0000
             mov eax ,  dword ptr [ Datac35ea80 ]                            ;0x0c003539 :        a180ea350c
             push ebx                                                        ;0x0c00353e :        53
             push esi                                                        ;0x0c00353f :        56
             push edi                                                        ;0x0c003540 :        57
             push  dword ptr [ Datac35ea7c ]                                 ;0x0c003541 :        ff357cea350c
             mov  dword ptr [ ebp + 0C10h ] , eax                            ;0x0c003547 :        8985100c0000
             call  dword ptr [ DataPtrc35ea70 ]                              ;0x0c00354d :        ff1570ea350c
             fld qword ptr [ Datac3492b8 ]                                   ;0x0c003553 :        dd05b892340c
             mov  edx , dword ptr [ Datac35d05c ]                            ;0x0c003559 :        8b155cd0350c
             or ecx , 0FFFFFFFFh                                             ;0x0c00355f :        83c9ff
             xor ebx , ebx                                                   ;0x0c003562 :        33db
             inc ebx                                                         ;0x0c003564 :        43
             mov  dword ptr [ eax + 0AC0h ] , ecx                            ;0x0c003565 :        8988c00a0000
             mov  dword ptr [ eax + 04EF0h ] , ebx                           ;0x0c00356b :        8998f04e0000
             mov  dword ptr [ eax + 04EB0h ] , 064h                          ;0x0c003571 :        c780b04e000064000000
             mov  byte ptr [ eax + 04F54h ] , bl                             ;0x0c00357b :        8898544f0000
             mov  dword ptr [ eax + 108 ] , ebx                              ;0x0c003581 :        89586c
             mov  dword ptr [ eax + 04F20h ] , ecx                           ;0x0c003584 :        8988204f0000
             mov  dword ptr [ eax + 04F3Ch ] , ebx                           ;0x0c00358a :        89983c4f0000
             mov  dword ptr [ eax + 04F40h ] , ebx                           ;0x0c003590 :        8998404f0000
             mov  dword ptr [ eax + 04F44h ] , ebx                           ;0x0c003596 :        8998444f0000
             mov  dword ptr [ eax + 04F48h ] , ebx                           ;0x0c00359c :        8998484f0000
             mov  dword ptr [ eax + 04F5Ch ] , ebx                           ;0x0c0035a2 :        89985c4f0000
             mov  dword ptr [ eax + 04F60h ] , ebx                           ;0x0c0035a8 :        8998604f0000
             mov  dword ptr [ eax + 04F28h ] , ebx                           ;0x0c0035ae :        8998284f0000
             mov  dword ptr [ eax + 051E4h ] , ecx                           ;0x0c0035b4 :        8988e4510000
             lea edi ,  dword ptr [ eax + 0520Ch ]                           ;0x0c0035ba :        8db80c520000
             mov esi , offset Datac34e6fc                                    ;0x0c0035c0 :        befce6340c
             movsw                                                           ;0x0c0035c5 :        66a5
             movsb                                                           ;0x0c0035c7 :        a4
             fstp qword ptr [ eax + 04F68h ]                                 ;0x0c0035c8 :        dd98684f0000
             xor esi , esi                                                   ;0x0c0035ce :        33f6
             mov  dword ptr [ eax + 08480h ] , edx                           ;0x0c0035d0 :        899080840000
             pushd 026h                                                      ;0x0c0035d6 :        6a26
             pop edx                                                         ;0x0c0035d8 :        5a
             mov  byte ptr [ eax + 06250h ] , 0FFh                           ;0x0c0035d9 :        c68050620000ff
             mov  dword ptr [ eax + 0637Ch ] , 0363h                         ;0x0c0035e0 :        c7807c63000063030000
             mov  dword ptr [ eax + 04F74h ] , esi                           ;0x0c0035ea :        89b0744f0000
             mov  byte ptr [ eax + 04F34h ] , 05Ah                           ;0x0c0035f0 :        c680344f00005a
             mov  byte ptr [ eax + 04F35h ] , 03h                            ;0x0c0035f7 :        c680354f000003
             mov  dword ptr [ eax + 0AA8h ] , 04000h                         ;0x0c0035fe :        c780a80a000000400000
             mov  dword ptr [ eax + 08354h ] , ecx                           ;0x0c003608 :        898854830000
             mov  dword ptr [ eax + 08358h ] , ebx                           ;0x0c00360e :        899858830000
             mov  dword ptr [ eax + 04F8Ch ] , 014Dh                         ;0x0c003614 :        c7808c4f00004d010000
             mov  dword ptr [ eax + 064A8h ] , ecx                           ;0x0c00361e :        8988a8640000
             mov  dword ptr [ Datac35d058 ] , ebx                            ;0x0c003624 :        891d58d0350c
             mov  dword ptr [ eax + 06714h ] , edx                           ;0x0c00362a :        899014670000
             mov  dword ptr [ eax + 06718h ] , edx                           ;0x0c003630 :        899018670000
             lea edx ,  dword ptr [ eax + 0677Ch ]                           ;0x0c003636 :        8d907c670000
             mov  dword ptr [ ebp + 0FFFFFF78h ] , eax                       ;0x0c00363c :        898578ffffff
             mov  dword ptr [ eax + 07B7Ch ] , edx                           ;0x0c003642 :        89907c7b0000
             mov  dword ptr [ eax + 07D28h ] , ecx                           ;0x0c003648 :        8988287d0000
             mov  dword ptr [ eax + 07D2Ch ] , ecx                           ;0x0c00364e :        89882c7d0000


     ;
     ;                 ------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE NEW DEFAULT VALUE FOR THE SYS(3055) FUNCTION
     ;                                 October 2019
     ;                 ------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the default value for the SYS(3055) function is 320,
     ; now the new default value for the SYS(3055) function is 2000 (to support long command line).
     ;
     ; 2019/10/27, by ccb
     ;

     ;         mov  dword ptr [ eax + 07D3Ch ] , 0140h                         ;0x0c003654 :        c7803c7d000040010000
             mov  dword ptr [ eax + 07D3Ch ] , 07D0h                         ;0x0c003654 :        c7803c7d000040010000


             mov  byte ptr [ eax + 07D40h ] , bl                             ;0x0c00365e :        8898407d0000
             mov  dword ptr [ eax + 07D44h ] , ebx                           ;0x0c003664 :        8998447d0000
             mov  dword ptr [ eax + 07D48h ] , ebx                           ;0x0c00366a :        8998487d0000
             mov  word ptr [ eax + 07D4Ch ] , 0409h                          ;0x0c003670 :        66c7804c7d00000904
             mov  dword ptr [ eax + 07D50h ] , 0409h                         ;0x0c003679 :        c780507d000009040000
             mov  dword ptr [ eax + 07DF0h ] , 0186A1h                       ;0x0c003683 :        c780f07d0000a1860100
             mov  dword ptr [ eax + 07D80h ] , 01F4h                         ;0x0c00368d :        c780807d0000f4010000
             mov  dword ptr [ eax + 07D84h ] , esi                           ;0x0c003697 :        89b0847d0000
             mov  word ptr [ eax + 07DACh ] , bx                             ;0x0c00369d :        668998ac7d0000
             mov  word ptr [ eax + 07DAEh ] , si                             ;0x0c0036a4 :        6689b0ae7d0000
             mov  dword ptr [ eax + 07DB0h ] , 01388h                        ;0x0c0036ab :        c780b07d000088130000
             mov  dword ptr [ eax + 07DB4h ] , 02710h                        ;0x0c0036b5 :        c780b47d000010270000
             mov  dword ptr [ eax + 0830Ch ] , ebx                           ;0x0c0036bf :        89980c830000
             mov  dword ptr [ eax + 08308h ] , ebx                           ;0x0c0036c5 :        899808830000
             call Func0036f8                                                 ;0x0c0036cb :        e828000000
             cmp  dword ptr [ Datac35d2e0 ] , esi                            ;0x0c0036d0 :        3935e0d2350c
             jne Labelc0b1102                                                ;0x0c0036d6 :        0f8526da0a00

     Labelc0036dc ::
             mov  ecx , dword ptr [ ebp + 0C10h ]                            ;0x0c0036dc :        8b8d100c0000
             mov  dword ptr [ Datac35d2e0 ] , ebx                            ;0x0c0036e2 :        891de0d2350c
             call Func0224a0                                                 ;0x0c0036e8 :        e8b3ed0100
             pop edi                                                         ;0x0c0036ed :        5f
             pop esi                                                         ;0x0c0036ee :        5e
             pop ebx                                                         ;0x0c0036ef :        5b
             add ebp , 0C14h                                                 ;0x0c0036f0 :        81c5140c0000
             leave                                                           ;0x0c0036f6 :        c9
             ret                                                             ;0x0c0036f7 :        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_vfp9fix95.asp


6. OTHER:

     For reference only, there is no guarantees.

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