--------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - MAKE THE PROJECT MANAGER WINDOW VISIBLE WHEN BUILDING A PROJECT
                                  April 2021
                 --------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), sometimes the Project Manager window become visible.

     For example, run the following code in vfp5,
     BUILD EXE testproject.exe FROM testproject.pjx
     and then run the following code in vfp9:
     MODIFY PROJECT testproject.pjx NOSHOW
     _VFP.ACTIVEPROJECT.BUILD("testproject.exe",3)
     the Project Manager window become visible.

     The bug only occurs when there are some database files in the project file and the database files are compiled with different versions of FoxPro.

     The bug was reported by Doug Hennig.


2. CAUSE:

     In vfp9 (and vfp6, vfp7, vfp8), when we run the code:
     MODIFY PROJECT testproject.pjx NOSHOW
     _VFP.ACTIVEPROJECT.BUILD("testproject.exe",3)
     if there are some database files in the project file,
     it will run the COMPILE DATABASE command,
     if the database files are compiled with different versions of FoxPro,
     the Project Manager become visible.

     There is a field objrev (Object Revision) in a project file, it saves the Visual FoxPro object file version information, please refer to:
     ----------------------------------------------------------------------------------------------
     | Object Revision Stamp | Visual FoxPro Object File Version Information                      |
     ----------------------------------------------------------------------------------------------
     |      0x21B (539)      | The object file is compiled with Visual FoxPro 3.0                 |
     |      0x21F (543)      | The object file is compiled with Visual FoxPro 5.0                 |
     |      0x220 (544)      | The object file is compiled with Visual FoxPro 6.0, 7.0, 8.0, 9.0  |
     |      0x221 (545)      | The object file is compiled with Visual FoxPro X(10?)              |
     |      0x222 (546)      | The object file is compiled with Visual FoxPro Advanced            |
     ----------------------------------------------------------------------------------------------


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun6f4e8b :: ; proc near
             push ebp                                                        ;0x006f4e8b :        55
             lea ebp ,  dword ptr [ esp + 0FFFFFEF4h ]                       ;0x006f4e8c :        8dac24f4feffff
             sub esp , 0198h                                                 ;0x006f4e93 :        81ec98010000
             mov eax ,  dword ptr [ Data937090 ]                             ;0x006f4e99 :        a190709300
             push ebx                                                        ;0x006f4e9e :        53
             push esi                                                        ;0x006f4e9f :        56
             mov  dword ptr [ ebp + 0108h ] , eax                            ;0x006f4ea0 :        898508010000
             movzx eax ,byte ptr [ Data947420 ]                              ;0x006f4ea6 :        0fb60520749400
             push edi                                                        ;0x006f4ead :        57
             push  dword ptr [ ebp + 0114h ]                                 ;0x006f4eae :        ffb514010000
             mov  dword ptr [ ebp - 16 ] , eax                               ;0x006f4eb4 :        8945f0
             call Fun6d38bc                                                  ;0x006f4eb7 :        e800eafdff
             xor ebx , ebx                                                   ;0x006f4ebc :        33db
             mov esi , eax                                                   ;0x006f4ebe :        8bf0
             mov  eax , dword ptr [ ebp + 011Ch ]                            ;0x006f4ec0 :        8b851c010000
             inc ebx                                                         ;0x006f4ec6 :        43
             test esi , esi                                                  ;0x006f4ec7 :        85f6
             mov dword ptr [ Data94663c ] ,  eax                             ;0x006f4ec9 :        a33c669400
             jne Label6f4fc2                                                 ;0x006f4ece :        0f85ee000000
             and  dword ptr [ ebp - 28 ] , esi                               ;0x006f4ed4 :        2175e4
             pushd 018h                                                      ;0x006f4ed7 :        6a18
             pop ecx                                                         ;0x006f4ed9 :        59
             xor eax , eax                                                   ;0x006f4eda :        33c0
             lea edi ,  dword ptr [ ebp + 0FFFFFF78h ]                       ;0x006f4edc :        8dbd78ffffff
             rep stosd                                                       ;0x006f4ee2 :        f3ab
             mov  eax , dword ptr [ ebp + 0114h ]                            ;0x006f4ee4 :        8b8514010000
             lea ecx ,  dword ptr [ ebp - 8 ]                                ;0x006f4eea :        8d4df8
             push ecx                                                        ;0x006f4eed :        51
             push eax                                                        ;0x006f4eee :        50
             mov  dword ptr [ ebp + 0FFFFFF78h ] , offset Fun7009cf                  ;0x006f4eef :        c78578ffffffcf097000
             mov  dword ptr [ ebp - 120 ] , offset Label6fbaa8                         ;0x006f4ef9 :        c74588a8ba6f00
             mov  dword ptr [ ebp - 104 ] , offset Label6fcc1b                         ;0x006f4f00 :        c745981bcc6f00
             mov  dword ptr [ ebp - 88 ] , offset Label6fde6a                          ;0x006f4f07 :        c745a86ade6f00
             mov  dword ptr [ ebp - 72 ] , offset Label6fee03                          ;0x006f4f0e :        c745b803ee6f00
             mov  dword ptr [ ebp - 56 ] , offset Label6ffc72                          ;0x006f4f15 :        c745c872fc6f00
             mov  dword ptr [ ebp + 0FFFFFF7Ch ] , ebx                       ;0x006f4f1c :        899d7cffffff
             mov  dword ptr [ ebp - 116 ] , ebx                              ;0x006f4f22 :        895d8c
             mov  dword ptr [ ebp - 100 ] , ebx                              ;0x006f4f25 :        895d9c
             mov  dword ptr [ ebp - 84 ] , ebx                               ;0x006f4f28 :        895dac
             mov  dword ptr [ ebp - 68 ] , ebx                               ;0x006f4f2b :        895dbc
             mov  dword ptr [ ebp - 52 ] , ebx                               ;0x006f4f2e :        895dcc
             mov  dword ptr [ ebp - 128 ] , ebx                              ;0x006f4f31 :        895d80
             mov  dword ptr [ ebp - 112 ] , ebx                              ;0x006f4f34 :        895d90
             mov  dword ptr [ ebp - 96 ] , ebx                               ;0x006f4f37 :        895da0
             mov  dword ptr [ ebp - 80 ] , ebx                               ;0x006f4f3a :        895db0
             mov  dword ptr [ ebp - 64 ] , ebx                               ;0x006f4f3d :        895dc0
             mov  dword ptr [ ebp - 48 ] , ebx                               ;0x006f4f40 :        895dd0
             mov  dword ptr [ ebp - 124 ] , ebx                              ;0x006f4f43 :        895d84
             mov  dword ptr [ ebp - 108 ] , ebx                              ;0x006f4f46 :        895d94
             mov  dword ptr [ ebp - 92 ] , ebx                               ;0x006f4f49 :        895da4
             mov  dword ptr [ ebp - 76 ] , ebx                               ;0x006f4f4c :        895db4
             mov  dword ptr [ ebp - 60 ] , ebx                               ;0x006f4f4f :        895dc4
             mov  dword ptr [ ebp - 44 ] , ebx                               ;0x006f4f52 :        895dd4
             mov  dword ptr [ ebp - 40 ] , 0104Dh                            ;0x006f4f55 :        c745d84d100000
             mov  dword ptr [ ebp - 36 ] , 0D103h                            ;0x006f4f5c :        c745dc03d10000
             mov  dword ptr [ ebp - 32 ] , eax                               ;0x006f4f63 :        8945e0
             mov  dword ptr [ ebp - 24 ] , offset Fun6f3c04                          ;0x006f4f66 :        c745e8043c6f00
             mov  dword ptr [ ebp - 20 ] , offset Fun6f2194                          ;0x006f4f6d :        c745ec94216f00
             call Fun4fd947                                                  ;0x006f4f74 :        e8ce89e0ff
             cmp  dword ptr [ ebp + 0120h ] , esi                            ;0x006f4f79 :        39b520010000
             push  dword ptr [ ebp + 011Ch ]                                 ;0x006f4f7f :        ffb51c010000
             setne al                                                        ;0x006f4f85 :        0f95c0
             dec al                                                          ;0x006f4f88 :        fec8
             and  eax , dword ptr [ Data947420 ]                             ;0x006f4f8a :        230520749400
             mov byte ptr [ Data947420 ] ,  al                               ;0x006f4f90 :        a220749400
             lea eax ,  dword ptr [ ebp - 8 ]                                ;0x006f4f95 :        8d45f8
             push eax                                                        ;0x006f4f98 :        50
             pushd 06h                                                       ;0x006f4f99 :        6a06
             lea eax ,  dword ptr [ ebp + 0FFFFFF78h ]                       ;0x006f4f9b :        8d8578ffffff
             push eax                                                        ;0x006f4fa1 :        50
             lea eax ,  dword ptr [ ebp - 40 ]                               ;0x006f4fa2 :        8d45d8
             push eax                                                        ;0x006f4fa5 :        50
             call Fun6d330d                                                  ;0x006f4fa6 :        e862e3fdff
             mov esi , eax                                                   ;0x006f4fab :        8bf0
             test esi , esi                                                  ;0x006f4fad :        85f6
             mov  al , byte ptr [ ebp - 16 ]                                 ;0x006f4faf :        8a45f0
             mov byte ptr [ Data947420 ] ,  al                               ;0x006f4fb2 :        a220749400
             je Label6f509a                                                  ;0x006f4fb7 :        0f84dd000000
             call Fun6eef80                                                  ;0x006f4fbd :        e8be9fffff

     Label6f4fc2 ::
             call Fun6f4d9c                                                  ;0x006f4fc2 :        e8d5fdffff
             mov edi , esi                                                   ;0x006f4fc7 :        8bfe
             call Fun6f4b8f                                                  ;0x006f4fc9 :        e8c1fbffff
             call Fun6f4d45                                                  ;0x006f4fce :        e872fdffff
             mov ecx , esi                                                   ;0x006f4fd3 :        8bce
             call Fun700dd9                                                  ;0x006f4fd5 :        e8ffbd0000
             xor edi , edi                                                   ;0x006f4fda :        33ff
             cmp  dword ptr [ ebp + 011Ch ] , edi                            ;0x006f4fdc :        39bd1c010000
             jne Label6f4ff2                                                 ;0x006f4fe2 :        750e
             push edi                                                        ;0x006f4fe4 :        57
             mov eax , esi                                                   ;0x006f4fe5 :        8bc6
             call Fun6d3850                                                  ;0x006f4fe7 :        e864e8fdff
             mov  dword ptr [ ebp + 011Ch ] , eax                            ;0x006f4fec :        89851c010000

     Label6f4ff2 ::
             lea eax ,  dword ptr [ ebp - 12 ]                               ;0x006f4ff2 :        8d45f4
             push eax                                                        ;0x006f4ff5 :        50
             push  dword ptr [ ebp + 011Ch ]                                 ;0x006f4ff6 :        ffb51c010000
             mov  eax , dword ptr [esi]                                      ;0x006f4ffc :        8b06
             mov  ecx , dword ptr [ eax + 4 ]                                ;0x006f4ffe :        8b4804
             pushd 04h                                                       ;0x006f5001 :        6a04
             pop edx                                                         ;0x006f5003 :        5a
             call Fun4817c4                                                  ;0x006f5004 :        e8bbc7d8ff
             mov  edx , dword ptr [ ebp - 12 ]                               ;0x006f5009 :        8b55f4
             cmp edx , edi                                                   ;0x006f500c :        3bd7
             je Label6f501d                                                  ;0x006f500e :        740d
             mov  eax , dword ptr [ ebp + 011Ch ]                            ;0x006f5010 :        8b851c010000
             mov ecx , esi                                                   ;0x006f5016 :        8bce
             call Fun6f4dc3                                                  ;0x006f5018 :        e8a6fdffff

     Label6f501d ::
             cmp  dword ptr [ ebp + 0118h ] , 03h                            ;0x006f501d :        83bd1801000003
             je Label6f5042                                                  ;0x006f5024 :        741c
             cmp  dword ptr [ ebp + 0118h ] , ebx                            ;0x006f5026 :        399d18010000
             jne Label6f5035                                                 ;0x006f502c :        7507


     ;
     ;                 ---------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - MAKE THE PROJECT MANAGER WINDOW VISIBLE WHEN BUILDING A PROJECT
     ;                                  April 2021
     ;                 ---------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Make the Project Manager window visible when building a project.
     ;
     ; 2021/4/27, by ccb
     ;

             cmp dword ptr vfpa_sys9060_data,00h
             jne Label6f502e
             cmp dword ptr [ esp + 01A8h ] , offset Label5b4a40 ;; Fun4b985f :: ; proc near
             jne Label6f502e
             cmp dword ptr [ esp + 01A8h +(4+14h+6Ch) ] , offset Label829807 ;; Fun82978f :: ; proc near
             jne Label6f502e
             cmp dword ptr [ esp + 01A8h +(4+14h+6Ch) + (4+00h+04B4h) ] , offset Label8298f1 ;; Fun829827 :: ; proc near
             jne Label6f502e
             jmp Label6f5033


     Label6f502e ::
             call Fun6d379a                                                  ;0x006f502e :        e867e7fdff

     Label6f5033 ::
             jmp Label6f5042                                                 ;0x006f5033 :        eb0d

     Label6f5035 ::
             cmp  dword ptr [ ebp + 0118h ] , edi                            ;0x006f5035 :        39bd18010000
             jne Label6f5042                                                 ;0x006f503b :        7505
             call Fun6d37b5                                                  ;0x006f503d :        e873e7fdff

     Label6f5042 ::
             call Fun6d37e7                                                  ;0x006f5042 :        e8a0e7fdff
             mov edi , esi                                                   ;0x006f5047 :        8bfe
             call Fun6d380e                                                  ;0x006f5049 :        e8c0e7fdff
             pushd 0FFFFFFFFh                                                ;0x006f504e :        6aff
             mov ebx , esi                                                   ;0x006f5050 :        8bde
             call Fun6f4912                                                  ;0x006f5052 :        e8bbf8ffff
             call Fun6f4b31                                                  ;0x006f5057 :        e8d5faffff
             push  dword ptr [ ebp + 0124h ]                                 ;0x006f505c :        ffb524010000
             push  dword ptr [ ebp + 0120h ]                                 ;0x006f5062 :        ffb520010000
             call Fun6f4e12                                                  ;0x006f5068 :        e8a5fdffff
             mov  eax , dword ptr [ ebp + 0114h ]                            ;0x006f506d :        8b8514010000
             test eax , eax                                                  ;0x006f5073 :        85c0
             je Label6f50b4                                                  ;0x006f5075 :        743d
             test  byte ptr [ eax + 16 ] , 020h                              ;0x006f5077 :        f6401020
             je Label6f50b4                                                  ;0x006f507b :        7437
             mov eax , esi                                                   ;0x006f507d :        8bc6
             call Fun6d39cb                                                  ;0x006f507f :        e847e9fdff
             test eax , eax                                                  ;0x006f5084 :        85c0
             je Label6f509a                                                  ;0x006f5086 :        7412
             mov ecx , esi                                                   ;0x006f5088 :        8bce
             call Fun6d3950                                                  ;0x006f508a :        e8c1e8fdff
             mov edi , eax                                                   ;0x006f508f :        8bf8
             mov ax , 02h                                                    ;0x006f5091 :        66b80200
             call Fun8ec9b0                                                  ;0x006f5095 :        e816791f00

     Label6f509a ::
             mov eax , esi                                                   ;0x006f509a :        8bc6

     Label6f509c ::
             mov  ecx , dword ptr [ ebp + 0108h ]                            ;0x006f509c :        8b8d08010000
             call Fun42bf1d                                                  ;0x006f50a2 :        e8766ed3ff
             pop edi                                                         ;0x006f50a7 :        5f
             pop esi                                                         ;0x006f50a8 :        5e
             pop ebx                                                         ;0x006f50a9 :        5b
             add ebp , 010Ch                                                 ;0x006f50aa :        81c50c010000
             leave                                                           ;0x006f50b0 :        c9
             ret 014h                                                        ;0x006f50b1 :        c21400


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_vfp9fix171.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix118.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix119.asp
     http://www.baiyujia.com/vfpdocuments/f_vhfox.asp

     2, rickschummer.com:
     http://rickschummer.com/articles/projfile.htm


6. OTHER:

     For reference only, there is no guarantees.

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