-----------------------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - FIX THE ASTACKINFO() AND SYS(16) FUNCTIONS
January 2026
-----------------------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp6, vfp7, vfp8), when the executing program is part of an application (.app) or an executable (.exe),
sometimes ASTACKINFO() and SYS(16) return only the name of the program, that is, without the path.
In Visual FoxPro Advanced, if we enable fixing the ASTACKINFO() and SYS(16) functions,
when the executing program is part of an application (.app) or an executable (.exe),
ASTACKINFO() and SYS(16) always return a full path name.
There is a test program:
*testsys16.prg:
DO ("TESTSYS162A\TESTSYS162A.EXE")
DO ("TESTSYS163A\TESTSYS163A.EXE")
DO ("TESTSYS162B\TESTSYS162B.EXE")
DO ("TESTSYS163B\TESTSYS163B.EXE")
RETURN
*testsys162a.prg:
?"SYS(16) = "+SYS(16) && it displays "C:\...\TESTSYS16_PROGRAM\TESTSYS162A\TESTSYS162A.EXE" in vfp9 and Visual FoxPro Advanced, ok.
WAIT
RETURN
*testsys163a.prg:
?"SYS(16) = "+SYS(16) && it displays "C:\...\TESTSYS16_PROGRAM\TESTSYS163A\TESTSYS163A.EXE" in vfp9 and Visual FoxPro Advanced, ok.
WAIT
RETURN
*testsys162b.prg:
DO ("TESTSYS168.FXP")
RETURN
*testsys168.prg:
?"SYS(16) = "+SYS(16) && it displays "TESTSYS168.FXP" (no path) in vfp9,
WAIT && it displays "TESTSYS168.FXP IN C:\...\TESTSYS16_PROGRAM\TESTSYS162B\TESTSYS162B.EXE" in Visual FoxPro Advanced, ok.
RETURN
*testsys163b.prg:
DO ("TESTSYS168.FXP")
RETURN
*testsys168.prg:
?"SYS(16) = "+SYS(16) && it displays "TESTSYS168.FXP" (no path) in vfp9,
WAIT && it displays "TESTSYS168.FXP IN C:\...\TESTSYS16_PROGRAM\TESTSYS163B\TESTSYS163B.EXE" in Visual FoxPro Advanced, ok.
RETURN
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun527b20 :: ; proc near
test eax , eax ;0x00527b20 : 85c0
mov byte ptr [edx] , 00h ;0x00527b22 : c60200
je Label4aabc6 ;0x00527b25 : 0f849b30f8ff
mov eax , dword ptr [eax] ;0x00527b2b : 8b00
mov ecx , dword ptr [ eax + 12 ] ;0x00527b2d : 8b480c
test ecx , ecx ;0x00527b30 : 85c9
je Label4aabc6 ;0x00527b32 : 0f848e30f8ff
mov ecx , dword ptr [ecx] ;0x00527b38 : 8b09
mov ax , word ptr [ eax + 16 ] ;0x00527b3a : 668b4010
cmp ax , word ptr [ ecx + 34 ] ;0x00527b3e : 663b4122
push esi ;0x00527b42 : 56
jne Label4aabac ;0x00527b43 : 0f856330f8ff
Label527b49 ::
mov eax , dword ptr [ ecx + 20 ] ;0x00527b49 : 8b4114
mov eax , dword ptr [eax] ;0x00527b4c : 8b00
add eax , dword ptr [ ecx + 24 ] ;0x00527b4e : 034118
Label527b51 ::
mov cl , byte ptr [eax] ;0x00527b51 : 8a08
inc eax ;0x00527b53 : 40
mov byte ptr [edx] , cl ;0x00527b54 : 880a
inc edx ;0x00527b56 : 42
test cl , cl ;0x00527b57 : 84c9
jne Label527b51 ;0x00527b59 : 75f6
pop esi ;0x00527b5b : 5e
ret ;0x00527b5c : c3
Label4aabac ::
mov esi , dword ptr [ ecx + 20 ] ;0x004aabac : 8b7114
movzx eax , ax ;0x004aabaf : 0fb7c0
imul eax , eax , 01Ch ;0x004aabb2 : 6bc01c
mov eax , dword ptr [ ecx + eax + 76 ] ;0x004aabb5 : 8b44014c
add eax , dword ptr [esi] ;0x004aabb9 : 0306
;
; ------------------------------------------------------------------
; VFP 9.0 FIX - FIX THE ASTACKINFO() AND SYS(16) FUNCTIONS
; April 2025
; ------------------------------------------------------------------
; CCB
;
; In vfp9 (and vfp6, vfp7, vfp8), when the executing program is part of an application (.app) or an executable (.exe),
; sometimes ASTACKINFO() and SYS(16) return only the name of the program, that is, without the path.
; In Visual FoxPro Advanced, when the executing program is part of an application (.app) or an executable (.exe),
; ASTACKINFO() and SYS(16) always return a full path name.
;
; 2025/4/13, by ccb
;
mov esi , ecx
Label4aabbb ::
mov cl , byte ptr [eax] ;0x004aabbb : 8a08
inc eax ;0x004aabbd : 40
mov byte ptr [edx] , cl ;0x004aabbe : 880a
inc edx ;0x004aabc0 : 42
test cl , cl ;0x004aabc1 : 84c9
jne Label4aabbb ;0x004aabc3 : 75f6
;
; ------------------------------------------------------------------
; VFP 9.0 FIX - FIX THE ASTACKINFO() AND SYS(16) FUNCTIONS
; April 2025
; ------------------------------------------------------------------
; CCB
;
; In vfp9 (and vfp6, vfp7, vfp8), when the executing program is part of an application (.app) or an executable (.exe),
; sometimes ASTACKINFO() and SYS(16) return only the name of the program, that is, without the path.
; In Visual FoxPro Advanced, when the executing program is part of an application (.app) or an executable (.exe),
; ASTACKINFO() and SYS(16) always return a full path name.
;
; 2025/4/13, by ccb
;
cmp dword ptr vfpa_sys9183_data,00h
je Label4aabc5
cmp dword ptr [ esp + 4 ] , offset Label65a7e3 ;; Label65a683 ..
jne Label4aabc3
jmp Label4aabc4
Label4aabc3 ::
cmp dword ptr vfpa_sys9183_data,02h
jne Label4aabc5
cmp dword ptr [ esp + 4 ] , offset Label4f46b7 ;; Fun4f4663 .. ; proc near
jne Label4aabc5
cmp dword ptr [ esp + 4 + (4+00h+114h) ] , offset Label52a10d ;; Label52a0e2 ..
jne Label4aabc5
jmp Label4aabc4
Label4aabc4 ::
dec edx
mov byte ptr [edx] , 20h
inc edx
mov byte ptr [edx] , 49h ;; I
inc edx
mov byte ptr [edx] , 4Eh ;; N
inc edx
mov byte ptr [edx] , 20h
inc edx
mov byte ptr [edx] , 00h
mov ecx , esi
jmp Label527b49
Label4aabc5 ::
pop esi ;0x004aabc5 : 5e
Label4aabc6 ::
ret ;0x004aabc6 : 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_vfp9fix376.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix33.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix229.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix239.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix240.asp
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|