--------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - PROPERTY NAMES TO LOWERCASE
January 2026
--------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp6, vfp7, vfp8), we can build the COM server programs, and it can embedd the Type Library resource data,
then other languages such as VC, VC# and VB can access the object's members (properties and methods).
In VFP language, we can use the names (variable names, field names, property names, etc.) with case insensitive,
for example, the name ABC is the same as the name abc.
In other languages such as VC, VC# and VB, we use the names with case sensitive,
for example, the name ABC is not the same as the name abc, they are two different names.
There are some problems about uppercase and lowercase for the property names and method names in the visual class library file.
When we build the COM server project,
sometimes the property names (and method names) will be converted to uppercase,
sometimes the property names (and method names) will be converted to lowercase,
this is random.
The bug was reported by David Acuna.
2. CAUSE:
In VFP, when we create a new name (variable name, field name, property name, etc.),
VFP will add the name to the Name Table Index (NTI).
Usually, VFP will convert the name (variable name, field name) to uppercase and then add the name to the Name Table Index (NTI),
but for the property name (and method name) in the visual class library file,
VFP will not convert the name (so it is a lowercase name) and then add the name to the Name Table Index (NTI).
So, if there is a variable name (or field name) same as the property name (or method name), there are some problems.
For example,
there is a property name abc,
and there is a variable name abc.
Usually, If we don't use the variable name (or field name) abc,
when we build the COM server project,
the property name abc will not be converted,
the property name is a lowercase name (abc).
If we use the variable name abc first,
VFP will convert the variable name abc to uppercase (ABC) and then add the name to the Name Table Index (NTI),
and then we can build the COM server project,
the property name abc will use the variable name (ABC) in the Name Table Index (NTI),
so the property name is a uppercase name (ABC).
So, sometimes we get the lowercase property name (abc),
but sometimes we get the uppercase property name (ABC).
In VFP, there is no problem, because VFP is case insensitive,
but in other languages such as VC, VC# and VB, this is a problem, because they are case sensitive.
3. RESOLUTION:
We can write some code to fix the BUG.
Label4fb0d9 ::
lea eax , dword ptr [ ebp + 47 ] ;0x004fb0d9 : 8d452f
push eax ;0x004fb0dc : 50
lea eax , dword ptr [ ebp + 16 ] ;0x004fb0dd : 8d4510
push eax ;0x004fb0e0 : 50
lea eax , dword ptr [ ebp + 47 ] ;0x004fb0e1 : 8d452f
push eax ;0x004fb0e4 : 50
lea eax , dword ptr [ ebp + 4 ] ;0x004fb0e5 : 8d4504
push eax ;0x004fb0e8 : 50
lea eax , dword ptr [ ebp + 47 ] ;0x004fb0e9 : 8d452f
push eax ;0x004fb0ec : 50
lea eax , dword ptr [ ebp + 48 ] ;0x004fb0ed : 8d4530
push eax ;0x004fb0f0 : 50
lea eax , dword ptr [ esi + 1 ] ;0x004fb0f1 : 8d4601
pushd offset Data92119c ;0x004fb0f4 : 689c119200
push eax ;0x004fb0f9 : 50
call sscanf ;0x004fb0fa : ff1530799100
add esp , 024h ;0x004fb100 : 83c424
;
; ---------------------------------------------------------
; VFP 9.0 FIX - PROPERTY ARRAY NAMES TO LOWERCASE
; February 2016
; ---------------------------------------------------------
; CCB
;
; Convert the property array names in the visual class library file to lowercase.
;
; 2016/2/24, by ccb
;
lea eax , dword ptr [ ebp + 48 ]
push eax
call lstrlenA
push eax
lea eax , dword ptr [ ebp + 48 ]
push eax
call CharLowerBuffA
; mov dword ptr vfpa_ntinametolower_tolower,01h
pushd 01h ;0x004fb103 : 6a01
lea eax , dword ptr [ ebp + 48 ] ;0x004fb105 : 8d4530
push eax ;0x004fb108 : 50
call Fun432788 ;0x004fb109 : e87a76f3ff
Label4fb10d ::
; mov dword ptr vfpa_ntinametolower_tolower,00h
Label4fb10e ::
pushd 0Bh ;0x004fb10e : 6a0b
mov dword ptr [ ebp + 36 ] , eax ;0x004fb110 : 894524
pop ecx ;0x004fb113 : 59
xor eax , eax ;0x004fb114 : 33c0
push eax ;0x004fb116 : 50
push dword ptr [ ebp + 36 ] ;0x004fb117 : ff7524
lea edi , dword ptr [ ebp - 56 ] ;0x004fb11a : 8d7dc8
rep stosd ;0x004fb11d : f3ab
mov ax , 080h ;0x004fb11f : 66b88000
mov byte ptr [ ebp - 56 ] , 04Ch ;0x004fb123 : c645c84c
call Fun512fff ;0x004fb127 : e8d37e0100
test eax , eax ;0x004fb12c : 85c0
jne Label4fb174 ;0x004fb12e : 7544
mov eax , dword ptr [ ebp + 0240h ] ;0x004fb130 : 8b8540020000
cmp dword ptr [eax] , 02h ;0x004fb136 : 833802
pushd 00h ;0x004fb139 : 6a00
je Label4f53c6 ;0x004fb13b : 0f8485a2ffff
lea eax , dword ptr [ ebp - 56 ] ;0x004fb141 : 8d45c8
push eax ;0x004fb144 : 50
push dword ptr [ ebp + 16 ] ;0x004fb145 : ff7510
mov esi , ebx ;0x004fb148 : 8bf3
push dword ptr [ ebp + 4 ] ;0x004fb14a : ff7504
push dword ptr [ ebp + 36 ] ;0x004fb14d : ff7524
call Fun4bd0e0 ;0x004fb150 : e88b1ffcff
mov ecx , dword ptr [ Data9388dc ] ;0x004fb155 : 8b0ddc889300
mov edx , eax ;0x004fb15b : 8bd0
lea eax , dword ptr [ ebx + 4 * ebx ] ;0x004fb15d : 8d049b
shl eax , 05h ;0x004fb160 : c1e005
test byte ptr [ eax + ecx + 48 ] , 02h ;0x004fb163 : f644083002
mov dword ptr [ ebp + 40 ] , edx ;0x004fb168 : 895528
jne Label5dfa2b ;0x004fb16b : 0f85ba480e00
Label4fb171 ::
mov esi , dword ptr [ ebp + 8 ] ;0x004fb171 : 8b7508
Label4fb174 ::
cmp byte ptr [ ebp + 0130h ] , 00h ;0x004fb174 : 80bd3001000000
jne Label4f4b8e ;0x004fb17b : 0f850d9affff
Label4fb181 ::
mov eax , dword ptr [ ebp + 28 ] ;0x004fb181 : 8b451c
add dword ptr [ ebp + 32 ] , eax ;0x004fb184 : 014520
mov ecx , dword ptr [ ebp + 12 ] ;0x004fb187 : 8b4d0c
push dword ptr [ ebp + 32 ] ;0x004fb18a : ff7520
mov edx , ecx ;0x004fb18d : 8bd1
shr ecx , 02h ;0x004fb18f : c1e902
xor eax , eax ;0x004fb192 : 33c0
mov edi , esi ;0x004fb194 : 8bfe
rep stosd ;0x004fb196 : f3ab
mov ecx , edx ;0x004fb198 : 8bca
and ecx , 03h ;0x004fb19a : 83e103
mov edx , esi ;0x004fb19d : 8bd6
rep stosb ;0x004fb19f : f3aa
call Fun4fb090 ;0x004fb1a1 : e8eafeffff
test eax , eax ;0x004fb1a6 : 85c0
mov dword ptr [ ebp + 28 ] , eax ;0x004fb1a8 : 89451c
je Label4fa6a5 ;0x004fb1ab : 0f84f4f4ffff
Label4fb1b1 ::
or dword ptr [ ebp + 40 ] , 0FFFFFFFFh ;0x004fb1b1 : 834d28ff
mov byte ptr [ ebp + 0130h ] , 00h ;0x004fb1b5 : c6853001000000
mov al , byte ptr [esi] ;0x004fb1bc : 8a06
cmp al , 02Ah ;0x004fb1be : 3c2a
je Label4fb233 ;0x004fb1c0 : 7471
cmp al , 05Eh ;0x004fb1c2 : 3c5e
lea eax , dword ptr [ ebp + 0130h ] ;0x004fb1c4 : 8d8530010000
push eax ;0x004fb1ca : 50
je Label4fb0d9 ;0x004fb1cb : 0f8408ffffff
lea eax , dword ptr [ ebp + 48 ] ;0x004fb1d1 : 8d4530
push eax ;0x004fb1d4 : 50
pushd offset Data921d40 ;0x004fb1d5 : 68401d9200
push esi ;0x004fb1da : 56
call sscanf ;0x004fb1db : ff1530799100
add esp , 010h ;0x004fb1e1 : 83c410
;
; ---------------------------------------------------
; VFP 9.0 FIX - PROPERTY NAMES TO LOWERCASE
; February 2016
; ---------------------------------------------------
; CCB
;
; Convert the property names in the visual class library file to lowercase.
;
; 2016/2/24, by ccb
;
lea eax , dword ptr [ ebp + 48 ]
push eax
call lstrlenA
push eax
lea eax , dword ptr [ ebp + 48 ]
push eax
call CharLowerBuffA
; mov dword ptr vfpa_ntinametolower_tolower2,01h
pushd 01h ;0x004fb1e4 : 6a01
lea eax , dword ptr [ ebp + 48 ] ;0x004fb1e6 : 8d4530
push eax ;0x004fb1e9 : 50
call Fun432788 ;0x004fb1ea : e89975f3ff
Label4fb1ee ::
; mov dword ptr vfpa_ntinametolower_tolower2,00h
Label4fb1ef ::
pushd 0Bh ;0x004fb1ef : 6a0b
mov dword ptr [ ebp + 36 ] , eax ;0x004fb1f1 : 894524
pop ecx ;0x004fb1f4 : 59
xor eax , eax ;0x004fb1f5 : 33c0
push eax ;0x004fb1f7 : 50
push dword ptr [ ebp + 36 ] ;0x004fb1f8 : ff7524
lea edi , dword ptr [ ebp - 56 ] ;0x004fb1fb : 8d7dc8
rep stosd ;0x004fb1fe : f3ab
mov ax , 04h ;0x004fb200 : 66b80400
mov byte ptr [ ebp - 56 ] , 04Ch ;0x004fb204 : c645c84c
call Fun512fff ;0x004fb208 : e8f27d0100
test eax , eax ;0x004fb20d : 85c0
jne Label4fb174 ;0x004fb20f : 0f855fffffff
push eax ;0x004fb215 : 50
pushd 02Ch ;0x004fb216 : 6a2c
lea eax , dword ptr [ ebp - 56 ] ;0x004fb218 : 8d45c8
push eax ;0x004fb21b : 50
pushd 02h ;0x004fb21c : 6a02
pushd 058h ;0x004fb21e : 6a58
pushd 04h ;0x004fb220 : 6a04
push dword ptr [ ebp + 36 ] ;0x004fb222 : ff7524
push ebx ;0x004fb225 : 53
call Fun418a4b ;0x004fb226 : e820d8f1ff
Label4fb22b ::
mov dword ptr [ ebp + 40 ] , eax ;0x004fb22b : 894528
jmp Label4fb174 ;0x004fb22e : e941ffffff
Label4fb233 ::
lea eax , dword ptr [ ebp + 0130h ] ;0x004fb233 : 8d8530010000
push eax ;0x004fb239 : 50
lea eax , dword ptr [ ebp + 48 ] ;0x004fb23a : 8d4530
push eax ;0x004fb23d : 50
lea eax , dword ptr [ esi + 1 ] ;0x004fb23e : 8d4601
pushd offset Data921d4c ;0x004fb241 : 684c1d9200
push eax ;0x004fb246 : 50
call sscanf ;0x004fb247 : ff1530799100
add esp , 010h ;0x004fb24d : 83c410
;
; -------------------------------------------------
; VFP 9.0 FIX - METHOD NAMES TO LOWERCASE
; February 2016
; -------------------------------------------------
; CCB
;
; Convert the method names in the visual class library file to lowercase.
;
; 2016/2/24, by ccb
;
lea eax , dword ptr [ ebp + 48 ]
push eax
call lstrlenA
push eax
lea eax , dword ptr [ ebp + 48 ]
push eax
call CharLowerBuffA
; mov dword ptr vfpa_ntinametolower_tolower3,01h
pushd 01h ;0x004fb250 : 6a01
lea eax , dword ptr [ ebp + 48 ] ;0x004fb252 : 8d4530
push eax ;0x004fb255 : 50
call Fun432788 ;0x004fb256 : e82d75f3ff
Label4fb25a ::
; mov dword ptr vfpa_ntinametolower_tolower3,00h
Label4fb25b ::
mov edi , eax ;0x004fb25b : 8bf8
pushd 00h ;0x004fb25d : 6a00
push edi ;0x004fb25f : 57
mov ax , 010h ;0x004fb260 : 66b81000
call Fun512fff ;0x004fb264 : e8967d0100
test eax , eax ;0x004fb269 : 85c0
jne Label4fb174 ;0x004fb26b : 0f8503ffffff
pushd 010h ;0x004fb271 : 6a10
push edi ;0x004fb273 : 57
push ebx ;0x004fb274 : 53
xor ecx , ecx ;0x004fb275 : 33c9
call Fun4fb02d ;0x004fb277 : e8b1fdffff
jmp Label4fb22b ;0x004fb27c : ebad
Now VFP will ALWAYS convert the property names and method names in the visual class library file to lowercase
and then add the names to the Name Table Index (NTI).
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_vfp9fix265.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix266.asp
2, msdn.com:
http://blogs.msdn.com/b/calvin_hsia/archive/2005/09/02/460206.aspx
3, foxpert.com:
http://www.foxpert.com/docs/howfoxproworks.en.htm
4, codemag.com:
http://www.codemag.com/article/050014
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|