-------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - THE COMMAND WINDOW IS SMALL AT STARTUP
                                 January 2024
                 -------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), if there is no the resource file (foxuser.dbf),
     the Command window is small (5 rows, 50 cols) at startup, now the Command window is bigger (20 rows, 80 cols).


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun5446c1 :: ; proc near
             push ebx                                                        ;0x005446c1 :        53
             push esi                                                        ;0x005446c2 :        56
             push edi                                                        ;0x005446c3 :        57
             mov esi , eax                                                   ;0x005446c4 :        8bf0
             call Fun42f5d1                                                  ;0x005446c6 :        e806afeeff
             mov  eax , dword ptr [eax]                                      ;0x005446cb :        8b00
             movzx edi ,word ptr [ eax + 0160h ]                             ;0x005446cd :        0fb7b860010000
             mov  ebx , dword ptr [esi]                                      ;0x005446d4 :        8b1e


     ;
     ;                 --------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE COMMAND WINDOW IS SMALL AT STARTUP
     ;                                  July 2019
     ;                 --------------------------------------------------------------
     ;                                     CCB
     ;
     ; If there is no the resource file (foxuser.dbf),
     ; the Command window is small (5 rows, 50 cols) at startup, now the Command window is bigger (20 rows, 80 cols).
     ;
     ; 2019/7/21, by ccb
     ;

             cmp dword ptr vfpa_commandwindow_issmall_haverun,01h
             je Label5446d6
             mov eax , dword ptr [ Data93e6d0 ]
             test eax , eax
             je Label5446d6
             mov eax , dword ptr [eax]
             mov eax , dword ptr [eax]
             cmp dword ptr [ebx] , eax
             jne Label5446d6
             mov dword ptr vfpa_commandwindow_issmall_haverun,01h
             imul edi , edi , 050h
             jmp Label5446d9


     Label5446d6 ::
             imul edi , edi , 032h                                           ;0x005446d6 :        6bff32

     Label5446d9 ::
             sub  edi , dword ptr [ ebx + 0B0h ]                             ;0x005446d9 :        2bbbb0000000
             mov eax , esi                                                   ;0x005446df :        8bc6
             add  edi , dword ptr [ ebx + 0A0h ]                             ;0x005446e1 :        03bba0000000
             call Fun42f5d1                                                  ;0x005446e7 :        e8e5aeeeff
             mov  eax , dword ptr [eax]                                      ;0x005446ec :        8b00
             movzx eax ,word ptr [ eax + 0162h ]                             ;0x005446ee :        0fb78062010000
             lea edx ,  dword ptr [ eax + 4 * eax ]                          ;0x005446f5 :        8d1480


     ;
     ;                 --------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE COMMAND WINDOW IS SMALL AT STARTUP
     ;                                  July 2019
     ;                 --------------------------------------------------------------
     ;                                     CCB
     ;
     ; If there is no the resource file (foxuser.dbf),
     ; the Command window is small (5 rows, 50 cols) at startup, now the Command window is bigger (20 rows, 80 cols).
     ;
     ; 2019/7/21, by ccb
     ;

             cmp dword ptr vfpa_commandwindow_issmall2_haverun,01h
             je Label5446d6
             mov ecx , eax
             mov eax , dword ptr [ Data93e6d0 ]
             test eax , eax
             je Label5446f8
             mov eax , dword ptr [eax]
             mov eax , dword ptr [eax]
             cmp dword ptr [ebx] , eax
             jne Label5446f8
             mov dword ptr vfpa_commandwindow_issmall2_haverun,01h
             mov edx ,  dword ptr vfpa_sys9043_data
             add edx , 03h
             imul edx , ecx


     Label5446f8 ::
             sub  edx , dword ptr [ ebx + 0B4h ]                             ;0x005446f8 :        2b93b4000000
             mov eax , edi                                                   ;0x005446fe :        8bc7
             add  edx , dword ptr [ ebx + 0A4h ]                             ;0x00544700 :        0393a4000000
             mov ecx , esi                                                   ;0x00544706 :        8bce
             call Fun43799f                                                  ;0x00544708 :        e89232efff
             mov eax , esi                                                   ;0x0054470d :        8bc6
             call Fun42f5d1                                                  ;0x0054470f :        e8bdaeeeff
             mov ebx , eax                                                   ;0x00544714 :        8bd8
             mov eax , esi                                                   ;0x00544716 :        8bc6
             call Fun42f5d1                                                  ;0x00544718 :        e8b4aeeeff
             mov  ecx , dword ptr [ebx]                                      ;0x0054471d :        8b0b
             movzx edx ,word ptr [ ecx + 0160h ]                             ;0x0054471f :        0fb79160010000
             mov  ecx , dword ptr [ Data9377a4 ]                             ;0x00544726 :        8b0da4779300
             mov  eax , dword ptr [eax]                                      ;0x0054472c :        8b00
             sub ecx , edx                                                   ;0x0054472e :        2bca
             movzx edx ,word ptr [ eax + 0162h ]                             ;0x00544730 :        0fb79062010000
             sub ecx , edi                                                   ;0x00544737 :        2bcf
             call Fun439d7e                                                  ;0x00544739 :        e84056efff
             pop edi                                                         ;0x0054473e :        5f
             pop esi                                                         ;0x0054473f :        5e
             pop ebx                                                         ;0x00544740 :        5b
             ret                                                             ;0x00544741 :        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_vfp9fix139.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix140.asp


6. OTHER:

     For reference only, there is no guarantees.

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