------------------------------------------------------------
                       [BUG/PRB.] VFP 9.0 FIX - PAGE.ENABLED PROPERTY
                                 January 2024
                  ------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), we can set the Page.Enabled property to false (.F.) in the class library,
     but sometimes the Page.Enabled property has not been refreshed.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun4cc1ca :: ; proc near
             push ebp                                                        ;0x004cc1ca :        55
             lea ebp ,  dword ptr [ esp + 0FFFFFDCCh ]                       ;0x004cc1cb :        8dac24ccfdffff
             sub esp , 02C8h                                                 ;0x004cc1d2 :        81ecc8020000
             mov eax ,  dword ptr [ Data937090 ]                             ;0x004cc1d8 :        a190709300
             push ebx                                                        ;0x004cc1dd :        53
             mov  ebx , dword ptr [ Data93888c ]                             ;0x004cc1de :        8b1d8c889300
             push esi                                                        ;0x004cc1e4 :        56
             mov  esi , dword ptr [ ebp + 0244h ]                            ;0x004cc1e5 :        8bb544020000
             mov  dword ptr [ ebp + 0230h ] , eax                            ;0x004cc1eb :        898530020000
             xor eax , eax                                                   ;0x004cc1f1 :        33c0
             push edi                                                        ;0x004cc1f3 :        57
             mov  dword ptr [ ebp - 48 ] , eax                               ;0x004cc1f4 :        8945d0
             mov  dword ptr [ ebp - 52 ] , eax                               ;0x004cc1f7 :        8945cc
             mov edi , ebx                                                   ;0x004cc1fa :        8bfb
             call Fun41de4e                                                  ;0x004cc1fc :        e84d1cf5ff
             push edi                                                        ;0x004cc201 :        57
             mov ebx , eax                                                   ;0x004cc202 :        8bd8
             call Fun41e378                                                  ;0x004cc204 :        e86f21f5ff
             mov  dword ptr [ ebx + 68 ] , eax                               ;0x004cc209 :        894344
             mov  eax , dword ptr [ ebp + 0248h ]                            ;0x004cc20c :        8b8548020000
             test eax , eax                                                  ;0x004cc212 :        85c0
             mov  dword ptr [ ebp - 44 ] , ebx                               ;0x004cc214 :        895dd4
             mov ecx , 049h                                                  ;0x004cc217 :        b949000000
             je Label5df016                                                  ;0x004cc21c :        0f84f42d1100
             xor eax , eax                                                   ;0x004cc222 :        33c0
             lea edi ,  dword ptr [ ebp - 40 ]                               ;0x004cc224 :        8d7dd8
             rep stosd                                                       ;0x004cc227 :        f3ab
             lea edi ,  dword ptr [ ebp - 40 ]                               ;0x004cc229 :        8d7dd8
             pushd 01241h                                                    ;0x004cc22c :        6841120000
             lea edx ,  dword ptr [ ebp - 40 ]                               ;0x004cc231 :        8d55d8

     Label4cc234 ::
             mov ecx , 041h                                                  ;0x004cc234 :        b941000000
             rep movsd                                                       ;0x004cc239 :        f3a5
             mov ecx , ebx                                                   ;0x004cc23b :        8bcb
             pushd 0FFFFFFFFh                                                ;0x004cc23d :        6aff
             movsb                                                           ;0x004cc23f :        a4
             call Fun41e4ef                                                  ;0x004cc240 :        e8aa22f5ff
             test eax , eax                                                  ;0x004cc245 :        85c0
             jne Label5df036                                                 ;0x004cc247 :        0f85e92d1100
             mov  eax , dword ptr [ebx]                                      ;0x004cc24d :        8b03
             mov  eax , dword ptr [eax]                                      ;0x004cc24f :        8b00
             pushd 01h                                                       ;0x004cc251 :        6a01
             call Fun43d469                                                  ;0x004cc253 :        e81112f7ff
             mov  ebx , dword ptr [ebx]                                      ;0x004cc258 :        8b1b
             mov  eax , dword ptr [ ebx + 4 ]                                ;0x004cc25a :        8b4304
             pushd 01h                                                       ;0x004cc25d :        6a01
             call Fun43d469                                                  ;0x004cc25f :        e80512f7ff
             lea edx ,  dword ptr [ ebp - 64 ]                               ;0x004cc264 :        8d55c0
             lea eax ,  dword ptr [ ebp + 0FFFFFF70h ]                       ;0x004cc267 :        8d8570ffffff
             call Fun42c27f                                                  ;0x004cc26d :        e80d00f6ff
             pushd 00h                                                       ;0x004cc272 :        6a00
             push eax                                                        ;0x004cc274 :        50
             call Fun42c2be                                                  ;0x004cc275 :        e84400f6ff
             mov esi , eax                                                   ;0x004cc27a :        8bf0
             add esp , 08h                                                   ;0x004cc27c :        83c408
             test esi , esi                                                  ;0x004cc27f :        85f6
             mov  dword ptr [ ebp - 56 ] , esi                               ;0x004cc281 :        8975c8
             jne Label4cc38c                                                 ;0x004cc284 :        0f8502010000
             pushd 01846h                                                    ;0x004cc28a :        6846180000
             mov eax , 011Ch                                                 ;0x004cc28f :        b81c010000
             call Fun42bf2a                                                  ;0x004cc294 :        e891fcf5ff
             mov  ecx , dword ptr [ ebp + 0250h ]                            ;0x004cc299 :        8b8d50020000
             mov  edx , dword ptr [ ebp + 0248h ]                            ;0x004cc29f :        8b9548020000


     ;
     ;                  -------------------------------------------------
     ;                       VFP 9.0 FIX - PAGE.ENABLED PROPERTY
     ;                                September 2018
     ;                  -------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, sometimes the Page.Enabled property has not been refreshed.
     ;
     ; 2018/9/8, by ccb
     ;

             mov dword ptr vfpa_pageenabled_isdoform,edx


             mov ebx , eax                                                   ;0x004cc2a5 :        8bd8
             mov  eax , dword ptr [ ebp + 0254h ]                            ;0x004cc2a7 :        8b8554020000
             push eax                                                        ;0x004cc2ad :        50
             mov  eax , dword ptr [ ebp + 0240h ]                            ;0x004cc2ae :        8b8540020000
             push ecx                                                        ;0x004cc2b4 :        51
             mov  ecx , dword ptr [ ebp + 023Ch ]                            ;0x004cc2b5 :        8b8d3c020000
             push edx                                                        ;0x004cc2bb :        52
             mov  edx , dword ptr [ ebp - 44 ]                               ;0x004cc2bc :        8b55d4
             push eax                                                        ;0x004cc2bf :        50
             push ecx                                                        ;0x004cc2c0 :        51
             push edx                                                        ;0x004cc2c1 :        52
             mov  dword ptr [ ebp - 52 ] , ebx                               ;0x004cc2c2 :        895dcc
             call Fun4cbfe0                                                  ;0x004cc2c5 :        e816fdffff


     ;
     ;                  -------------------------------------------------
     ;                       VFP 9.0 FIX - PAGE.ENABLED PROPERTY
     ;                                September 2018
     ;                  -------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, sometimes the Page.Enabled property has not been refreshed.
     ;
     ; 2018/9/8, by ccb
     ;

             mov dword ptr vfpa_pageenabled_isdoform,00h


             test eax , eax                                                  ;0x004cc2ca :        85c0
             mov  dword ptr [ ebp - 48 ] , eax                               ;0x004cc2cc :        8945d0
             je Label4cc32e                                                  ;0x004cc2cf :        745d
             mov  edi , dword ptr [ebx]                                      ;0x004cc2d1 :        8b3b
             mov  esi , dword ptr [ ebp + 0244h ]                            ;0x004cc2d3 :        8bb544020000
             mov ecx , 041h                                                  ;0x004cc2d9 :        b941000000
             rep movsd                                                       ;0x004cc2de :        f3a5
             movsb                                                           ;0x004cc2e0 :        a4
             mov  esi , dword ptr [ ebp - 44 ]                               ;0x004cc2e1 :        8b75d4
             mov  eax , dword ptr [esi]                                      ;0x004cc2e4 :        8b06
             mov  edx , dword ptr [eax]                                      ;0x004cc2e6 :        8b10
             mov  ecx , dword ptr [ebx]                                      ;0x004cc2e8 :        8b0b
             mov  dword ptr [ ecx + 0108h ] , edx                            ;0x004cc2ea :        899108010000
             mov  eax , dword ptr [esi]                                      ;0x004cc2f0 :        8b06
             mov  edx , dword ptr [ eax + 4 ]                                ;0x004cc2f2 :        8b5004
             mov  ecx , dword ptr [ebx]                                      ;0x004cc2f5 :        8b0b
             mov  dword ptr [ ecx + 010Ch ] , edx                            ;0x004cc2f7 :        89910c010000
             mov  eax , dword ptr [esi]                                      ;0x004cc2fd :        8b06
             mov  edx , dword ptr [ eax + 112 ]                              ;0x004cc2ff :        8b5070
             mov  ecx , dword ptr [ebx]                                      ;0x004cc302 :        8b0b
             mov  dword ptr [ ecx + 0110h ] , edx                            ;0x004cc304 :        899110010000
             mov  eax , dword ptr [ebx]                                      ;0x004cc30a :        8b03
             mov  edi , dword ptr [ eax + 0108h ]                            ;0x004cc30c :        8bb808010000
             mov  dword ptr [ ebp - 60 ] , eax                               ;0x004cc312 :        8945c4
             call Fun433ef7                                                  ;0x004cc315 :        e8dd7bf6ff
             mov  ecx , dword ptr [ ebp - 60 ]                               ;0x004cc31a :        8b4dc4
             mov  dword ptr [ ecx + 0114h ] , eax                            ;0x004cc31d :        898114010000
             mov  edx , dword ptr [ebx]                                      ;0x004cc323 :        8b13
             mov  dword ptr [ edx + 0118h ] , esi                            ;0x004cc325 :        89b218010000
             mov  esi , dword ptr [ ebp - 56 ]                               ;0x004cc32b :        8b75c8

     Label4cc32e ::
             mov  ecx , dword ptr [ Data937220 ]                             ;0x004cc32e :        8b0d20729300
             lea eax ,  dword ptr [ ebp + 0FFFFFF70h ]                       ;0x004cc334 :        8d8570ffffff
             cmp eax , ecx                                                   ;0x004cc33a :        3bc1
             jne Label5df03d                                                 ;0x004cc33c :        0f85fb2c1100
             mov  ecx , dword ptr [ Data937220 ]                             ;0x004cc342 :        8b0d20729300
             mov  eax , dword ptr [ ecx + 76 ]                               ;0x004cc348 :        8b414c
             cmp  dword ptr [ ebp - 64 ] , eax                               ;0x004cc34b :        3945c0
             mov dword ptr [ Data937220 ] ,  eax                             ;0x004cc34e :        a320729300
             jne Label5df047                                                 ;0x004cc353 :        0f85ee2c1100
             mov  eax , dword ptr [ ebp + 024Ch ]                            ;0x004cc359 :        8b854c020000
             test eax , eax                                                  ;0x004cc35f :        85c0
             je Label4cc368                                                  ;0x004cc361 :        7405
             mov  edx , dword ptr [ ebp - 48 ]                               ;0x004cc363 :        8b55d0
             mov  dword ptr [eax] , edx                                      ;0x004cc366 :        8910

     Label4cc368 ::
             test esi , esi                                                  ;0x004cc368 :        85f6
             jne Label5df051                                                 ;0x004cc36a :        0f85e12c1100
             mov  ecx , dword ptr [ ebp + 0230h ]                            ;0x004cc370 :        8b8d30020000
             mov eax , ebx                                                   ;0x004cc376 :        8bc3
             call Fun42bf1d                                                  ;0x004cc378 :        e8a0fbf5ff
             pop edi                                                         ;0x004cc37d :        5f
             pop esi                                                         ;0x004cc37e :        5e
             pop ebx                                                         ;0x004cc37f :        5b
             add ebp , 0234h                                                 ;0x004cc380 :        81c534020000
             mov esp , ebp                                                   ;0x004cc386 :        8be5
             pop ebp                                                         ;0x004cc388 :        5d
             ret 01Ch                                                        ;0x004cc389 :        c21c00


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

     2, foxite.com:
     https://www.foxite.com/archives/found-bugissue-0000059237.htm


6. OTHER:

     For reference only, there is no guarantees.

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