---------------------------------------------------------------------------------------------------
                      [ENHANCED] VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE APPLICATION SEARCH PATH
                                 January 2024
                 ---------------------------------------------------------------------------------------------------
                                    CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 1023,
     now the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 8191.


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Fun40377a :: ; proc near
             push ebp                                                        ;0x0040377a :        55
             mov ebp , esp                                                   ;0x0040377b :        8bec


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE APPLICATION SEARCH PATH
     ;                                November 2019
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 1023,
     ; now the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 8191.
     ;
     ; 2019/11/20, by ccb
     ;

     ;         sub esp , 0408h                                                 ;0x0040377d :        81ec08040000

             mov eax , 02008h                                                 ;0x0040377d :        81ec08040000
             call Fun42c118


             mov eax ,  dword ptr [ Data937090 ]                             ;0x00403783 :        a190709300
             push ebx                                                        ;0x00403788 :        53
             push edi                                                        ;0x00403789 :        57


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE APPLICATION SEARCH PATH
     ;                                November 2019
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 1023,
     ; now the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 8191.
     ;
     ; 2019/11/20, by ccb
     ;

     ;         pushd 0400h                                                     ;0x0040378a :        6800040000
     ;         pushd offset Data918f58                                                  ;0x0040378f :        68588f9100
     ;         lea ebx ,  dword ptr [ ebp + 0FFFFFBF8h ]                       ;0x00403794 :        8d9df8fbffff

             pushd 02000h                                                     ;0x0040378a :        6800040000
             pushd offset Data918f58                                                  ;0x0040378f :        68588f9100
             lea ebx ,  dword ptr [ ebp - 02008h ]                       ;0x00403794 :        8d9df8fbffff


             mov  dword ptr [ ebp - 4 ] , eax                                ;0x0040379a :        8945fc
             call Fun41513d                                                  ;0x0040379d :        e89b190100
             test eax , eax                                                  ;0x004037a2 :        85c0
             je Label4037be                                                  ;0x004037a4 :        7418


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE APPLICATION SEARCH PATH
     ;                                November 2019
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 1023,
     ; now the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 8191.
     ;
     ; 2019/11/20, by ccb
     ;

     ;         mov edx , 0400h                                                 ;0x004037a6 :        ba00040000
             mov edx , 02000h                                                 ;0x004037a6 :        ba00040000


             mov ecx , ebx                                                   ;0x004037ab :        8bcb
             call Fun41b81c                                                  ;0x004037ad :        e86a800100


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE APPLICATION SEARCH PATH
     ;                                November 2019
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 1023,
     ; now the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 8191.
     ;
     ; 2019/11/20, by ccb
     ;

     ;         mov dword ptr vfpa_searchpath_issearchpath,01h


             mov edi , offset Data935b20                                              ;0x004037b2 :        bf205b9300
             mov edx , ebx                                                   ;0x004037b7 :        8bd3
             call Fun414b0d                                                  ;0x004037b9 :        e84f130100


     ;
     ;                 ----------------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE APPLICATION SEARCH PATH
     ;                                November 2019
     ;                 ----------------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; In vfp9, the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 1023,
     ; now the maximum number of characters for the application search path (from the MS-DOS environment variable PATH) is 8191.
     ;
     ; 2019/11/20, by ccb
     ;

     Label4037bd ::
     ;         mov dword ptr vfpa_searchpath_issearchpath,00h


     Label4037be ::
             mov  ecx , dword ptr [ ebp - 4 ]                                ;0x004037be :        8b4dfc
             call Fun42bf1d                                                  ;0x004037c1 :        e857870200
             pop edi                                                         ;0x004037c6 :        5f
             pop ebx                                                         ;0x004037c7 :        5b
             leave                                                           ;0x004037c8 :        c9
             ret                                                             ;0x004037c9 :        c3


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_vfp9fix100.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix103.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix287.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix354.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix355.asp


6. OTHER:

     For reference only, there is no guarantees.

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