----------------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - LOCATE SOURCE PROGRAM FILES ON DISK
July 2025
----------------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp6, vfp7, vfp8), when VFP executes a Visual FoxPro program,
if there is no the program file or procedure in the executable file (or the application file),
it will try to locate source program files and compiled program files on disk.
VFP will try to locate source program files and compiled program files on disk in the following commands and functions:
DO command
SET LIBRARY command
SET PROCEDURE command
call UDF (user-defined function), for example, myprogramname()
In VFP Advanced IDE (it is the same as vfp9 IDE), when VFP executes a Visual FoxPro program,
if there is no the program file or procedure in the executable file (or the application file),
it will try to locate source program files and compiled program files on disk.
In VFP Advanced Runtime and VFP Advanced Multi-threaded Runtime,
if we disable locating source program files on disk, when VFP executes a Visual FoxPro program,
if there is no the program file or procedure in the executable file (or the application file),
it will try to locate compiled program files on disk, it will not locate source program files on disk.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun54c1b5 :: ; proc near
push ebp ;0x0054c1b5 : 55
lea ebp , dword ptr [ esp - 120 ] ;0x0054c1b6 : 8d6c2488
sub esp , 03ACh ;0x0054c1ba : 81ecac030000
mov eax , dword ptr [ Data937090 ] ;0x0054c1c0 : a190709300
push ebx ;0x0054c1c5 : 53
push esi ;0x0054c1c6 : 56
mov dword ptr [ ebp + 116 ] , eax ;0x0054c1c7 : 894574
push edi ;0x0054c1ca : 57
lea eax , dword ptr [ ebp + 0FFFFFD50h ] ;0x0054c1cb : 8d8550fdffff
mov edi , ecx ;0x0054c1d1 : 8bf9
push eax ;0x0054c1d3 : 50
mov dword ptr [ ebp + 0FFFFFD38h ] , edi ;0x0054c1d4 : 89bd38fdffff
call Fun54c869 ;0x0054c1da : e88a060000
mov esi , dword ptr [ Data941104 ] ;0x0054c1df : 8b3504119400
xor ecx , ecx ;0x0054c1e5 : 33c9
test esi , esi ;0x0054c1e7 : 85f6
setne cl ;0x0054c1e9 : 0f95c1
mov dword ptr [ ebp + 0FFFFFD44h ] , eax ;0x0054c1ec : 898544fdffff
;
; -----------------------------------------------------------
; VFP 9.0 FIX - LOCATE SOURCE PROGRAM FILES ON DISK
; July 2025
; -----------------------------------------------------------
; CCB
;
; Locate source program files on disk.
;
; 2025/7/19, by ccb
;
cmp dword ptr vfpa_sys9190_data,00h
jne Label54c1f2
mov eax , dword ptr [ ebp + 0FFFFFD44h ]
test eax , eax
jne Label54c1f1
Label54c1f0 ::
mov edx , edi
lea ecx , dword ptr [ ebp + 0FFFFFF68h ]
push edx
push ecx
call lstrcpyA
lea ecx , dword ptr [ ebp + 0FFFFFF68h ]
call Fun42c8bb
lea ecx , dword ptr [ ebp + 0FFFFFD48h ]
mov dword ptr [ecx] , offset Data9200cc
jmp Label54c942
Label54c1f1 ::
mov edx , edi
lea ecx , dword ptr [ ebp + 0FFFFFF68h ]
push edx
push ecx
call lstrcpyA
lea ecx , dword ptr [ ebp + 0FFFFFF68h ]
call Fun42c8bb
lea ecx , dword ptr [ ebp + 0FFFFFD48h ]
push ecx
mov ebx , 01h
lea ecx , dword ptr [ ebp + 0FFFFFF68h ]
call Fun43d930
pushd 02Eh
push edi
call strrchr
add esp , 08h
test eax , eax
je Label54c1f0
inc eax
push dword ptr [ ebp + 0FFFFFD48h ]
push eax
call lstrcpyA
xor ecx , ecx
test esi , esi
setne cl
jmp Label54c1f2
Label54c1f2 ::
mov eax , edi ;0x0054c1f2 : 8bc7
lea esi , dword ptr [ eax + 1 ] ;0x0054c1f4 : 8d7001
dec ecx ;0x0054c1f7 : 49
and ecx , offset Data93a8c0 ;0x0054c1f8 : 81e1c0a89300
lea esp , dword ptr [ esp ] ;0x0054c1fe : 8d2424
Label54c201 ::
mov dl , byte ptr [eax] ;0x0054c201 : 8a10
inc eax ;0x0054c203 : 40
test dl , dl ;0x0054c204 : 84d2
jne Label54c201 ;0x0054c206 : 75f9
pushd 00h ;0x0054c208 : 6a00
push ecx ;0x0054c20a : 51
sub eax , esi ;0x0054c20b : 2bc6
pushd 00h ;0x0054c20d : 6a00
push eax ;0x0054c20f : 50
mov edx , edi ;0x0054c210 : 8bd7
lea ecx , dword ptr [ ebp + 0FFFFFF68h ] ;0x0054c212 : 8d8d68ffffff
call Fun42cc34 ;0x0054c218 : e8170aeeff
lea ecx , dword ptr [ ebp + 0FFFFFD48h ] ;0x0054c21d : 8d8d48fdffff
push ecx ;0x0054c223 : 51
mov ebx , 01h ;0x0054c224 : bb01000000
lea ecx , dword ptr [ ebp + 0FFFFFF68h ] ;0x0054c229 : 8d8d68ffffff
call Fun43d930 ;0x0054c22f : e8fc16efff
mov eax , dword ptr [ ebp + 0FFFFFD44h ] ;0x0054c234 : 8b8544fdffff
test eax , eax ;0x0054c23a : 85c0
je Label54c942 ;0x0054c23c : 0f8400070000
Label54c242 ::
mov eax , dword ptr [ ebp + 0FFFFFD48h ] ;0x0054c242 : 8b8548fdffff
push eax ;0x0054c248 : 50
lea ecx , dword ptr [ ebp + 0FFFFFF68h ] ;0x0054c249 : 8d8d68ffffff
push ecx ;0x0054c24f : 51
mov edx , ecx ;0x0054c250 : 8bd1
push edx ;0x0054c252 : 52
call Fun42d3ac ;0x0054c253 : e85411eeff
pushd 01h ;0x0054c258 : 6a01
lea eax , dword ptr [ ebp + 0FFFFFD28h ] ;0x0054c25a : 8d8528fdffff
push eax ;0x0054c260 : 50
lea ecx , dword ptr [ ebp + 0FFFFFD3Ch ] ;0x0054c261 : 8d8d3cfdffff
push ecx ;0x0054c267 : 51
pushd 00h ;0x0054c268 : 6a00
lea edx , dword ptr [ ebp + 0FFFFFF68h ] ;0x0054c26a : 8d9568ffffff
push edx ;0x0054c270 : 52
pushd 00h ;0x0054c271 : 6a00
call Fun42cd23 ;0x0054c273 : e8ab0aeeff
test eax , eax ;0x0054c278 : 85c0
je Label54c2a7 ;0x0054c27a : 742b
mov ecx , dword ptr [ ebp + 0FFFFFD28h ] ;0x0054c27c : 8b8d28fdffff
mov eax , dword ptr [ ebp + 0FFFFFD3Ch ] ;0x0054c282 : 8b853cfdffff
imul ecx , ecx , 01Ch ;0x0054c288 : 6bc91c
mov eax , dword ptr [eax] ;0x0054c28b : 8b00
mov eax , dword ptr [ ecx + eax + 64 ] ;0x0054c28d : 8b440140
test eax , eax ;0x0054c291 : 85c0
je Label54c2a7 ;0x0054c293 : 7412
Label54c295 ::
mov ecx , dword ptr [ ebp + 116 ] ;0x0054c295 : 8b4d74
call Fun42bf1d ;0x0054c298 : e880fcedff
pop edi ;0x0054c29d : 5f
pop esi ;0x0054c29e : 5e
pop ebx ;0x0054c29f : 5b
add ebp , 078h ;0x0054c2a0 : 83c578
mov esp , ebp ;0x0054c2a3 : 8be5
pop ebp ;0x0054c2a5 : 5d
ret ;0x0054c2a6 : 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.
IMPORTANT NOTE:
For some security reasons, recommend to add the following code to the main program:
IF VERSION(2)=0
=SYS(9190,0) && Disables locating program files on disk in VFP Advanced Runtime and VFP Advanced Multi-threaded Runtime
ENDI
5. REFERENCE WEBSITES:
1, baiyujia.com:
http://www.baiyujia.com
http://www.baiyujia.com/vfpdocuments/f_vfp9fix386.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix28.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_vfp9fix354.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix355.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix356.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix357.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix388.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix389.asp
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|