-------------------------------------------------------------------------------------------------
                      [ENHANCED] VFP 9.0 FIX - SYS(9071) ENABLES OR DISABLES FAST UPDATING MEMO FILE COMMANDS
                                 January 2024
                 -------------------------------------------------------------------------------------------------
                                     CCB



1. THE SYS(9071) FUNCTION:

     SYS(9071) - Enables or disables fast updating memo file commands

     Enables or disables fast updating memo file commands.

     SYS(9071 [, 0 | 1])

     Parameters
     0
     Disables fast updating memo file commands. 0 is the startup default for Visual FoxPro Advanced.
     1
     Enables fast updating memo file commands.

     Return Value
     Character

     Remarks
     If we enable fast updating memo file commands in Visual FoxPro Advanced, it is the same as enabling the SYS(9900,9001-9009) functions
     and the SYS(9900,9075) function, Visual FoxPro Advanced will be faster.

     There are some test results:

     VFPFORM.SCX: 32,600 KB
     VFPFORM.SCT: 171,785 KB
     RECCOUNT(): 300,000
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9000-9009) Functions                                                                     | Disable  | Enable  |  Rate    |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9000,0|1) - Enables or disables compiling memo file without packing memo file.           |   2131   |    82   |  26 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9001,0|1|2) - Enables or disables fast packing memo file command.                        |   1874   |  115|6  | 300:20:1 |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9002,0|1) - Enables or disables fast copying memo file command.                          |     41   |     3   |  14 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9003,0|1) - Enables or disables fast compiling memo file command.                        |    267   |    66   |   4 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9004,0|1) - Enables or disables fast replacing memo file command (1 memo field).         |     18   |     1   |  18 : 1  |
     | SYS(9900,9004,0|1) - Enables or disables fast replacing memo file command (10 memo fields).       |    338   |    61   |   5 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9005,0|1) - Enables or disables fast appending memo file command.                        |     57   |     3   |  19 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9006,0|1) - Enables or disables fast SQL selecting into memo file command (into table).  |     46   |     3   |  15 : 1  |
     | SYS(9900,9006,0|1) - Enables or disables fast SQL selecting into memo file command (into cursor). |      4   |     2   |   2 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9007,0|1) - Enables or disables fast SQL updating memo file command (1 memo field).      |     17   |     1   |  17 : 1  |
     | SYS(9900,9007,0|1) - Enables or disables fast SQL updating memo file command (10 memo fields).    |    336   |    44   |   8 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9008,0|1) - Enables or disables fast SQL inserting into memo file command.               |     16   |     1   |  16 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9009,0|1) - Enables or disables fast creating compilation error file.                    |     99   |    25   |   4 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9075,0|1) - Enables or disables fast sorting memo file command.                          |     29   |     1   |  29 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------

     TESTLARGEDBF.DBF: 9 GB
     TESTLARGEDBF.FPT: 12 GB
     RECCOUNT(): 100,000,000
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9000-9009) Functions                                                                     | Disable  | Enable  |  Rate    |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9000,0|1) - Enables or disables compiling memo file without packing memo file.           |   ----   |  ----   |  ------  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9001,0|1|2) - Enables or disables fast packing memo file command.                        |   ****   |  5100   |  ****:1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9002,0|1) - Enables or disables fast copying memo file command.                          |   8460   |   540   |  16 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9003,0|1) - Enables or disables fast compiling memo file command.                        |   ----   |  ----   |  ------  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9004,0|1) - Enables or disables fast replacing memo file command (1 memo field).         |    533   |   461   | 1.2 : 1  |
     | SYS(9900,9004,0|1) - Enables or disables fast replacing memo file command (10 memo fields).       |   6160   |  1168   |   5 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9005,0|1) - Enables or disables fast appending memo file command.                        |   8174   |   611   |  13 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9006,0|1) - Enables or disables fast SQL selecting into memo file command (into table).  |   8884   |   593   |  15 : 1  |
     | SYS(9900,9006,0|1) - Enables or disables fast SQL selecting into memo file command (into cursor). |   6830   |   635   |  11 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9007,0|1) - Enables or disables fast SQL updating memo file command (1 memo field).      |   7971   |  2099   |   4 : 1  |
     | SYS(9900,9007,0|1) - Enables or disables fast SQL updating memo file command (10 memo fields).    |  18088   |  3240   |   6 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9008,0|1) - Enables or disables fast SQL inserting into memo file command.               |   9480   |  2165   |   4 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9009,0|1) - Enables or disables fast creating compilation error file.                    |   ----   |  ----   |  ------  |
     -------------------------------------------------------------------------------------------------------------------------------------
     | SYS(9900,9075,0|1) - Enables or disables fast sorting memo file command.                          |   5975   |   233   |  25 : 1  |
     -------------------------------------------------------------------------------------------------------------------------------------


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun529fca :: ; proc near
             push ebp                                                        ;0x00529fca :        55
             mov ebp , esp                                                   ;0x00529fcb :        8bec
             pushd 0FFFFFFFFh                                                ;0x00529fcd :        6aff
             pushd offset Data922268                                                  ;0x00529fcf :        6868229200
             pushd offset Label9160f9                                                  ;0x00529fd4 :        68f9609100
             mov eax ,  dword ptr fs:[00h]                                   ;0x00529fd9 :        64a100000000
             push eax                                                        ;0x00529fdf :        50
             mov  dword ptr fs:[00h] , esp                                   ;0x00529fe0 :        64892500000000
             push ecx                                                        ;0x00529fe7 :        51
             push ecx                                                        ;0x00529fe8 :        51
             mov eax , 02FBCh                                                ;0x00529fe9 :        b8bc2f0000
             call Fun42c118                                                  ;0x00529fee :        e82521f0ff
             mov eax ,  dword ptr [ Data937090 ]                             ;0x00529ff3 :        a190719300
             mov  dword ptr [ ebp - 28 ] , eax                               ;0x00529ff8 :        8945e4
             push ebx                                                        ;0x00529ffb :        53
             push esi                                                        ;0x00529ffc :        56
             push edi                                                        ;0x00529ffd :        57
             mov  dword ptr [ ebp - 24 ] , esp                               ;0x00529ffe :        8965e8
             xor edi , edi                                                   ;0x0052a001 :        33ff
             mov  dword ptr [ ebp + 0FFFFD114h ] , edi                       ;0x0052a003 :        89bd14d1ffff
             push edi                                                        ;0x0052a009 :        57
             pushd 02710h                                                    ;0x0052a00a :        6810270000
             push edi                                                        ;0x0052a00f :        57
             mov  ebx , dword ptr [ ebp + 8 ]                                ;0x0052a010 :        8b5d08
             mov eax , ebx                                                   ;0x0052a013 :        8bc3
             call Fun529bc5                                                  ;0x0052a015 :        e8abfbffff
             mov  dword ptr [ ebp + 0FFFFD0E4h ] , eax                       ;0x0052a01a :        8985e4d0ffff
             mov  dword ptr [ ebp + 0FFFFD10Ch ] , edi                       ;0x0052a020 :        89bd0cd1ffff
             lea ecx ,  dword ptr [ ebp + 0FFFFFDE0h ]                       ;0x0052a026 :        8d8de0fdffff
             mov  dword ptr [ ebp + 0FFFFD100h ] , ecx                       ;0x0052a02c :        898d00d1ffff
             mov  byte ptr [ ebp + 0FFFFFDE0h ] , 00h                        ;0x0052a032 :        c685e0fdffff00
             movsx eax , ax                                                  ;0x0052a039 :        0fbfc0


     ;
     ;                 --------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - SYS(9071) ENABLES OR DISABLES FAST UPDATING MEMO FILE COMMANDS
     ;                                December 2021
     ;                 --------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; SYS(9071) - Enables or disables fast updating memo file commands.
     ;
     ; 2021/12/8, by ccb
     ;

             cmp eax,9071
             je vfpa_sys9071_start


             pushd 064h                                                      ;0x0052a03c :        6a64
             pop esi                                                         ;0x0052a03e :        5e
             cmp eax , esi                                                   ;0x0052a03f :        3bc6
             jle Label52a0d0                                                 ;0x0052a041 :        0f8e89067000
             mov ecx , 07EAh                                                 ;0x0052a047 :        b9ea070000
             cmp eax , ecx                                                   ;0x0052a04c :        3bc1
             jg Label52a164                                                  ;0x0052a04e :        0f8f10010000
             je Label609b33                                                  ;0x0052a054 :        0f84d9fa0d00
             mov ecx , 04F6h                                                 ;0x0052a05a :        b9f6040000
             cmp eax , ecx                                                   ;0x0052a05f :        3bc1
             jle Label52b6e0                                                 ;0x0052a061 :        0f8e79160000
             mov ecx , 07DBh                                                 ;0x0052a067 :        b9db070000
             cmp eax , ecx                                                   ;0x0052a06c :        3bc1
             jg Label51f355                                                  ;0x0052a06e :        0f8fe152ffff
             je Label609700                                                  ;0x0052a074 :        0f8486f60d00
             add ecx , 0FFFFFFF9h                                            ;0x0052a07a :        83c1f9
             cmp eax , ecx                                                   ;0x0052a07d :        3bc1
             jg Label4a4938                                                  ;0x0052a07f :        0f8fb3a8f7ff
             je Label4f6b07                                                  ;0x0052a085 :        0f847ccafcff
             sub eax , 04F7h                                                 ;0x0052a08b :        2df7040000
             je Label60951e                                                  ;0x0052a090 :        0f8488f40d00
             dec eax                                                         ;0x0052a096 :        48
             je Label60950f                                                  ;0x0052a097 :        0f8472f40d00
             sub eax , 0E4h                                                  ;0x0052a09d :        2de4000000
             je Label609492                                                  ;0x0052a0a2 :        0f84eaf30d00
             sub eax , 01F4h                                                 ;0x0052a0a8 :        2df4010000
             jne Label462026                                                 ;0x0052a0ad :        0f85737ff3ff
             lea eax ,  dword ptr [ ebp + 0FFFFFDE0h ]                       ;0x0052a0b3 :        8d85e0fdffff
             push eax                                                        ;0x0052a0b9 :        50
             push  dword ptr [ ebp + 12 ]                                    ;0x0052a0ba :        ff750c
             mov edx , ebx                                                   ;0x0052a0bd :        8bd3
             call Fun4dc923                                                  ;0x0052a0bf :        e85f28fbff


4. APPLIES TO:

     VFP 10 (VFP Advanced)


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix95.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix96.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix200.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix233.asp


6. OTHER:

     For reference only, there is no guarantees.

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