--------------------------------------------------------------------------------------------------
                      [ENHANCED] VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
                                 January 2024
                 --------------------------------------------------------------------------------------------------
                                    CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), the maximum number of characters for the Label.Caption property is 255,
     now the maximum number of characters for the Label.Caption property is 16383.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label4b5385 ::
             push ebp                                                        ;0x004b5385 :        55
             lea ebp ,  dword ptr [ esp - 116 ]                              ;0x004b5386 :        8d6c248c


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         sub esp , 01F0h                                                 ;0x004b538a :        81ecf0010000

             mov eax , 04210h                                                 ;0x004b538a :        81ecf0010000
             call Fun42c118


             mov eax ,  dword ptr [ Data937090 ]                             ;0x004b5390 :        a190709300
             mov  dword ptr [ ebp + 112 ] , eax                              ;0x004b5395 :        894570
             push ebx                                                        ;0x004b5398 :        53
             push esi                                                        ;0x004b5399 :        56
             push edi                                                        ;0x004b539a :        57
             mov edx , ecx                                                   ;0x004b539b :        8bd1
             mov  dword ptr [ ebp + 0FFFFFEB8h ] , edx                       ;0x004b539d :        8995b8feffff
             mov  ebx , dword ptr [ ebp + 124 ]                              ;0x004b53a3 :        8b5d7c


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

             pushd 01008h                                                      ;0x004b53a6 :        6a57
             pop ecx                                                         ;0x004b53a8 :        59
             xor eax , eax                                                   ;0x004b53a9 :        33c0
             lea edi ,  dword ptr [ ebp - 0419Ch ]                       ;0x004b53ab :        8dbd14ffffff
             rep stosd                                                       ;0x004b53b1 :        f3ab


             pushd 057h                                                      ;0x004b53a6 :        6a57
             pop ecx                                                         ;0x004b53a8 :        59
             xor eax , eax                                                   ;0x004b53a9 :        33c0
             lea edi ,  dword ptr [ ebp + 0FFFFFF14h ]                       ;0x004b53ab :        8dbd14ffffff
             rep stosd                                                       ;0x004b53b1 :        f3ab
             mov  eax , dword ptr [ ebx + 28 ]                               ;0x004b53b3 :        8b431c


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         mov  dword ptr [ ebp + 0FFFFFF14h ] , eax                       ;0x004b53b6 :        898514ffffff
             mov  dword ptr [ ebp - 0419Ch ] , eax                       ;0x004b53b6 :        898514ffffff


             movzx eax ,word ptr [ ebx + 88 ]                                ;0x004b53bc :        0fb74358
             lea esi ,  dword ptr [ ebx + 32 ]                               ;0x004b53c0 :        8d7320


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         lea edi ,  dword ptr [ ebp + 0FFFFFF18h ]                       ;0x004b53c3 :        8dbd18ffffff
             lea edi ,  dword ptr [ ebp - 0419Ch ][04h]                       ;0x004b53c3 :        8dbd18ffffff


             movsd                                                           ;0x004b53c9 :        a5
             movsd                                                           ;0x004b53ca :        a5
             movsd                                                           ;0x004b53cb :        a5
             pushd 04h                                                       ;0x004b53cc :        6a04
             movsd                                                           ;0x004b53ce :        a5
             pop esi                                                         ;0x004b53cf :        5e
             mov  dword ptr [ ebp + 44 ] , eax                               ;0x004b53d0 :        89452c
             lea eax ,  dword ptr [ ebp + 124 ]                              ;0x004b53d3 :        8d457c
             push eax                                                        ;0x004b53d6 :        50
             lea eax ,  dword ptr [ ebp + 0FFFFFEB4h ]                       ;0x004b53d7 :        8d85b4feffff
             push eax                                                        ;0x004b53dd :        50
             mov  edi , dword ptr [ ebp + 0FFFFFEB8h ]                       ;0x004b53de :        8bbdb8feffff
             pushd 010h                                                      ;0x004b53e4 :        6a10
             mov  dword ptr [ ebp + 100 ] , edx                              ;0x004b53e6 :        895564
             pop edx                                                         ;0x004b53e9 :        5a
             mov ecx , edi                                                   ;0x004b53ea :        8bcf
             mov  dword ptr [ ebp + 124 ] , esi                              ;0x004b53ec :        89757c
             call Fun41993a                                                  ;0x004b53ef :        e84645f6ff
             cmp eax , esi                                                   ;0x004b53f4 :        3bc6
             jne Label5ff204                                                 ;0x004b53f6 :        0f85089e1400
             mov  eax , dword ptr [ ebp + 0FFFFFEB4h ]                       ;0x004b53fc :        8b85b4feffff

     Label4b5402 ::
             push edi                                                        ;0x004b5402 :        57
             mov  word ptr [ ebp + 70 ] , ax                                 ;0x004b5403 :        66894546
             call Fun4b52f1                                                  ;0x004b5407 :        e8e5feffff
             mov  dword ptr [ ebp + 48 ] , eax                               ;0x004b540c :        894530
             or  byte ptr [ ebp + 49 ] , 080h                                ;0x004b540f :        804d3180
             pushd 017h                                                      ;0x004b5413 :        6a17
             lea esi ,  dword ptr [ ebx + 64 ]                               ;0x004b5415 :        8d7340


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         lea eax ,  dword ptr [ ebp + 0FFFFFF14h ]                       ;0x004b5418 :        8d8514ffffff

             push ecx
             push esi
             push edi
             mov ecx , 014h
             lea esi ,  dword ptr [ ebp - 0419Ch ]
             lea edi ,  dword ptr [ ebp + 0FFFFFF14h ]
             rep movsb
             pop edi
             pop esi
             pop ecx
             lea eax ,  dword ptr [ ebp + 0FFFFFF14h ]                       ;0x004b5418 :        8d8514ffffff


             mov  byte ptr [ ebp + 40 ] , 01h                                ;0x004b541e :        c6452801
             call Fun4e5d8c                                                  ;0x004b5422 :        e865090300
             lea eax ,  dword ptr [ ebp + 0FFFFFEBCh ]                       ;0x004b5427 :        8d85bcfeffff
             push eax                                                        ;0x004b542d :        50
             mov  eax , dword ptr [ ebx + 4 ]                                ;0x004b542e :        8b4304
             call Fun4308bf                                                  ;0x004b5431 :        e889b4f7ff
             mov  eax , dword ptr [ ebp + 0FFFFFF0Ch ]                       ;0x004b5436 :        8b850cffffff
             mov  esi , dword ptr [ ebp + 0FFFFFEB8h ]                       ;0x004b543c :        8bb5b8feffff
             mov  dword ptr [ ebp + 60 ] , eax                               ;0x004b5442 :        89453c
             lea eax ,  dword ptr [ ebp + 0FFFFFEB0h ]                       ;0x004b5445 :        8d85b0feffff
             push eax                                                        ;0x004b544b :        50


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         lea eax ,  dword ptr [ ebp + 0FFFFFF28h ]                       ;0x004b544c :        8d8528ffffff
     ;         push eax                                                        ;0x004b5452 :        50
     ;         pushd 03Ah                                                      ;0x004b5453 :        6a3a
     ;         mov edi , 0100h                                                 ;0x004b5455 :        bf00010000
     ;         pop edx                                                         ;0x004b545a :        5a

             lea eax ,  dword ptr [ ebp - 0419Ch ][14h]                       ;0x004b544c :        8d8528ffffff
             push eax                                                        ;0x004b5452 :        50
             pushd 03Ah                                                      ;0x004b5453 :        6a3a
             mov edi , 04000h                                                 ;0x004b5455 :        bf00010000
             pop edx                                                         ;0x004b545a :        5a


             mov ecx , esi                                                   ;0x004b545b :        8bce
             mov  dword ptr [ ebp + 0FFFFFEB0h ] , edi                       ;0x004b545d :        89bdb0feffff
             call Fun41993a                                                  ;0x004b5463 :        e8d244f6ff
             test eax , eax                                                  ;0x004b5468 :        85c0
             je Label4a8ce1                                                  ;0x004b546a :        0f847138ffff
             mov  eax , dword ptr [ ebp + 0FFFFFEB0h ]                       ;0x004b5470 :        8b85b0feffff
             cmp eax , edi                                                   ;0x004b5476 :        3bc7
             jnb Label5ff20b                                                 ;0x004b5478 :        0f838d9d1400


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         mov  byte ptr [ ebp + eax + 0FFFFFF28h ] , 00h                  ;0x004b547e :        c6840528ffffff00
             mov  byte ptr [ ebp + eax - 0419Ch ][14h] , 00h                  ;0x004b547e :        c6840528ffffff00


     Label4b5486 ::
             pushd 00h                                                       ;0x004b5486 :        6a00
             xor edx , edx                                                   ;0x004b5488 :        33d2
             mov ecx , esi                                                   ;0x004b548a :        8bce
             call Fun438316                                                  ;0x004b548c :        e8852ef8ff
             pushd 00h                                                       ;0x004b5491 :        6a00
             mov edx , 0172h                                                 ;0x004b5493 :        ba72010000
             mov ecx , esi                                                   ;0x004b5498 :        8bce
             mov  dword ptr [ ebp + 124 ] , eax                              ;0x004b549a :        89457c
             call Fun436ddb                                                  ;0x004b549d :        e83919f8ff
             pushd 04h                                                       ;0x004b54a2 :        6a04
             mov ebx , eax                                                   ;0x004b54a4 :        8bd8
             pop edi                                                         ;0x004b54a6 :        5f
             sub ebx , edi                                                   ;0x004b54a7 :        2bdf
             neg ebx                                                         ;0x004b54a9 :        f7db
             sbb ebx , ebx                                                   ;0x004b54ab :        1bdb
             inc ebx                                                         ;0x004b54ad :        43
             cmp  dword ptr [ ebp + 124 ] , 00h                              ;0x004b54ae :        837d7c00
             jne Label5ff214                                                 ;0x004b54b2 :        0f855c9d1400

     Label4b54b8 ::
             lea eax ,  dword ptr [ ebp + 0FFFFFEB4h ]                       ;0x004b54b8 :        8d85b4feffff
             push eax                                                        ;0x004b54be :        50
             lea eax ,  dword ptr [ ebp + 0FFFFFEB8h ]                       ;0x004b54bf :        8d85b8feffff
             push eax                                                        ;0x004b54c5 :        50
             pushd 027h                                                      ;0x004b54c6 :        6a27
             pop edx                                                         ;0x004b54c8 :        5a
             mov ecx , esi                                                   ;0x004b54c9 :        8bce
             mov  dword ptr [ ebp + 0FFFFFEB4h ] , edi                       ;0x004b54cb :        89bdb4feffff
             call Fun41993a                                                  ;0x004b54d1 :        e86444f6ff
             cmp eax , edi                                                   ;0x004b54d6 :        3bc7
             jne Label5ff26a                                                 ;0x004b54d8 :        0f858c9d1400

     Label4b54de ::
             mov  edx , dword ptr [ ebp + 48 ]                               ;0x004b54de :        8b5530
             and edx , 040h                                                  ;0x004b54e1 :        83e240
             movzx ecx ,word ptr [ ebp + 0FFFFFEB8h ]                        ;0x004b54e4 :        0fb78db8feffff
             jne Label47dd32                                                 ;0x004b54eb :        0f854188fcff
             test ecx , ecx                                                  ;0x004b54f1 :        85c9
             jne Label47dd32                                                 ;0x004b54f3 :        0f853988fcff

     Label4b54f9 ::
             cmp  dword ptr [ ebp + 124 ] , 00h                              ;0x004b54f9 :        837d7c00
             jne Label5ff284                                                 ;0x004b54fd :        0f85819d1400

     Label4b5503 ::


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         mov dword ptr vfpa_labelcaption_islabelcaption,01h


             pushd 01h                                                       ;0x004b5503 :        6a01
             pushd 017h                                                      ;0x004b5505 :        6a17
             pushd 00h                                                       ;0x004b5507 :        6a00


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     ;         lea eax ,  dword ptr [ ebp + 0FFFFFF14h ]                       ;0x004b5509 :        8d8514ffffff

             push ecx
             push esi
             push edi
             mov ecx , 0114h
             lea esi ,  dword ptr [ ebp - 0419Ch ]
             lea edi ,  dword ptr [ ebp + 0FFFFFF14h ]
             rep movsb
             mov  byte ptr [ ebp + 39 ] , 00h
             pop edi
             pop esi
             pop ecx
             lea eax ,  dword ptr [ ebp + 0FFFFFF14h ]                       ;0x004b5509 :        8d8514ffffff


             push eax                                                        ;0x004b550f :        50
             call Fun42628b                                                  ;0x004b5510 :        e8760df7ff


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE LABEL.CAPTION PROPERTY
     ;                                November 2019
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the Label.Caption property is 255,
     ; now the maximum number of characters for the Label.Caption property is 16383.
     ;
     ; 2019/11/12, by ccb
     ;

     Label4b5514 ::
     ;         mov dword ptr vfpa_labelcaption_islabelcaption,00h


     Label4b5515 ::
             mov  ecx , dword ptr [ ebp + 112 ]                              ;0x004b5515 :        8b4d70
             pop edi                                                         ;0x004b5518 :        5f
             pop esi                                                         ;0x004b5519 :        5e
             pop ebx                                                         ;0x004b551a :        5b
             call Fun42bf1d                                                  ;0x004b551b :        e8fd69f7ff
             add ebp , 074h                                                  ;0x004b5520 :        83c574
             leave                                                           ;0x004b5523 :        c9
             ret 04h                                                         ;0x004b5524 :        c20400


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

     2, hentzenwerke.com:
     https://www.hentzenwerke.com/samplechapters/wnvfp9_sc02.pdf

     3, github.io:
     https://jeffpar.github.io/kbarchive/kb/159/Q159269/


6. OTHER:

     For reference only, there is no guarantees.

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