--------------------------------------------------------------------------------
[ENHANCED] VFP 9.0 FIX - OPEN INDEX FILES WITH THE TABLE AUTOMATICALLY
January 2025
--------------------------------------------------------------------------------
CCB
1. BUG:
In vfp9 (and vfp6, vfp7, vfp8), it will open structural compound index files (tablefilename+".cdx") with the table automatically.
In VFP Advanced, it will open structural compound index files (tablefilename+".cdx") with the table automatically.
In VFP Advanced, if we enable opening nonstructural compound index files with the table automatically,
it will open nonstructural compound index files (tablefilename+"_index*.cdx") with the table automatically.
In VFP Advanced, if we enable opening standalone index files with the table automatically,
it will open standalone index files (tablefilename+"_index*.idx") with the table automatically.
2. CAUSE:
There are some BUGs in the following code.
3. RESOLUTION:
We can write some code to fix the BUG.
Fun41e4ef :: ; proc near
push ebp ;0x0041e4ef : 55
mov ebp , esp ;0x0041e4f0 : 8bec
sub esp , 06Ch ;0x0041e4f2 : 83ec6c
mov eax , dword ptr [ ebp + 8 ] ;0x0041e4f5 : 8b4508
cmp eax , 0FFFFFFFFh ;0x0041e4f8 : 83f8ff
push ebx ;0x0041e4fb : 53
push esi ;0x0041e4fc : 56
push edi ;0x0041e4fd : 57
mov dword ptr [ ebp - 20 ] , edx ;0x0041e4fe : 8955ec
mov dword ptr [ ebp - 4 ] , ecx ;0x0041e501 : 894dfc
mov dword ptr [ ebp - 12 ] , 0FFFFFFFFh ;0x0041e504 : c745f4ffffffff
jne Label531dea ;0x0041e50b : 0f85d9381100
Label41e511 ::
lea edx , dword ptr [ ebp - 24 ] ;0x0041e511 : 8d55e8
lea eax , dword ptr [ ebp - 104 ] ;0x0041e514 : 8d4598
call Fun42c27f ;0x0041e517 : e863dd0000
pushd 00h ;0x0041e51c : 6a00
push eax ;0x0041e51e : 50
call Fun42c2be ;0x0041e51f : e89add0000
mov ebx , dword ptr [ ebp + 12 ] ;0x0041e524 : 8b5d0c
add esp , 08h ;0x0041e527 : 83c408
test eax , eax ;0x0041e52a : 85c0
mov dword ptr [ ebp - 16 ] , eax ;0x0041e52c : 8945f0
jne Label4d0794 ;0x0041e52f : 0f855f220b00
mov ecx , dword ptr [ ebp - 4 ] ;0x0041e535 : 8b4dfc
mov edx , dword ptr [ ecx + 8 ] ;0x0041e538 : 8b5108
mov edi , dword ptr [ ebp - 20 ] ;0x0041e53b : 8b7dec
push ebx ;0x0041e53e : 53
push edx ;0x0041e53f : 52
mov eax , edi ;0x0041e540 : 8bc7
call Fun41e620 ;0x0041e542 : e8d9000000
mov esi , eax ;0x0041e547 : 8bf0
test esi , esi ;0x0041e549 : 85f6
mov dword ptr [ ebp - 8 ] , esi ;0x0041e54b : 8975f8
je Label41f158 ;0x0041e54e : 0f84040c0000
mov eax , dword ptr [ esi + 32 ] ;0x0041e554 : 8b4620
test byte ptr ah , 04h ;0x0041e557 : f6c404
jne Label44e19a ;0x0041e55a : 0f853afc0200
Label41e560 ::
mov ecx , dword ptr [ esi + 32 ] ;0x0041e560 : 8b4e20
mov eax , ecx ;0x0041e563 : 8bc1
shr eax , 013h ;0x0041e565 : c1e813
test al , 01h ;0x0041e568 : a801
jne Label619cee ;0x0041e56a : 0f857eb71f00
Label41e570 ::
mov edi , dword ptr [ ebp - 4 ] ;0x0041e570 : 8b7dfc
mov eax , dword ptr [ edi + 8 ] ;0x0041e573 : 8b4708
and ebx , 0FFFFFF7Fh ;0x0041e576 : 81e37fffffff
mov ecx , esi ;0x0041e57c : 8bce
mov dword ptr [ ebp + 12 ] , ebx ;0x0041e57e : 895d0c
call Fun414921 ;0x0041e581 : e89b63ffff
Label41e586 ::
mov eax , dword ptr [ Data937220 ] ;0x0041e586 : a120729300
lea edx , dword ptr [ ebp - 104 ] ;0x0041e58b : 8d5598
cmp edx , eax ;0x0041e58e : 3bd0
jne Label619d4c ;0x0041e590 : 0f85b6b71f00
mov eax , dword ptr [ Data937220 ] ;0x0041e596 : a120729300
mov eax , dword ptr [ eax + 76 ] ;0x0041e59b : 8b404c
cmp dword ptr [ ebp - 24 ] , eax ;0x0041e59e : 3945e8
mov dword ptr [ Data937220 ] , eax ;0x0041e5a1 : a320729300
jne Label619d56 ;0x0041e5a6 : 0f85aab71f00
mov eax , dword ptr [ ebp - 12 ] ;0x0041e5ac : 8b45f4
cmp eax , 0FFFFFFFFh ;0x0041e5af : 83f8ff
jne Label531e34 ;0x0041e5b2 : 0f857c381100
Label41e5b8 ::
mov ecx , dword ptr [ ebp - 16 ] ;0x0041e5b8 : 8b4df0
xor eax , eax ;0x0041e5bb : 33c0
cmp ecx , eax ;0x0041e5bd : 3bc8
jne Label4d079c ;0x0041e5bf : 0f85d7210b00
mov edi , dword ptr [esi] ;0x0041e5c5 : 8b3e
cmp edi , dword ptr [ Data937108 ] ;0x0041e5c7 : 3b3d08719300
jnb Label619d6c ;0x0041e5cd : 0f8399b71f00
mov ecx , dword ptr [ Data93757c ] ;0x0041e5d3 : 8b0d7c759300
imul edi , edi , 038h ;0x0041e5d9 : 6bff38
mov al , byte ptr [ edi + ecx + 44 ] ;0x0041e5dc : 8a440f2c
add edi , ecx ;0x0041e5e0 : 03f9
test al , 01h ;0x0041e5e2 : a801
je Label619d76 ;0x0041e5e4 : 0f848cb71f00
test byte ptr [ edi + 8 ] , 01h ;0x0041e5ea : f6470801
jne Label4f18ae ;0x0041e5ee : 0f85ba320d00
Label41e5f4 ::
mov edx , dword ptr [ ebp + 8 ] ;0x0041e5f4 : 8b5508
mov ecx , ebx ;0x0041e5f7 : 8bcb
or ecx , 01000h ;0x0041e5f9 : 81c900100000
push ecx ;0x0041e5ff : 51
mov ecx , dword ptr [ ebp - 4 ] ;0x0041e600 : 8b4dfc
push edx ;0x0041e603 : 52
mov edx , esi ;0x0041e604 : 8bd6
call Fun41dee2 ;0x0041e606 : e8d7f8ffff
mov esi , eax ;0x0041e60b : 8bf0
test esi , esi ;0x0041e60d : 85f6
jne Label619d80 ;0x0041e60f : 0f856bb71f00
;
; ---------------------------------------------------------------------
; VFP 9.0 FIX - OPEN INDEX FILES WITH THE TABLE AUTOMATICALLY
; January 2024
; ---------------------------------------------------------------------
; CCB
;
; Open index files with the table automatically.
;
; 2024/1/17, by ccb
;
Label41e614_cdxfiles_start ::
cmp dword ptr vfpa_sys9144_data,00h
je Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_incopycommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_increatecommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_inmodifycommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_inimportcommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_inopendatabasecommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_insetclasslibcommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_insetresourcecommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_inaddclasscommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_inbuildcommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_injoincommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_insortcommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_intotalcommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_inselectintotablecommand,00h
jne Label41e614_cdxfiles_end
cmp dword ptr vfpa_openindexfiles_inpackdbfcommand,00h
jne Label41e614_cdxfiles_end
mov eax , dword ptr [ ebp - 8 ]
mov eax , dword ptr [eax]
call Fun53b58b
test byte ptr [ eax + 8 ] , 10h
jne Label41e614_cdxfiles_end
push 02h
push dword ptr [ ebp - 4 ]
call vfpa_openindexfiles
mov esi , eax
test esi , esi
jne Label619d80
Label41e614_cdxfiles_end ::
Label41e614_idxfiles_start ::
cmp dword ptr vfpa_sys9145_data,00h
je Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_incopycommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_increatecommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_inmodifycommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_inimportcommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_inopendatabasecommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_insetclasslibcommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_insetresourcecommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_inaddclasscommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_inbuildcommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_injoincommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_insortcommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_intotalcommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_inselectintotablecommand,00h
jne Label41e614_idxfiles_end
cmp dword ptr vfpa_openindexfiles_inpackdbfcommand,00h
jne Label41e614_idxfiles_end
mov eax , dword ptr [ ebp - 8 ]
mov eax , dword ptr [eax]
call Fun53b58b
test byte ptr [ eax + 8 ] , 10h
jne Label41e614_idxfiles_end
push 03h
push dword ptr [ ebp - 4 ]
call vfpa_openindexfiles
mov esi , eax
test esi , esi
jne Label619d80
Label41e614_idxfiles_end ::
Label41e615 ::
pop edi ;0x0041e615 : 5f
mov eax , esi ;0x0041e616 : 8bc6
pop esi ;0x0041e618 : 5e
pop ebx ;0x0041e619 : 5b
mov esp , ebp ;0x0041e61a : 8be5
pop ebp ;0x0041e61c : 5d
ret 08h ;0x0041e61d : 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:
The following commands will open index files with the table automatically:
ALTER - SQL command
DELETE - SQL command
DO FORM command - DataEnvironment object
INSERT - SQL command
LABEL FORM command - DataEnvironment object
REPORT FORM command - DataEnvironment object
SELECT - SQL command
UPDATE - SQL command
USE command
The following commands will not open index files with the (destination) table automatically:
ADD CLASS command
BUILD command
COPY command
CREATE command
IMPORT command
JOIN command
MODIFY command
OPEN DATABASE command
PACK command
SELECT ... INTO CURSOR NOFILTER - SQL command
SELECT ... INTO TABLE - SQL command
SET CLASSLIB command
SET RESOURCE command
SORT command
TOTAL command
The following functions will not open index files with the table (cursor) automatically:
SQLCOLUMNS() function
SQLEXEC() function
SQLMORERESULTS() function
SQLPREPARE() function
SQLTABLES() function
XMLTOCURSOR() function
When VFP Advanced opening the following table files, it will not open index files automatically:
Database table files (.dbc, .dct, .dcx)
Form table files (.scx, .sct)
Label table files (.lbx, .lbt)
Menu table files (.mnx, .mnt)
Project table files (.pjx, .pjt)
Report table files (.frx, .frt)
Table files without a file extension
Temporary table (cursor) files (.tmp)
Visual class library table files (.vcx, .vct)
For the COPY ... WITH CDX command, it will copy structural compound index files (tablefilename+".cdx").
If we enable opening nonstructural compound index files with the table automatically in Visual FoxPro Advanced,
it will also copy nonstructural structural compound index files (tablefilename+"_index*.cdx").
If we enable opening standalone index files with the table automatically in Visual FoxPro Advanced,
it will also copy standalone index files (tablefilename+"_index*.idx").
5. REFERENCE WEBSITES:
1, baiyujia.com:
http://www.baiyujia.com
http://www.baiyujia.com/vfpdocuments/f_vfp9fix298.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix299.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix300.asp
http://www.baiyujia.com/vfpdocuments/f_vfp9fix302.asp
6. OTHER:
For reference only, there is no guarantees.
Any questions or suggestions, please send me an email at ccb2000@163.com.
|