-----------------------------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - LOCATE A FILE SPECIFIED WITH AN ABSOLUTE PATH IN THE VISUAL FOXPRO SEARCH PATH
                                September 2024
                 -----------------------------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), if a file specified with an absolute path does not exist,
     it will locate the file in the Visual FoxPro search path.

     The bug occurs when SET("COMPATIBLE")="OFF" (the default setting), it does not occur when SET("COMPATIBLE")="ON".

     In VFP Advanced, if a file specified with an absolute path does not exist,
     it will not locate the file in the Visual FoxPro search path.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label42c764 ::
             pushd 00h                                                       ;0x0042c764 :        6a00
             lea edx ,  dword ptr [ ebp - 48 ]                               ;0x0042c766 :        8d55d0
             push edx                                                        ;0x0042c769 :        52
             lea eax ,  dword ptr [ ebp - 44 ]                               ;0x0042c76a :        8d45d4
             push eax                                                        ;0x0042c76d :        50
             push ebx                                                        ;0x0042c76e :        53
             pushd 00h                                                       ;0x0042c76f :        6a00
             push ebx                                                        ;0x0042c771 :        53
             call Fun42cd23                                                  ;0x0042c772 :        e8ac050000
             test eax , eax                                                  ;0x0042c777 :        85c0
             jne Label42cc7f                                                 ;0x0042c779 :        0f8500050000
             mov ecx , 041h                                                  ;0x0042c77f :        b941000000
             mov esi , ebx                                                   ;0x0042c784 :        8bf3
             lea edi ,  dword ptr [ ebp - 8 ]                                ;0x0042c786 :        8d7df8
             rep movsd                                                       ;0x0042c789 :        f3a5
             lea ecx ,  dword ptr [ ebp - 8 ]                                ;0x0042c78b :        8d4df8
             movsb                                                           ;0x0042c78e :        a4
             call Fun42c8bb                                                  ;0x0042c78f :        e827010000
             mov  ecx , dword ptr [ ebp + 0118h ]                            ;0x0042c794 :        8b8d18010000
             and ecx , 01h                                                   ;0x0042c79a :        83e101
             push ecx                                                        ;0x0042c79d :        51
             lea edx ,  dword ptr [ ebp - 8 ]                                ;0x0042c79e :        8d55f8
             push edx                                                        ;0x0042c7a1 :        52
             call Fun42c9be                                                  ;0x0042c7a2 :        e817020000
             test eax , eax                                                  ;0x0042c7a7 :        85c0
             jne Label42cc7f                                                 ;0x0042c7a9 :        0f85d0040000
             mov esi , ebx                                                   ;0x0042c7af :        8bf3
             mov  dword ptr [ ebp - 16 ] , eax                               ;0x0042c7b1 :        8945f0
             call Fun435040                                                  ;0x0042c7b4 :        e887880000
             mov  ecx , dword ptr [ Data939390 ]                             ;0x0042c7b9 :        8b0d90939300
             test ecx , ecx                                                  ;0x0042c7bf :        85c9
             mov  dword ptr [ ebp - 32 ] , eax                               ;0x0042c7c1 :        8945e0
             jne Label598a24                                                 ;0x0042c7c4 :        0f855ac21600

     Label42c7ca ::
             mov  ecx , dword ptr [ ebp + 0114h ]                            ;0x0042c7ca :        8b8d14010000


     ;
     ;                 ------------------------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - LOCATE A FILE SPECIFIED WITH AN ABSOLUTE PATH IN THE VISUAL FOXPRO SEARCH PATH
     ;                                September 2024
     ;                 ------------------------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; Locate a file specified with an absolute path in the Visual FoxPro search path.
     ;
     ; 2024/9/29, by ccb
     ;

             mov eax , dword ptr [ ebp - 24 ]
             mov dword ptr [ ebp - 24 ] , ecx
             cmp byte ptr [ecx] , 00h
             je Label42cc7f

             cmp dword ptr vfpa_sys9173_data,0FFFFFFFEh
             je Label42c7cb
             cmp dword ptr vfpa_sys9173_data,0FFFFFFFFh
             je Label42c7cc
             cmp dword ptr vfpa_sys9173_data,00h
             je Label42c7cd
             jmp Label42c7d0

     Label42c7cb ::
             cmp word ptr [eax] , 05C5Ch
             je Label42cc7f
             cmp word ptr [ eax + 1 ] , 05C3Ah
             je Label42cc7f
             cmp byte ptr [ eax + 1 ] , 03Ah
             je Label42cc7f
             cmp byte ptr [eax] , 05Ch
             je Label42cc7f
             jmp Label42c7d0

     Label42c7cc ::
             cmp word ptr [eax] , 05C5Ch
             je Label42cc7f
             cmp word ptr [ eax + 1 ] , 05C3Ah
             je Label42cc7f
             cmp byte ptr [ eax + 1 ] , 03Ah
             je Label42cc7f
             jmp Label42c7d0

     Label42c7cd ::
             cmp word ptr [eax] , 05C5Ch
             je Label42cc7f
             cmp word ptr [ eax + 1 ] , 05C3Ah
             je Label42cc7f
             jmp Label42c7d0


     Label42c7d0 ::
             cmp  byte ptr [ecx] , 00h                                       ;0x0042c7d0 :        803900
             mov  dword ptr [ ebp - 24 ] , ecx                               ;0x0042c7d3 :        894de8
             je Label42cc7f                                                  ;0x0042c7d6 :        0f84a3040000
             xor edx , edx                                                   ;0x0042c7dc :        33d2
             mov eax , ecx                                                   ;0x0042c7de :        8bc1
             mov  dword ptr [ ebp - 20 ] , edx                               ;0x0042c7e0 :        8955ec
             mov edi , edi                                                   ;0x0042c7e3 :        8bff

     Label42c7e5 ::
             test edx , edx                                                  ;0x0042c7e5 :        85d2
             jne Label42c805                                                 ;0x0042c7e7 :        751c
             mov  bl , byte ptr [eax]                                        ;0x0042c7e9 :        8a18
             cmp bl , 03Bh                                                   ;0x0042c7eb :        80fb3b
             je Label41380d                                                  ;0x0042c7ee :        0f841970feff
             cmp bl , 02Ch                                                   ;0x0042c7f4 :        80fb2c
             je Label41380d                                                  ;0x0042c7f7 :        0f841070feff

     Label42c7fd ::
             mov  bl , byte ptr [ eax + 1 ]                                  ;0x0042c7fd :        8a5801
             inc eax                                                         ;0x0042c800 :        40
             test bl , bl                                                    ;0x0042c801 :        84db
             jne Label42c7e5                                                 ;0x0042c803 :        75e0

     Label42c805 ::
             test edx , edx                                                  ;0x0042c805 :        85d2
             mov  dword ptr [ ebp - 20 ] , edx                               ;0x0042c807 :        8955ec
             jne Label413814                                                 ;0x0042c80a :        0f850470feff
             mov eax , ecx                                                   ;0x0042c810 :        8bc1
             lea esi ,  dword ptr [ eax + 1 ]                                ;0x0042c812 :        8d7001
             lea esp ,  dword ptr [ esp ]                                    ;0x0042c815 :        8d2424

     Label42c818 ::
             mov  dl , byte ptr [eax]                                        ;0x0042c818 :        8a10
             inc eax                                                         ;0x0042c81a :        40
             test dl , dl                                                    ;0x0042c81b :        84d2
             jne Label42c818                                                 ;0x0042c81d :        75f9
             sub eax , esi                                                   ;0x0042c81f :        2bc6

     Label42c821 ::
             push eax                                                        ;0x0042c821 :        50
             mov  dword ptr [ ebp - 28 ] , eax                               ;0x0042c822 :        8945e4
             lea eax ,  dword ptr [ ebp - 36 ]                               ;0x0042c825 :        8d45dc
             push eax                                                        ;0x0042c828 :        50
             call Fun434a5b                                                  ;0x0042c829 :        e82d820000

     Label42c82e ::
             lea edx ,  dword ptr [ ebp - 40 ]                               ;0x0042c82e :        8d55d8
             lea eax ,  dword ptr [ ebp - 128 ]                              ;0x0042c831 :        8d4580
             call Fun42c27f                                                  ;0x0042c834 :        e846faffff
             pushd 00h                                                       ;0x0042c839 :        6a00
             push eax                                                        ;0x0042c83b :        50
             call Fun42c2be                                                  ;0x0042c83c :        e87dfaffff
             mov esi , eax                                                   ;0x0042c841 :        8bf0
             add esp , 08h                                                   ;0x0042c843 :        83c408
             test esi , esi                                                  ;0x0042c846 :        85f6
             jne Label42c85b                                                 ;0x0042c848 :        7511
             mov  ecx , dword ptr [ ebp - 32 ]                               ;0x0042c84a :        8b4de0
             push ecx                                                        ;0x0042c84d :        51
             lea edx ,  dword ptr [ ebp - 36 ]                               ;0x0042c84e :        8d55dc
             push edx                                                        ;0x0042c851 :        52
             lea eax ,  dword ptr [ ebp - 8 ]                                ;0x0042c852 :        8d45f8
             push eax                                                        ;0x0042c855 :        50
             call Fun42c5c5                                                  ;0x0042c856 :        e86afdffff

     Label42c85b ::
             mov eax ,  dword ptr [ Data937220 ]                             ;0x0042c85b :        a120729300
             lea ecx ,  dword ptr [ ebp - 128 ]                              ;0x0042c860 :        8d4d80
             cmp ecx , eax                                                   ;0x0042c863 :        3bc8
             jne Label598a31                                                 ;0x0042c865 :        0f85c6c11600
             mov  edx , dword ptr [ Data937220 ]                             ;0x0042c86b :        8b1520729300
             mov  eax , dword ptr [ edx + 76 ]                               ;0x0042c871 :        8b424c
             cmp  dword ptr [ ebp - 40 ] , eax                               ;0x0042c874 :        3945d8
             mov dword ptr [ Data937220 ] ,  eax                             ;0x0042c877 :        a320729300
             jne Label598a3b                                                 ;0x0042c87c :        0f85b9c11600
             test esi , esi                                                  ;0x0042c882 :        85f6
             jne Label598a45                                                 ;0x0042c884 :        0f85bbc11600

     Label42c88a ::
             mov  eax , dword ptr [ ebp + 0118h ]                            ;0x0042c88a :        8b8518010000
             and eax , 01h                                                   ;0x0042c890 :        83e001
             push eax                                                        ;0x0042c893 :        50
             lea ecx ,  dword ptr [ ebp - 8 ]                                ;0x0042c894 :        8d4df8
             push ecx                                                        ;0x0042c897 :        51
             call Fun42c9be                                                  ;0x0042c898 :        e821010000
             test eax , eax                                                  ;0x0042c89d :        85c0
             mov  dword ptr [ ebp - 16 ] , eax                               ;0x0042c89f :        8945f0
             jne Label598a67                                                 ;0x0042c8a2 :        0f85bfc11600

     Label42c8a8 ::
             mov  eax , dword ptr [ ebp - 20 ]                               ;0x0042c8a8 :        8b45ec
             test eax , eax                                                  ;0x0042c8ab :        85c0
             jne Label41381d                                                 ;0x0042c8ad :        0f856a6ffeff
             mov  ebx , dword ptr [ ebp - 12 ]                               ;0x0042c8b3 :        8b5df4
             jmp Label42cc7f                                                 ;0x0042c8b6 :        e9c4030000


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_vfp9fix354.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix100.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix102.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix103.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix287.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix356.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix357.asp

     2, microsoft.com:
     https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats

     3, foxite.com:
     https://www.foxite.com/archives/font-problem-0000364891.htm
     https://www.foxite.com/archives/data-path-disappears-after-compiling-0000304279.htm

     4, tek-tips.com:
     https://www.tek-tips.com/threads/both-sys-2000-and-file-doesnt-wotk-vfp6.1268516/
     https://www.tek-tips.com/threads/file-function-anamoly.392654/


6. OTHER:

     For reference only, there is no guarantees.

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