------------------------------------------------------------ [BUG/PRB.] VFP 9.0 FIX - FULLPATH() FUNCTION January 2024 ------------------------------------------------------------ CCB 1. BUG: In vfp9 (and vfp6, vfp7, vfp8), sometimes the FULLPATH("") function returns wrong result. The bug occurs when SET("COMPATIBLE")="OFF" (the default setting), it does not occur when SET("COMPATIBLE")="ON". The bug occurs when !SET("PATH")=="" (SET PATH TO cPath), it does not occur when SET("PATH")=="" (SET PATH TO). 2. CAUSE: For example, for the following code: SET PATH TO C:\MYPATH CD D:\MYPATH ?FULLPATH("") Usually the FULLPATH("") function returns "D:\MYPATH\", ok. Please refer to the memory dump data: 0019F7EC 00 3A 54 45 53 54 2E 54 58 54 00 00 00 00 00 00 .:TEST.TXT...... byte [0019F7EC] is the path name or the file name, now it is an empty string. If the file "TEST.TXT" is located in the Visual FoxPro path "C:\MYPATH", the FULLPATH("") function returns the full file name "C:\MYPATH\TEST.TXT", it's wrong! There are some BUGs in the following code. 3. RESOLUTION: We can write some code to fix the BUG. Fun435040 :: ; proc near cmp byte ptr [esi] , 05Ch ;0x00435040 : 803e5c je Label598a95 ;0x00435043 : 0f844c3a1600 ; ; ------------------------------------------------- ; VFP 9.0 FIX - FULLPATH() FUNCTION ; November 2023 ; ------------------------------------------------- ; CCB ; ; In vfp9, sometimes the FULLPATH("") function returns wrong result. ; ; 2023/11/19, by ccb ; cmp byte ptr [esi] , 00h je Label435052 Label435049 :: cmp byte ptr [ esi + 1 ] , 03Ah ;0x00435049 : 807e013a lea eax , dword ptr [ esi + 2 ] ;0x0043504d : 8d4602 je Label435054 ;0x00435050 : 7402 Label435052 :: mov eax , esi ;0x00435052 : 8bc6 Label435054 :: ret ;0x00435054 : 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: In vfp9 (and vfp6, vfp7, vfp8), we can use the following code: m.q_file=FULLPATH(IIF(ALLTRIM(m.q_file)=="",ADDBS(SYS(5)+SYS(2003)),m.q_file)) and then there is no the bug. 5. REFERENCE WEBSITES: 1, baiyujia.com: http://www.baiyujia.com 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_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 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |