----------------------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - INPUT SOME INVISIBLE CHARACTERS IN EDITOR
January 2025
----------------------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp6, vfp7, vfp8), we can input the following invisible characters in Editor, the Command window and the EditBox control:
CTRL+BACKSLASH (CTRL+\), File Separator,
CTRL+RBRACKET (CTRL+]), Group Separator,
CTRL+CARET (CTRL+SHIFT+6), Record Separator,
CTRL+HYPHEN (CTRL+SHIFT+-), Unit Separator.
The bug occurs for almost all fonts, it does not occur for a few fonts, for example, Fixedsys, System or Terminal.
The bug also occurs in some Windows applications, for example, Notepad, Firefox, Internet Explorer, Visual Studio, etc.
The bug does not occur in some Windows applications, for example, Wordpad, Word, Edge, Hiew, etc.
There is a test program:
*PROC testinvisiblecharacters
SET STEP OFF
SET ECHO OFF
SET DEBUG OFF
SET ESCAPE OFF
SET TALK OFF
SET SAFETY OFF
_SCREEN.VISIBLE=.T.
_SCREEN.WINDOWSTATE=2
CLOSE DATABASES ALL
CLOSE TABLES ALL
?"OK" && ok.
?"CTRL+\" && there is a character CTRL+BACKSLASH between ? and "CTRL+\", we can't see it if we don't set font to Fixedsys, System or Terminal.
?"CTRL+]" && there is a character CTRL+RBRACKET between ? and "CTRL+]", we can't see it if we don't set font to Fixedsys, System or Terminal.
?"CTRL+^" && there is a character CTRL+CARET between ? and "CTRL+^", we can't see it if we don't set font to Fixedsys, System or Terminal.
?"CTRL+_" && there is a character CTRL+HYPHEN between ? and "CTRL+_", we can't see it if we don't set font to Fixedsys, System or Terminal.
?"OK" && ok.
WAIT
CLOSE DATABASES ALL
CLOSE TABLES ALL
RETURN
* END OF PROC TESTINVISIBLECHARACTERS.
Please refer to the picture testinvisiblecharacters_font_arial.png (set font to Arial):
Please refer to the picture testinvisiblecharacters_font_fixedsys.png (set font to Fixedsys):
After we compile the program file testinvisiblecharacters.prg,
we can get the compilation error file testinvisiblecharacters.err:
?"CTRL+\"
Error in line 17: Command contains unrecognized phrase/keyword.
?"CTRL+]"
Error in line 18: Command contains unrecognized phrase/keyword.
?"CTRL+^"
Error in line 19: Command contains unrecognized phrase/keyword.
?"CTRL+_"
Error in line 20: Command contains unrecognized phrase/keyword.
the code will not run.
Please refer to the picture testinvisiblecharacterserr_font_arial.png (set font to Arial):
Please refer to the picture testinvisiblecharacterserr_font_fixedsys.png (set font to Fixedsys):
In VFP Advanced, we can't input the following invisible characters in Editor, the Command window and the EditBox control:
CTRL+BACKSLASH (CTRL+\), File Separator,
CTRL+RBRACKET (CTRL+]), Group Separator,
CTRL+CARET (CTRL+SHIFT+6), Record Separator,
CTRL+HYPHEN (CTRL+SHIFT+-), Unit Separator.
It is helpful to solve the problem.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun415b39 :: ; proc near
push ebx ;0x00415b39 : 53
mov ebx , dword ptr [ esp + 8 ] ;0x00415b3a : 8b5c2408
push ebp ;0x00415b3e : 55
mov ebp , dword ptr [ esp + 20 ] ;0x00415b3f : 8b6c2414
push esi ;0x00415b43 : 56
mov esi , eax ;0x00415b44 : 8bf0
push edi ;0x00415b46 : 57
mov edx , ebx ;0x00415b47 : 8bd3
mov ecx , esi ;0x00415b49 : 8bce
call Fun43de2a ;0x00415b4b : e8da820200
mov edx , eax ;0x00415b50 : 8bd0
xor eax , eax ;0x00415b52 : 33c0
mov ecx , 016h ;0x00415b54 : b916000000
mov edi , edx ;0x00415b59 : 8bfa
rep stosd ;0x00415b5b : f3ab
stosb ;0x00415b5d : aa
mov ax , word ptr [ ebp + 2 ] ;0x00415b5e : 668b4502
or edi , 0FFFFFFFFh ;0x00415b62 : 83cfff
cmp ax , di ;0x00415b65 : 663bc7
je Label483e17 ;0x00415b68 : 0f84a9e20600
movsx ecx , ax ;0x00415b6e : 0fbfc8
mov dword ptr [ esp + 28 ] , ecx ;0x00415b71 : 894c241c
Label415b75 ::
mov eax , dword ptr [ esp + 28 ] ;0x00415b75 : 8b44241c
mov dword ptr [edx] , eax ;0x00415b79 : 8902
movsx ecx ,word ptr [ ebp + 0 ] ;0x00415b7b : 0fbf4d00
mov dword ptr [ edx + 4 ] , ecx ;0x00415b7f : 894a04
mov dword ptr [ edx + 32 ] , edi ;0x00415b82 : 897a20
mov al , byte ptr [ ebp + 12 ] ;0x00415b85 : 8a450c
mov byte ptr [ edx + 54 ] , al ;0x00415b88 : 884236
mov cx , word ptr [ ebp + 14 ] ;0x00415b8b : 668b4d0e
mov eax , dword ptr [ edx + 4 ] ;0x00415b8f : 8b4204
or eax , 0200h ;0x00415b92 : 0d00020000
mov word ptr [ edx + 55 ] , cx ;0x00415b97 : 66894a37
mov dword ptr [ edx + 40 ] , edi ;0x00415b9b : 897a28
mov word ptr [ edx + 65 ] , di ;0x00415b9e : 66897a41
mov word ptr [ edx + 50 ] , di ;0x00415ba2 : 66897a32
mov word ptr [ edx + 69 ] , di ;0x00415ba6 : 66897a45
mov dword ptr [ edx + 4 ] , eax ;0x00415baa : 894204
mov ecx , eax ;0x00415bad : 8bc8
mov ax , word ptr [ ebp + 16 ] ;0x00415baf : 668b4510
;
; -----------------------------------------------------------------
; VFP 9.0 FIX - INPUT SOME INVISIBLE CHARACTERS IN EDITOR
; September 2024
; -----------------------------------------------------------------
; CCB
;
; In vfp9 (and vfp6, vfp7, vfp8), we can input the following invisible characters in Editor:
; CTRL+BACKSLASH (CTRL+\), File Separator,
; CTRL+RBRACKET (CTRL+]), Group Separator,
; CTRL+CARET (CTRL+SHIFT+6), Record Separator,
; CTRL+HYPHEN (CTRL+SHIFT+-), Unit Separator.
; In Visual FoxPro Advanced, we can't input the following invisible characters in Editor:
; CTRL+BACKSLASH (CTRL+\), File Separator,
; CTRL+RBRACKET (CTRL+]), Group Separator,
; CTRL+CARET (CTRL+SHIFT+6), Record Separator,
; CTRL+HYPHEN (CTRL+SHIFT+-), Unit Separator.
;
; 2024/9/22, by ccb
;
cmp dword ptr vfpa_sys9172_data,00h
jne Label415bb3_invisiblecharacter4_end
Label415bb3_invisiblecharacter1_start:
cmp dword ptr [edx] , 0FFFFB504h
jne Label415bb3_invisiblecharacter1_end
mov ax , 201Ch ;; CTRL+BACKSLASH (CTRL+\) 01C ctrlKey (File Separator)
mov word ptr [ edx + 63 ] , ax
jmp Label415b21
Label415bb3_invisiblecharacter1_end:
Label415bb3_invisiblecharacter3_start:
cmp dword ptr [edx] , 0FFFFB508h
jne Label415bb3_invisiblecharacter3_end
mov ax , 301Eh ;; CTRL+CARET (CTRL+SHIFT+6) 01E ctrlKey+shiftKey (Record Separator)
mov word ptr [ edx + 63 ] , ax
jmp Label415b21
Label415bb3_invisiblecharacter3_end:
Label415bb3_invisiblecharacter4_start:
cmp dword ptr [edx] , 0FFFFB50Fh
jne Label415bb3_invisiblecharacter4_end
mov ax , 301Fh ;; CTRL+HYPHEN (CTRL+SHIFT+-) 01F ctrlKey+shiftKey (Unit Separator)
mov word ptr [ edx + 63 ] , ax
jmp Label415b21
Label415bb3_invisiblecharacter4_end:
Label415bb3 ::
test ax , ax ;0x00415bb3 : 6685c0
mov word ptr [ edx + 63 ] , ax ;0x00415bb6 : 6689423f
jne Label415b21 ;0x00415bba : 0f8561ffffff
Label415bc0 ::
mov ax , word ptr [ ebp + 10 ] ;0x00415bc0 : 668b450a
cmp ax , di ;0x00415bc4 : 663bc7
jne Label5a1809 ;0x00415bc7 : 0f853cbc1800
Label415bcd ::
mov ax , word ptr [ ebp + 6 ] ;0x00415bcd : 668b4506
test ax , ax ;0x00415bd1 : 6685c0
jne Label5a1824 ;0x00415bd4 : 0f854abc1800
cmp word ptr [ ebp + 8 ] , ax ;0x00415bda : 66394508
jne Label5a1824 ;0x00415bde : 0f8540bc1800
Label415be4 ::
mov ax , word ptr [ ebp + 4 ] ;0x00415be4 : 668b4504
test ax , ax ;0x00415be8 : 6685c0
jne Label41825c ;0x00415beb : 0f856b260000
Label415bf1 ::
movzx ebx ,word ptr [ ebp + 34 ] ;0x00415bf1 : 0fb75d22
movsx eax ,word ptr [ ebp + 26 ] ;0x00415bf5 : 0fbf451a
add ebx , ebp ;0x00415bf9 : 03dd
cmp eax , 0FFFFFFFFh ;0x00415bfb : 83f8ff
je Label415c24 ;0x00415bfe : 7424
add eax , ebx ;0x00415c00 : 03c3
mov ecx , eax ;0x00415c02 : 8bc8
lea edi , dword ptr [ ecx + 1 ] ;0x00415c04 : 8d7901
lea ebx , dword ptr [ebx] ;0x00415c07 : 8d1b
Label415c09 ::
mov dl , byte ptr [ecx] ;0x00415c09 : 8a11
inc ecx ;0x00415c0b : 41
test dl , dl ;0x00415c0c : 84d2
jne Label415c09 ;0x00415c0e : 75f9
sub ecx , edi ;0x00415c10 : 2bcf
test ecx , ecx ;0x00415c12 : 85c9
jle Label415c24 ;0x00415c14 : 7e0e
mov edx , dword ptr [ esp + 20 ] ;0x00415c16 : 8b542414
push ecx ;0x00415c1a : 51
pushd 017h ;0x00415c1b : 6a17
push edx ;0x00415c1d : 52
push esi ;0x00415c1e : 56
call Fun43120e ;0x00415c1f : e8eab50100
Label415c24 ::
movsx eax ,word ptr [ ebp + 22 ] ;0x00415c24 : 0fbf4516
cmp eax , 0FFFFFFFFh ;0x00415c28 : 83f8ff
jne Label41787a ;0x00415c2b : 0f85491c0000
Label415c31 ::
movsx eax ,word ptr [ ebp + 24 ] ;0x00415c31 : 0fbf4518
cmp eax , 0FFFFFFFFh ;0x00415c35 : 83f8ff
je Label415c5c ;0x00415c38 : 7422
add eax , ebx ;0x00415c3a : 03c3
mov ecx , eax ;0x00415c3c : 8bc8
lea edi , dword ptr [ ecx + 1 ] ;0x00415c3e : 8d7901
Label415c41 ::
mov dl , byte ptr [ecx] ;0x00415c41 : 8a11
inc ecx ;0x00415c43 : 41
test dl , dl ;0x00415c44 : 84d2
jne Label415c41 ;0x00415c46 : 75f9
sub ecx , edi ;0x00415c48 : 2bcf
test ecx , ecx ;0x00415c4a : 85c9
jle Label415c5c ;0x00415c4c : 7e0e
mov edx , dword ptr [ esp + 20 ] ;0x00415c4e : 8b542414
push ecx ;0x00415c52 : 51
pushd 02h ;0x00415c53 : 6a02
push edx ;0x00415c55 : 52
push esi ;0x00415c56 : 56
call Fun43120e ;0x00415c57 : e8b2b50100
Label415c5c ::
movsx eax ,word ptr [ ebp + 18 ] ;0x00415c5c : 0fbf4512
cmp eax , 0FFFFFFFFh ;0x00415c60 : 83f8ff
jne Label5a1839 ;0x00415c63 : 0f85d0bb1800
Label415c69 ::
movsx eax ,word ptr [ ebp + 20 ] ;0x00415c69 : 0fbf4514
cmp eax , 0FFFFFFFFh ;0x00415c6d : 83f8ff
jne Label5a1864 ;0x00415c70 : 0f85eebb1800
Label415c76 ::
test byte ptr [ ebp + 0 ] , 04h ;0x00415c76 : f6450004
jne Label415c96 ;0x00415c7a : 751a
mov eax , dword ptr [ ebp + 28 ] ;0x00415c7c : 8b451c
mov ecx , dword ptr [ esp + 20 ] ;0x00415c7f : 8b4c2414
pushd 04h ;0x00415c83 : 6a04
pushd 03h ;0x00415c85 : 6a03
push ecx ;0x00415c87 : 51
mov dword ptr [ esp + 36 ] , eax ;0x00415c88 : 89442424
push esi ;0x00415c8c : 56
lea eax , dword ptr [ esp + 40 ] ;0x00415c8d : 8d442428
call Fun43120e ;0x00415c91 : e878b50100
Label415c96 ::
mov eax , dword ptr [esi] ;0x00415c96 : 8b06
mov edx , dword ptr [ esp + 20 ] ;0x00415c98 : 8b542414
inc edx ;0x00415c9c : 42
mov dword ptr [ eax + 64 ] , edx ;0x00415c9d : 895040
mov ecx , dword ptr [esi] ;0x00415ca0 : 8b0e
mov eax , edx ;0x00415ca2 : 8bc2
mov dword ptr [ ecx + 0ECh ] , eax ;0x00415ca4 : 8981ec000000
mov edx , dword ptr [esi] ;0x00415caa : 8b16
mov ecx , dword ptr [ esp + 28 ] ;0x00415cac : 8b4c241c
mov dword ptr [ edx + 68 ] , eax ;0x00415cb0 : 894244
mov eax , dword ptr [esi] ;0x00415cb3 : 8b06
mov ebp , dword ptr [ eax + 12 ] ;0x00415cb5 : 8b680c
push ecx ;0x00415cb8 : 51
lea edx , dword ptr [ esp + 24 ] ;0x00415cb9 : 8d542418
or ebp , 080000000h ;0x00415cbd : 81cd00000080
push edx ;0x00415cc3 : 52
mov dword ptr [ eax + 12 ] , ebp ;0x00415cc4 : 89680c
call Fun415a13 ;0x00415cc7 : e847fdffff
test eax , eax ;0x00415ccc : 85c0
je Label415cdf ;0x00415cce : 740f
mov eax , dword ptr [esi] ;0x00415cd0 : 8b06
mov ecx , dword ptr [ eax + 8 ] ;0x00415cd2 : 8b4808
cmp ecx , dword ptr [ esp + 20 ] ;0x00415cd5 : 3b4c2414
jne Label40b8ef ;0x00415cd9 : 0f85105cffff
Label415cdf ::
pop edi ;0x00415cdf : 5f
pop esi ;0x00415ce0 : 5e
pop ebp ;0x00415ce1 : 5d
pop ebx ;0x00415ce2 : 5b
ret 0Ch ;0x00415ce3 : c20c00
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_vfp9fix352.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix92.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix155.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix156.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix307.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix308.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix316.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix317.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix318.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix371.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix372.asp
2, ascii-code.com:
https://www.ascii-code.com/characters/control-characters
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|