--------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - CHECK THE REPORT SYSTEM VARIABLES
                                  March 2024
                 --------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9, for the following code:
     SET REPORTBEHAVIOR 90
     _REPORTBUILDER = ""
     _REPORTPREVIEW = ""
     _REPORTOUTPUT = ""
     REPORT FORM test.frx PREVIEW
     it causes the error "Variable '_REPORTOUTPUT' is not found (Error 12)".

     In VFP Advanced, it displays the warning message "The _REPORTPREVIEW system variable is empty",
     and then it displays the warning message "The _REPORTOUTPUT system variable is empty",
     and then it causes the error "File '_REPORTOUTPUT' does not exist (Error 1)".


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     Fun4a326a :: ; proc near
             push ebp                                                        ;0x004a326a :        55
             lea ebp ,  dword ptr [ esp - 108 ]                              ;0x004a326b :        8d6c2494
             sub esp , 0468h                                                 ;0x004a326f :        81ec68040000
             mov eax ,  dword ptr [ Data937090 ]                             ;0x004a327c :        a190709300
             push ebx                                                        ;0x004a3281 :        53
             push esi                                                        ;0x004a3282 :        56
             mov  dword ptr [ ebp + 104 ] , eax                              ;0x004a3283 :        894568
             push edi                                                        ;0x004a3286 :        57


     ;
     ;                 ---------------------------------------------------------
     ;                      VFP 9.0 FIX - CHECK THE REPORT SYSTEM VARIABLES
     ;                                  March 2024
     ;                 ---------------------------------------------------------
     ;                                     CCB
     ;
     ; Check the report system variables.
     ;
     ; 2024/3/3, by ccb
     ;

             cmp dword ptr vfpa_sys9149_data,00h
             je Label4a3275
             push 06h
             call vfpa_checkreportsystemvariables
             test eax,eax
             je Label4a342a


     Label4a3275 ::
             cmp  dword ptr [ Data93c498 ] , 00h                             ;0x004a3275 :        833d98c4930000
             jne Label561717                                                 ;0x004a3287 :        0f858ae40b00
             lea edx ,  dword ptr [ ebp + 0FFFFFCBCh ]                       ;0x004a328d :        8d95bcfcffff
             call Fun4933e2                                                  ;0x004a3293 :        e84a01ffff
             xor ebx , ebx                                                   ;0x004a3298 :        33db
             call Fun551e94                                                  ;0x004a329a :        e8f5eb0a00
             mov  eax , dword ptr [ ebp + 120 ]                              ;0x004a329f :        8b4578
             mov  dword ptr [ ebp + 76 ] , eax                               ;0x004a32a2 :        89454c
             lea edx ,  dword ptr [ ebp + 0FFFFFCA8h ]                       ;0x004a32a5 :        8d95a8fcffff
             lea eax ,  dword ptr [ ebp + 0FFFFFC54h ]                       ;0x004a32ab :        8d8554fcffff
             mov  dword ptr [ ebp + 0FFFFFCB0h ] , ebx                       ;0x004a32b1 :        899db0fcffff
             call Fun42c27f                                                  ;0x004a32b7 :        e8c38ff8ff
             push ebx                                                        ;0x004a32bc :        53
             push eax                                                        ;0x004a32bd :        50
             call Fun42c2be                                                  ;0x004a32be :        e8fb8ff8ff
             mov esi , eax                                                   ;0x004a32c3 :        8bf0
             cmp esi , ebx                                                   ;0x004a32c5 :        3bf3
             pop ecx                                                         ;0x004a32c7 :        59
             pop ecx                                                         ;0x004a32c8 :        59
             mov  dword ptr [ ebp + 0FFFFFCB8h ] , esi                       ;0x004a32c9 :        89b5b8fcffff
             jne Label4a32e6                                                 ;0x004a32cf :        7515
             push  dword ptr [ ebp + 116 ]                                   ;0x004a32d1 :        ff7574
             lea eax ,  dword ptr [ ebp + 0FFFFFCBCh ]                       ;0x004a32d4 :        8d85bcfcffff
             push eax                                                        ;0x004a32da :        50
             call Fun494cee                                                  ;0x004a32db :        e80e1affff
             mov  dword ptr [ ebp + 0FFFFFCB0h ] , eax                       ;0x004a32e0 :        8985b0fcffff

     Label4a32e6 ::
             lea eax ,  dword ptr [ ebp + 0FFFFFCA8h ]                       ;0x004a32e6 :        8d85a8fcffff
             push eax                                                        ;0x004a32ec :        50
             lea eax ,  dword ptr [ ebp + 0FFFFFC54h ]                       ;0x004a32ed :        8d8554fcffff
             call Fun42d200                                                  ;0x004a32f3 :        e8089ff8ff
             cmp esi , ebx                                                   ;0x004a32f8 :        3bf3
             jne Label561721                                                 ;0x004a32fa :        0f8521e40b00
             cmp  dword ptr [ ebp + 0FFFFFCB0h ] , ebx                       ;0x004a3300 :        399db0fcffff
             je Label561733                                                  ;0x004a3306 :        0f8427e40b00
             cmp  dword ptr [ ebp + 76 ] , ebx                               ;0x004a330c :        395d4c
             je Label561743                                                  ;0x004a330f :        0f842ee40b00

     Label4a3315 ::
             mov  eax , dword ptr [ ebp + 76 ]                               ;0x004a3315 :        8b454c
             cmp eax , ebx                                                   ;0x004a3318 :        3bc3
             mov  dword ptr [ Data93c2e0 ] , ebx                             ;0x004a331a :        891de0c29300
             je Label4a3337                                                  ;0x004a3320 :        7415
             mov  dword ptr [ ebp + 0FFFFFCA4h ] , eax                       ;0x004a3322 :        8985a4fcffff
             lea eax ,  dword ptr [ ebp + 0FFFFFCA4h ]                       ;0x004a3328 :        8d85a4fcffff
             push eax                                                        ;0x004a332e :        50
             call Fun498e59                                                  ;0x004a332f :        e8255bffff
             mov  dword ptr [ ebp + 80 ] , eax                               ;0x004a3334 :        894550

     Label4a3337 ::
             lea eax ,  dword ptr [ ebp + 0FFFFFCC0h ]                       ;0x004a3337 :        8d85c0fcffff
             push eax                                                        ;0x004a333d :        50
             call Fun493452                                                  ;0x004a333e :        e80f01ffff
             xor edx , edx                                                   ;0x004a3343 :        33d2
             cmp eax , ebx                                                   ;0x004a3345 :        3bc3
             setne dl                                                        ;0x004a3347 :        0f95c2
             mov ecx , 020000h                                               ;0x004a334a :        b900000200
             mov  dword ptr [ ebp + 0FFFFFCB4h ] , eax                       ;0x004a334f :        8985b4fcffff
             shl edx , 011h                                                  ;0x004a3355 :        c1e211
             xor  edx , dword ptr [ ebp + 0FFFFFCBCh ]                       ;0x004a3358 :        3395bcfcffff
             and edx , ecx                                                   ;0x004a335e :        23d1
             xor  dword ptr [ ebp + 0FFFFFCBCh ] , edx                       ;0x004a3360 :        3195bcfcffff
             test  dword ptr [ ebp + 0FFFFFCBCh ] , ecx                      ;0x004a3366 :        858dbcfcffff
             jne Label56179a                                                 ;0x004a336c :        0f8528e40b00

     Label4a3372 ::
             mov  esi , dword ptr [ ebp + 80 ]                               ;0x004a3372 :        8b7550
             xor edi , edi                                                   ;0x004a3375 :        33ff
             inc edi                                                         ;0x004a3377 :        47
             test esi , esi                                                  ;0x004a3378 :        85f6
             mov ebx , edi                                                   ;0x004a337a :        8bdf
             je Label4a33a2                                                  ;0x004a337c :        7424
             lea eax ,  dword ptr [ ebp + 0FFFFFCBCh ]                       ;0x004a337e :        8d85bcfcffff
             push eax                                                        ;0x004a3384 :        50
             mov  dword ptr [ Data93c498 ] , edi                             ;0x004a3385 :        893d98c49300
             call Fun4954ca                                                  ;0x004a338b :        e83a21ffff
             mov ebx , eax                                                   ;0x004a3390 :        8bd8
             mov  eax , dword ptr [ ebp + 80 ]                               ;0x004a3392 :        8b4550
             cmp  byte ptr [ eax + 03EAh ] , 00h                             ;0x004a3395 :        80b8ea03000000
             jne Label5617b9                                                 ;0x004a339c :        0f8517e40b00

     Label4a33a2 ::
             test ebx , ebx                                                  ;0x004a33a2 :        85db
             je Label4a33d2                                                  ;0x004a33a4 :        742c
             test  byte ptr [ ebp + 0FFFFFCBEh ] , 08h                       ;0x004a33a6 :        f685befcffff08
             jne Label5617d1                                                 ;0x004a33ad :        0f851ee40b00

     Label4a33b3 ::
             test ebx , ebx                                                  ;0x004a33b3 :        85db
             je Label4a33d2                                                  ;0x004a33b5 :        741b
             push  dword ptr [ ebp + 124 ]                                   ;0x004a33b7 :        ff757c
             lea eax ,  dword ptr [ ebp + 0FFFFFCBCh ]                       ;0x004a33ba :        8d85bcfcffff
             push  dword ptr [ ebp + 0FFFFFCB4h ]                            ;0x004a33c0 :        ffb5b4fcffff
             push eax                                                        ;0x004a33c6 :        50
             call Fun4a2f64                                                  ;0x004a33c7 :        e898fbffff
             mov  dword ptr [ ebp + 0FFFFFCB8h ] , eax                       ;0x004a33cc :        8985b8fcffff

     Label4a33d2 ::
             mov  eax , dword ptr [ ebp + 80 ]                               ;0x004a33d2 :        8b4550
             test eax , eax                                                  ;0x004a33d5 :        85c0
             je Label4a33fe                                                  ;0x004a33d7 :        7425
             call Fun4a4837                                                  ;0x004a33d9 :        e859140000
             cmp  dword ptr [ ebp + 0FFFFFCB8h ] , 00h                       ;0x004a33de :        83bdb8fcffff00
             jne Label4a33f7                                                 ;0x004a33e5 :        7510
             mov  eax , dword ptr [ ebp + 80 ]                               ;0x004a33e7 :        8b4550
             cmp  byte ptr [ eax + 03EAh ] , 00h                             ;0x004a33ea :        80b8ea03000000
             jne Label56183e                                                 ;0x004a33f1 :        0f8547e40b00

     Label4a33f7 ::
             and  dword ptr [ Data93c498 ] , 00h                             ;0x004a33f7 :        832598c4930000

     Label4a33fe ::
             test  byte ptr [ ebp + 0FFFFFCBEh ] , 02h                       ;0x004a33fe :        f685befcffff02
             jne Label561854                                                 ;0x004a3405 :        0f8549e40b00

     Label4a340b ::
             and  dword ptr [ Data93c2e0 ] , 00h                             ;0x004a340b :        8325e0c2930000
             cmp  dword ptr [ ebp + 0FFFFFCB8h ] , 00h                       ;0x004a3412 :        83bdb8fcffff00
             jne Label561864                                                 ;0x004a3419 :        0f8545e40b00

     Label4a341f ::
             lea edi ,  dword ptr [ ebp + 0FFFFFCBCh ]                       ;0x004a341f :        8dbdbcfcffff
             call Fun4a3950                                                  ;0x004a3425 :        e826050000

     Label4a342a ::
             mov  ecx , dword ptr [ ebp + 104 ]                              ;0x004a342a :        8b4d68
             call Fun42bf1d                                                  ;0x004a342d :        e8eb8af8ff
             pop edi                                                         ;0x004a3432 :        5f
             pop esi                                                         ;0x004a3433 :        5e
             pop ebx                                                         ;0x004a3434 :        5b
             add ebp , 06Ch                                                  ;0x004a3435 :        83c56c
             leave                                                           ;0x004a3438 :        c9
             ret 0Ch                                                         ;0x004a3439 :        c20c00


4. APPLIES TO:

     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_vfpsystemvariables.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix311.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix313.asp

     2, narkive.com:
     https://microsoft.public.fox.programmer.exchange.narkive.com/2hSBfZEw/variable-reportoutput-is-not-found
     https://microsoft.public.fox.vfp.reports.printing.narkive.com/OdCMQ4my/reportbehavior-90-what-else-do-i-need

     3, berezniker.com:
     https://www.berezniker.com/content/pages/visual-foxpro/vfp-90-report-features-runtime

     4, spacefold.com:
     https://spacefold.com/articles/rsfundamentals-part1/rsfundamentals-part2/

     5, foxite.com:
     https://www.foxite.com/archives/reportoutput-reports-0000332941.htm
     https://www.foxite.com/archives/error-in-report-viewing-0000366739.htm
     https://www.foxite.com/archives/foxypreviewer-error-0000327798.htm
     https://www.foxite.com/archives/foxypreviewer-problem-0000344450.htm
     https://www.foxite.com/archives/reportoutput-0000251654.htm
     https://www.foxite.com/archives/reportoutput-error-0000429190.htm
     https://www.foxite.com/archives/reportoutput-variable-is-not-found-0000213529.htm
     https://www.foxite.com/archives/dynamic-formatting-in-reports-0000455946.htm
     https://www.foxite.com/archives/reprot-label-0000163674.htm
     https://www.foxite.com/archives/rpeort-0000335877.htm
     https://www.foxite.com/archives/variable-reportoutput-is-not-found-0000230042.htm


6. OTHER:

     For reference only, there is no guarantees.

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