-------------------------------------------------------------------------------------
[BUG/PRB.] VFP 9.0 FIX - CHECK AVAILABLE WORK AREA FOR OPENING A TABLE FILE
January 2026
-------------------------------------------------------------------------------------
CCB
1. BUG:
If we enable checking available work area for opening a table file in Visual FoxPro Advanced,
if the work area number > the maximum number of work areas (32767), it will cause the error "Table number is invalid (Error 17)".
It is the startup default for Visual FoxPro Advanced.
If we disable checking available work area for opening a table file in Visual FoxPro Advanced,
if the work area number > the maximum number of work areas (32767), we can open the table file,
but if we use the SELECT nWorkArea command to select the work area, it will cause the error "Table number is invalid (Error 17)",
so we can't use the SELECT nWorkArea command to select the work area, we can only use the SELECT cTableAlias command to select the work area.
It is the same as Visual FoxPro 9.0 and earlier versions.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun41e378 :: ; proc near
push ebp ;0x0041e378 : 55
mov ebp , esp ;0x0041e379 : 8bec
push ecx ;0x0041e37b : 51
mov ecx , dword ptr [ ebp + 8 ] ;0x0041e37c : 8b4d08
push ebx ;0x0041e37f : 53
push esi ;0x0041e380 : 56
mov esi , dword ptr [ecx] ;0x0041e381 : 8b31
mov ebx , dword ptr [ esi + 8 ] ;0x0041e383 : 8b5e08
xor eax , eax ;0x0041e386 : 33c0
test ebx , ebx ;0x0041e388 : 85db
push edi ;0x0041e38a : 57
mov ecx , ebx ;0x0041e38b : 8bcb
jne Label42a502 ;0x0041e38d : 0f856fc10000
Label41e393 ::
mov ecx , dword ptr [ esi + 08Ch ] ;0x0041e393 : 8b8e8c000000
test ecx , ecx ;0x0041e399 : 85c9
jne Label61a679 ;0x0041e39b : 0f85d8c21f00
Label41e3a1 ::
lea edi , dword ptr [ eax + 1 ] ;0x0041e3a1 : 8d7801
mov eax , edi ;0x0041e3a4 : 8bc7
add eax , 03h ;0x0041e3a6 : 83c003
and eax , 0FFFFFFFCh ;0x0041e3a9 : 83e0fc
mov dword ptr [ ebp - 4 ] , edi ;0x0041e3ac : 897dfc
call Fun42c118 ;0x0041e3af : e864dd0000
mov esi , esp ;0x0041e3b4 : 8bf4
test esi , esi ;0x0041e3b6 : 85f6
je Label61a68e ;0x0041e3b8 : 0f84d0c21f00
mov ecx , edi ;0x0041e3be : 8bcf
mov edx , ecx ;0x0041e3c0 : 8bd1
shr ecx , 02h ;0x0041e3c2 : c1e902
xor eax , eax ;0x0041e3c5 : 33c0
mov edi , esi ;0x0041e3c7 : 8bfe
rep stosd ;0x0041e3c9 : f3ab
mov ecx , edx ;0x0041e3cb : 8bca
and ecx , 03h ;0x0041e3cd : 83e103
test ebx , ebx ;0x0041e3d0 : 85db
rep stosb ;0x0041e3d2 : f3aa
mov eax , ebx ;0x0041e3d4 : 8bc3
je Label41e3e8 ;0x0041e3d6 : 7410
mov edi , edi ;0x0041e3d8 : 8bff
Label41e3da ::
mov ecx , dword ptr [ eax + 68 ] ;0x0041e3da : 8b4844
mov byte ptr [ esi + ecx ] , 01h ;0x0041e3dd : c6040e01
mov eax , dword ptr [ eax + 12 ] ;0x0041e3e1 : 8b400c
test eax , eax ;0x0041e3e4 : 85c0
jne Label41e3da ;0x0041e3e6 : 75f2
Label41e3e8 ::
mov edx , dword ptr [ ebp + 8 ] ;0x0041e3e8 : 8b5508
mov eax , dword ptr [edx] ;0x0041e3eb : 8b02
mov eax , dword ptr [ eax + 08Ch ] ;0x0041e3ed : 8b808c000000
test eax , eax ;0x0041e3f3 : 85c0
jne Label61a698 ;0x0041e3f5 : 0f859dc21f00
Label41e3fb ::
mov ecx , dword ptr [ ebp - 4 ] ;0x0041e3fb : 8b4dfc
mov eax , 01h ;0x0041e3fe : b801000000
cmp ecx , eax ;0x0041e403 : 3bc8
jle Label41e414 ;0x0041e405 : 7e0d
lea ebx , dword ptr [ebx] ;0x0041e407 : 8d1b
Label41e409 ::
cmp byte ptr [ esi + eax ] , 00h ;0x0041e409 : 803c0600
je Label41e414 ;0x0041e40d : 7405
inc eax ;0x0041e40f : 40
cmp eax , ecx ;0x0041e410 : 3bc1
jl Label41e409 ;0x0041e412 : 7cf5
Label41e414 ::
;
; --------------------------------------------------------------------------
; VFP 9.0 FIX - CHECK AVAILABLE WORK AREA FOR OPENING A TABLE FILE
; November 2024
; --------------------------------------------------------------------------
; CCB
;
; Check available work area for opening a table file.
;
; 2024/11/22, by ccb
;
cmp dword ptr vfpa_sys9176_data,00h
je Label41e416
cmp eax , 01h
jl Label41e415
cmp eax , 07FFFh
jg Label41e415
jmp Label41e416
Label41e415 ::
mov ecx , 0E4h
call Fun544742
Label41e416 ::
lea esp , dword ptr [ ebp - 16 ] ;0x0041e414 : 8d65f0
pop edi ;0x0041e417 : 5f
pop esi ;0x0041e418 : 5e
pop ebx ;0x0041e419 : 5b
mov esp , ebp ;0x0041e41a : 8be5
pop ebp ;0x0041e41c : 5d
ret 04h ;0x0041e41d : c20400
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_vfp9fix362.asp
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|