---------------------------------------------------------------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - THE CURLY BRACKETS SUBSTITUTION IN THE SEND OUTPUT DIRECTLY TO THE PRINTER COMMAND
January 2026
---------------------------------------------------------------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp6, vfp7, vfp8), it always enables the curly brackets substitution in the send output directly to the printer command.
In VFP Advanced, we can disable the curly brackets substitution in the send output directly to the printer command,
for example,
=SYS(9076,0)
???"a{b"
the curly bracket "{" will not be replaced,
it will run fine.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun8767ac :: ; proc near
push ebp ;0x008767ac : 55
mov ebp , esp ;0x008767ad : 8bec
sub esp , 0104h ;0x008767af : 81ec04010000
mov eax , dword ptr [ Data937090 ] ;0x008767b5 : a190709300
mov dword ptr [ ebp - 4 ] , eax ;0x008767ba : 8945fc
mov eax , dword ptr [ ebp + 8 ] ;0x008767bd : 8b4508
mov ecx , dword ptr [eax] ;0x008767c0 : 8b08
mov eax , dword ptr [esi] ;0x008767c2 : 8b06
mov dl , byte ptr [ ecx + eax ] ;0x008767c4 : 8a1401
cmp dl , 07Bh ;0x008767c7 : 80fa7b
push edi ;0x008767ca : 57
jne Label876845 ;0x008767cb : 7578
;
; ----------------------------------------------------------------------------------------------------------
; VFP 9.0 FIX - THE CURLY BRACKETS SUBSTITUTION IN THE SEND OUTPUT DIRECTLY TO THE PRINTER COMMAND
; March 2022
; ----------------------------------------------------------------------------------------------------------
; CCB
;
; The curly brackets substitution in the send output directly to the printer command.
;
; 2022/3/2, by ccb
;
cmp dword ptr vfpa_sys9076_data,00h
jne Label8767cd
jmp Label876845
Label8767cd ::
inc eax ;0x008767cd : 40
lea edi , dword ptr [ ecx + eax ] ;0x008767ce : 8d3c01
mov dword ptr [esi] , eax ;0x008767d1 : 8906
mov dl , byte ptr [edi] ;0x008767d3 : 8a17
cmp dl , 07Bh ;0x008767d5 : 80fa7b
jne Label8767e6 ;0x008767d8 : 750c
cmp byte ptr [ edi + 1 ] , 07Dh ;0x008767da : 807f017d
jne Label876841 ;0x008767de : 7561
mov byte ptr [ebx] , dl ;0x008767e0 : 8813
inc dword ptr [esi] ;0x008767e2 : ff06
jmp Label876847 ;0x008767e4 : eb61
Label8767e6 ::
cmp dl , 07Dh ;0x008767e6 : 80fa7d
jne Label8767ef ;0x008767e9 : 7504
mov byte ptr [ebx] , dl ;0x008767eb : 8813
jmp Label876847 ;0x008767ed : eb58
Label8767ef ::
mov dword ptr [ ebp + 8 ] , eax ;0x008767ef : 894508
xor edi , edi ;0x008767f2 : 33ff
Label8767f4 ::
cmp edi , 0FFh ;0x008767f4 : 81ffff000000
jnb Label876841 ;0x008767fa : 7345
cmp eax , dword ptr [ ebp + 12 ] ;0x008767fc : 3b450c
jnb Label876841 ;0x008767ff : 7340
movzx edx ,byte ptr [ eax + ecx ] ;0x00876801 : 0fb61408
mov dl , byte ptr [ edx + offset Data9375a0 ] ;0x00876805 : 8a92a0759300
inc eax ;0x0087680b : 40
mov byte ptr [ ebp + edi + 0FFFFFEFCh ] , dl ;0x0087680c : 88943dfcfeffff
mov edx , eax ;0x00876813 : 8bd0
mov dword ptr [esi] , eax ;0x00876815 : 8906
inc edi ;0x00876817 : 47
cmp byte ptr [ ecx + edx ] , 07Dh ;0x00876818 : 803c117d
jne Label8767f4 ;0x0087681c : 75d6
sub eax , dword ptr [ ebp + 8 ] ;0x0087681e : 2b4508
mov byte ptr [ ebp + edi + 0FFFFFEFCh ] , 00h ;0x00876821 : c6843dfcfeffff00
push eax ;0x00876829 : 50
lea eax , dword ptr [ ebp + 0FFFFFEFCh ] ;0x0087682a : 8d85fcfeffff
push eax ;0x00876830 : 50
call Fun876718 ;0x00876831 : e8e2feffff
cmp dword ptr [ Data947aa4 ] , 00h ;0x00876836 : 833da47a940000
mov byte ptr [ebx] , al ;0x0087683d : 8803
je Label876847 ;0x0087683f : 7406
Label876841 ::
xor eax , eax ;0x00876841 : 33c0
jmp Label87684c ;0x00876843 : eb07
Label876845 ::
mov byte ptr [ebx] , dl ;0x00876845 : 8813
Label876847 ::
inc dword ptr [esi] ;0x00876847 : ff06
xor eax , eax ;0x00876849 : 33c0
inc eax ;0x0087684b : 40
Label87684c ::
mov ecx , dword ptr [ ebp - 4 ] ;0x0087684c : 8b4dfc
pop edi ;0x0087684f : 5f
call Fun42bf1d ;0x00876850 : e8c856bbff
leave ;0x00876855 : c9
ret 08h ;0x00876856 : c20800
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:
=ffwrite("a{b")
RETU
PROC ffwrite
PARAMETER m.q_exp
* ffwrite =
* m.q_exp =
PRIVATE m.q_exp2
m.q_exp2=m.q_exp
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-@}",CHR(0x00))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-A}",CHR(0x01))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-B}",CHR(0x02))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-C}",CHR(0x03))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-D}",CHR(0x04))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-E}",CHR(0x05))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-F}",CHR(0x06))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-G}",CHR(0x07))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-H}",CHR(0x08))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-I}",CHR(0x09))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-J}",CHR(0x0a))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-K}",CHR(0x0b))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-L}",CHR(0x0c))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-M}",CHR(0x0d))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-N}",CHR(0x0e))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-O}",CHR(0x0f))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-P}",CHR(0x10))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-Q}",CHR(0x11))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-R}",CHR(0x12))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-S}",CHR(0x13))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-T}",CHR(0x14))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-U}",CHR(0x15))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-V}",CHR(0x16))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-W}",CHR(0x17))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-X}",CHR(0x18))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-Y}",CHR(0x19))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-Z}",CHR(0x1a))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-[}",CHR(0x1b))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-\}",CHR(0x1c))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-]}",CHR(0x1d))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-^}",CHR(0x1e))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{CTRL-_}",CHR(0x1f))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{DEL}",CHR(0x7f))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{NULL}",CHR(0x00))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{BELL}",CHR(0x07))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{BACKSPACE}",CHR(0x08))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{TAB}",CHR(0x09))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{LINEFEED}",CHR(0x0a))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{RETURN}",CHR(0x0d))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{ESC}",CHR(0x1b))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{ESCAPE}",CHR(0x1b))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{DELETE}",CHR(0x7f))
m.q_exp2=ffwrite_strtranc(m.q_exp2,"{","{{}")
???m.q_exp2
PRIVATE m.q_len
m.q_len=LEN(m.q_exp)
RETU m.q_len
* END OF PROC FFWRITE.
PROC ffwrite_strtranc
PARAMETER m.q_vexp,m.q_str1,m.q_str2
* ffwrite_strtranc =
* m.q_vexp =
* m.q_str1 =
* m.q_str2 =
PRIVATE m.q_vexpb
m.q_vexpb=1
DO WHILE m.q_vexpb<=LEN(m.q_vexp)
PRIVATE m.q_vexpn
m.q_vexpn=ATC(m.q_str1,SUBS(m.q_vexp,m.q_vexpb))
IF !(m.q_vexpn>0)
EXIT
ENDI
m.q_vexpb=m.q_vexpb+m.q_vexpn-1
m.q_vexp=STUFF(m.q_vexp,m.q_vexpb,LEN(m.q_str1),m.q_str2)
m.q_vexpb=m.q_vexpb-LEN(m.q_str1)+LEN(m.q_str2)
m.q_vexpb=m.q_vexpb+LEN(m.q_str1)
ENDDO
RETU m.q_vexp
* END OF PROC FFWRITE_STRTRANC.
and then there is no the bug.
5. REFERENCE WEBSITES:
1, baiyujia.com:
http://www.baiyujia.com
http://www.baiyujia.com/vfpdocuments/f_vfp9fix206.asp
2, foxite.com:
https://www.foxite.com/archives/chr123-fails-why-0000243023.htm
3, wikis.com:
http://fox.wikis.com/wc.dll?Wiki~VfpCommandQuestionMarkQuestionMarkQuestionMark
4, sunyear.com.tw:
http://vfp.sunyear.com.tw/viewtopic.php?t=6430
http://vfp.sunyear.com.tw/viewtopic.php?t=7128
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|