-------------------------------------------------------------------------------- [NEW.....] VFP 9.0 FIX - THE BUFFERSIZE TERM IN THE CONFIGURATION FILE January 2024 -------------------------------------------------------------------------------- CCB 1. THE BUFFERSIZE TERM: BUFFERSIZE - Specifies the maximum amount of memory in pages for file data buffer Specifies the maximum amount of memory in pages for file data buffer. BUFFERSIZE = nMemoryPages Parameters nMemoryPages The nMemoryPages parameter specifies the maximum amount of memory in pages for file data buffer. The range for nMemoryPages is 1 page (64 KB) to 256 pages (16 MB). The default value is 1 page (64 KB) for Visual FoxPro Advanced 10.0 and 10.1. The default value is 2 pages (128 KB) for Visual FoxPro Advanced 10.2 or later. Remarks If we set BUFFERSIZE = 1 page, the maximum amount of memory is equal to 64 KB for file data buffer. If we set BUFFERSIZE = 2 pages, the maximum amount of memory is equal to 128 KB for file data buffer. If we set BUFFERSIZE = 16 pages, the maximum amount of memory is equal to 1 MB for file data buffer. If we set BUFFERSIZE = 256 pages, the maximum amount of memory is equal to 16 MB for file data buffer. For some performance reasons, we ALWAYS set BUFFERSIZE = 1 page (64 KB) for Visual FoxPro Large Memory Manager (VFPLMM) and Visual FoxPro Address Windowing Extensions (VFPAWE). 2. CAUSE: There are some BUGs in the following code. 3. RESOLUTION: We can write some code to fix the BUG. Fun40a45d :: ; proc near push ebp ;0x0040a45d : 55 lea ebp , dword ptr [ esp - 104 ] ;0x0040a45e : 8d6c2498 sub esp , 0454h ;0x0040a462 : 81ec54040000 mov eax , dword ptr [ Data937090 ] ;0x0040a468 : a190709300 mov ecx , dword ptr [ ebp + 112 ] ;0x0040a46d : 8b4d70 push ebx ;0x0040a470 : 53 push esi ;0x0040a471 : 56 mov esi , dword ptr [ ebp + 116 ] ;0x0040a472 : 8b7574 mov dword ptr [ ebp + 100 ] , eax ;0x0040a475 : 894564 lea eax , dword ptr [ esi + 0642h ] ;0x0040a478 : 8d8642060000 mov dword ptr [ ebp + 0FFFFFD04h ] , eax ;0x0040a47e : 898504fdffff push edi ;0x0040a484 : 57 lea eax , dword ptr [ esi + 0A5Ch ] ;0x0040a485 : 8d865c0a0000 mov dword ptr [ ebp + 0FFFFFD24h ] , eax ;0x0040a48b : 898524fdffff xor ebx , ebx ;0x0040a491 : 33db xor eax , eax ;0x0040a493 : 33c0 inc eax ;0x0040a495 : 40 push ebx ;0x0040a496 : 53 push eax ;0x0040a497 : 50 mov dword ptr [ ebp + 0FFFFFD10h ] , eax ;0x0040a498 : 898510fdffff push ebx ;0x0040a49e : 53 lea eax , dword ptr [ ebp + 0FFFFFF38h ] ;0x0040a49f : 8d8538ffffff push eax ;0x0040a4a5 : 50 mov dword ptr [ ebp + 0FFFFFD28h ] , ebx ;0x0040a4a6 : 899d28fdffff mov dword ptr [ ebp + 0FFFFFF58h ] , ecx ;0x0040a4ac : 898d58ffffff call Fun430428 ;0x0040a4b2 : e8715f0200 cmp eax , 04h ;0x0040a4b7 : 83f804 jne Label40a660 ;0x0040a4ba : 0f85a0010000 lea ecx , dword ptr [ ebp + 0FFFFFF60h ] ;0x0040a4c0 : 8d8d60ffffff mov edx , 0100h ;0x0040a4c6 : ba00010000 lea eax , dword ptr [ ebp + 0FFFFFE38h ] ;0x0040a4cb : 8d8538feffff call Fun42c33e ;0x0040a4d1 : e8681e0200 cmp byte ptr [ ebp + 0FFFFFF60h ] , 05Fh ;0x0040a4d6 : 80bd60ffffff5f jne Label40a540 ;0x0040a4dd : 7561 lea edi , dword ptr [ ebp + 0FFFFFF60h ] ;0x0040a4df : 8dbd60ffffff call Fun43099a ;0x0040a4e5 : e8b0640200 mov edi , eax ;0x0040a4ea : 8bf8 lea eax , dword ptr [ edi - 36 ] ;0x0040a4ec : 8d47dc cmp eax , 034h ;0x0040a4ef : 83f834 ja Label40a540 ;0x0040a4f2 : 774c movzx eax ,byte ptr [ eax + offset Data4134f1 ] ;0x0040a4f4 : 0fb680f1344100 jmp dword ptr [ 4 * eax + offset DataPtr4134e9 ] ;0x0040a4fb : ff2485e9344100 Label40a502 :: cmp dword ptr [ ebp + 120 ] , ebx ;0x0040a502 : 395d78 jne Label5d60f1 ;0x0040a505 : 0f85e6bb1c00 Label40a50b :: xor eax , eax ;0x0040a50b : 33c0 lea ecx , dword ptr [ ebp + 0FFFFFF38h ] ;0x0040a50d : 8d8d38ffffff call Fun43d764 ;0x0040a513 : e84c320300 lea eax , dword ptr [ ebp + 0FFFFFF60h ] ;0x0040a518 : 8d8560ffffff push eax ;0x0040a51e : 50 mov eax , edi ;0x0040a51f : 8bc7 call Fun409f9c ;0x0040a521 : e876faffff mov eax , edi ;0x0040a526 : 8bc7 sub eax , 04Dh ;0x0040a528 : 83e84d je Label5d613c ;0x0040a52b : 0f840bbc1c00 dec eax ;0x0040a531 : 48 je Label5d611c ;0x0040a532 : 0f84e4bb1c00 Label40a538 :: xor eax , eax ;0x0040a538 : 33c0 inc eax ;0x0040a53a : 40 jmp Label40a666 ;0x0040a53b : e926010000 Label40a540 :: cmp dword ptr [ ebp + 0FFFFFF3Ch ] , 06D1h ;0x0040a540 : 81bd3cffffffd1060000 je Label5d615c ;0x0040a54a : 0f840cbc1c00 lea eax , dword ptr [ ebp + 0FFFFFF40h ] ;0x0040a550 : 8d8540ffffff lea ecx , dword ptr [ ebp + 0FFFFFF60h ] ;0x0040a556 : 8d8d60ffffff call Fun415309 ;0x0040a55c : e8a8ad0000 cmp eax , 07h ;0x0040a561 : 83f807 mov dword ptr [ ebp + 0FFFFFD18h ] , eax ;0x0040a564 : 898518fdffff je Label40a5e2 ;0x0040a56a : 7476 cmp eax , 067h ;0x0040a56c : 83f867 je Label40a5e2 ;0x0040a56f : 7471 cmp eax , 030h ;0x0040a571 : 83f830 je Label5d61b3 ;0x0040a574 : 0f8439bc1c00 mov edi , strncmp ;0x0040a57a : 8b3dcc799100 pushd 04h ;0x0040a580 : 6a04 lea eax , dword ptr [ ebp + 0FFFFFE38h ] ;0x0040a582 : 8d8538feffff pushd offset Data9191dc ;0x0040a588 : 68dc919100 push eax ;0x0040a58d : 50 call edi ;0x0040a58e : ffd7 add esp , 0Ch ;0x0040a590 : 83c40c test eax , eax ;0x0040a593 : 85c0 je Label5d61fb ;0x0040a595 : 0f8460bc1c00 pushd 05h ;0x0040a59b : 6a05 lea eax , dword ptr [ ebp + 0FFFFFE38h ] ;0x0040a59d : 8d8538feffff pushd offset Data91cc84 ;0x0040a5a3 : 6884cc9100 push eax ;0x0040a5a8 : 50 call edi ;0x0040a5a9 : ffd7 add esp , 0Ch ;0x0040a5ab : 83c40c test eax , eax ;0x0040a5ae : 85c0 je Label5d61fb ;0x0040a5b0 : 0f8445bc1c00 Label40a5b6 :: cmp dword ptr [ ebp + 120 ] , ebx ;0x0040a5b6 : 395d78 je Label40a5e2 ;0x0040a5b9 : 7427 ; ; --------------------------------------------------------------------- ; VFP 9.0 FIX - THE BUFFERSIZE TERM IN THE CONFIGURATION FILE ; September 2023 ; --------------------------------------------------------------------- ; CCB ; ; The BUFFERSIZE term in the configuration file. ; ; 2023/9/19, by ccb ; lea ecx , dword ptr [ ebp + 0FFFFFF60h ] vfpa_config_buffersize_startstart: cmp byte ptr [ecx] , 042h ;; B jne vfpa_config_buffersize_end cmp byte ptr [ecx+1] , 055h ;; U jne vfpa_config_buffersize_end cmp byte ptr [ecx+2] , 046h ;; F jne vfpa_config_buffersize_end cmp byte ptr [ecx+3] , 046h ;; F jne vfpa_config_buffersize_end cmp byte ptr [ecx+4] , 045h ;; E jne vfpa_config_buffersize_end cmp byte ptr [ecx+5] , 052h ;; R jne vfpa_config_buffersize_end cmp byte ptr [ecx+6] , 053h ;; S jne vfpa_config_buffersize_end cmp byte ptr [ecx+7] , 049h ;; I jne vfpa_config_buffersize_end cmp byte ptr [ecx+8] , 05Ah ;; Z jne vfpa_config_buffersize_end cmp byte ptr [ecx+9] , 045h ;; E jne vfpa_config_buffersize_end cmp byte ptr [ecx+10] , 000h jne vfpa_config_buffersize_end xor edi , edi inc edi push ebx push edi push ebx lea eax , dword ptr [ ebp + 0FFFFFF38h ] push eax call Fun430428 cmp eax , edi jne Label5d6256 cmp dword ptr [ ebp + 0FFFFFF3Ch ] , 010h jne Label5d6256 push ebx push edi push ebx lea eax , dword ptr [ ebp + 0FFFFFF38h ] push eax call Fun430428 cmp eax , 05h jne Label5d6256 mov eax , dword ptr [ Data937fdc ] pushd 100h pushd 01h lea esi , dword ptr [ ebp + 0FFFFFF38h ] mov dword ptr [ ebp + 0FFFFFF58h ] , eax mov byte ptr [ ebp + 0FFFFFF38h ] , 07h call Fun87e084 cmp eax , 0FFFFFFFFh je Label5d6256 vfpa_config_buffersize_validbuffersize_start: cmp eax , 100h jae vfpa_config_buffersize_validbuffersize_256 cmp eax , 80h jae vfpa_config_buffersize_validbuffersize_128 cmp eax , 40h jae vfpa_config_buffersize_validbuffersize_64 cmp eax , 20h jae vfpa_config_buffersize_validbuffersize_32 cmp eax , 10h jae vfpa_config_buffersize_validbuffersize_16 cmp eax , 08h jae vfpa_config_buffersize_validbuffersize_8 cmp eax , 04h jae vfpa_config_buffersize_validbuffersize_4 cmp eax , 02h jae vfpa_config_buffersize_validbuffersize_2 cmp eax , 01h jae vfpa_config_buffersize_validbuffersize_1 jmp vfpa_config_buffersize_validbuffersize_1 vfpa_config_buffersize_validbuffersize_256: mov eax , 100h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_128: mov eax , 80h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_64: mov eax , 40h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_32: mov eax , 20h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_16: mov eax , 10h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_8: mov eax , 08h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_4: mov eax , 04h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_2: mov eax , 02h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_1: mov eax , 01h jmp vfpa_config_buffersize_validbuffersize_end vfpa_config_buffersize_validbuffersize_end: IF VFPA_VERSION GE 102 cmp dword ptr vfpa_sys9082_data[8],03h jne vfpa_config_buffersize_start000 jmp vfpa_config_buffersize_start vfpa_config_buffersize_start000: cmp dword ptr vfpa_sys9082_data[8],02h jne vfpa_config_buffersize_start00 mov eax , 01h jmp vfpa_config_buffersize_start vfpa_config_buffersize_start00: cmp dword ptr vfpa_sys9082_data[8],01h jne vfpa_config_buffersize_start0 mov eax , 01h jmp vfpa_config_buffersize_start vfpa_config_buffersize_start0: cmp dword ptr vfpa_sys9082_data[8],00h jne vfpa_config_buffersize_start jmp vfpa_config_buffersize_start vfpa_config_buffersize_start: ENDIF cmp dword ptr vfpa_config_buffersize_data,eax je Label40a660 push eax ;; Purge Cached File Data Buffer mov eax , 07FFFFFFFh call Fun68507b ;; Purge Cached Virtual Memory push esi push ecx lea esi , dword ptr [ esp ] mov dword ptr [ esp ] , 07FFFFFFFh call Fun7e0c91 pop ecx pop esi ;; Purge Cached Large Memory call vfpa_lmm_purgecachedmemory ;; Set Process Working Set Size for Large Memory call vfpa_lmm_setprocessworkingsetsize pop eax mov ecx , dword ptr [ Data93bb40 ] test ecx , ecx jne Label40a660 mov dword ptr vfpa_config_buffersize_data , eax shl eax , 10h mov dword ptr vfpa_config_buffersize_data[8] , eax vfpa_config_buffersize_resetbuffersize_start: mov eax , dword ptr vfpa_config_buffersize_data mov ecx , 0FFFF0000h mov edx , 08000FFFFh cmp eax , 100h jae vfpa_config_buffersize_resetbuffersize_256 cmp eax , 80h jae vfpa_config_buffersize_resetbuffersize_128 cmp eax , 40h jae vfpa_config_buffersize_resetbuffersize_64 cmp eax , 20h jae vfpa_config_buffersize_resetbuffersize_32 cmp eax , 10h jae vfpa_config_buffersize_resetbuffersize_16 cmp eax , 08h jae vfpa_config_buffersize_resetbuffersize_8 cmp eax , 04h jae vfpa_config_buffersize_resetbuffersize_4 cmp eax , 02h jae vfpa_config_buffersize_resetbuffersize_2 cmp eax , 01h jae vfpa_config_buffersize_resetbuffersize_1 jmp vfpa_config_buffersize_resetbuffersize_1 vfpa_config_buffersize_resetbuffersize_256: mov ecx , 0FF000000h mov edx , 080FFFFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_128: mov ecx , 0FF800000h mov edx , 0807FFFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_64: mov ecx , 0FFC00000h mov edx , 0803FFFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_32: mov ecx , 0FFE00000h mov edx , 0801FFFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_16: mov ecx , 0FFF00000h mov edx , 0800FFFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_8: mov ecx , 0FFF80000h mov edx , 08007FFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_4: mov ecx , 0FFFC0000h mov edx , 08003FFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_2: mov ecx , 0FFFE0000h mov edx , 08001FFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_1: mov ecx , 0FFFF0000h mov edx , 08000FFFFh jmp vfpa_config_buffersize_resetbuffersize_end vfpa_config_buffersize_resetbuffersize_end: mov dword ptr vfpa_config_buffersize_data[10h] , ecx mov dword ptr vfpa_config_buffersize_data[18h] , edx mov eax , dword ptr vfpa_config_buffersize_data mov dword ptr vfpa_sys9140_data , eax jmp Label40a660 vfpa_config_buffersize_end: push ebx ;0x0040a5bb : 53 xor edi , edi ;0x0040a5bc : 33ff inc edi ;0x0040a5be : 47 push edi ;0x0040a5bf : 57 push ebx ;0x0040a5c0 : 53 lea eax , dword ptr [ ebp + 0FFFFFF38h ] ;0x0040a5c1 : 8d8538ffffff push eax ;0x0040a5c7 : 50 call Fun430428 ;0x0040a5c8 : e85b5e0200 cmp eax , edi ;0x0040a5cd : 3bc7 jne Label5d6256 ;0x0040a5cf : 0f8581bc1c00 cmp dword ptr [ ebp + 0FFFFFF3Ch ] , 010h ;0x0040a5d5 : 83bd3cffffff10 jne Label5d6256 ;0x0040a5dc : 0f8574bc1c00 Label40a5e2 :: mov eax , dword ptr [ ebp + 0FFFFFD18h ] ;0x0040a5e2 : 8b8518fdffff cmp eax , 0F6h ;0x0040a5e8 : 3df6000000 ja Label5d6273 ;0x0040a5ed : 0f8780bc1c00 movzx eax ,byte ptr [ eax + offset Data413716 ] ;0x0040a5f3 : 0fb68016374100 jmp dword ptr [ 4 * eax + offset DataPtr413526 ] ;0x0040a5fa : ff248526354100 Label40a601 :: lea edx , dword ptr [ ebp + 0FFFFFD00h ] ;0x0040a601 : 8d9500fdffff lea eax , dword ptr [ ebp + 0FFFFFC68h ] ;0x0040a607 : 8d8568fcffff call Fun42c27f ;0x0040a60d : e86d1c0200 push ebx ;0x0040a612 : 53 push eax ;0x0040a613 : 50 call Fun42c2be ;0x0040a614 : e8a51c0200 cmp eax , ebx ;0x0040a619 : 3bc3 pop ecx ;0x0040a61b : 59 pop ecx ;0x0040a61c : 59 jne Label40a64e ;0x0040a61d : 752f lea eax , dword ptr [ ebp + 0FFFFFD1Ch ] ;0x0040a61f : 8d851cfdffff push eax ;0x0040a625 : 50 lea eax , dword ptr [ ebp + 0FFFFFF38h ] ;0x0040a626 : 8d8538ffffff call Fun40a75a ;0x0040a62c : e829010000 test eax , eax ;0x0040a631 : 85c0 je Label40a64e ;0x0040a633 : 7419 lea eax , dword ptr [ ebp + 0FFFFFD1Ch ] ;0x0040a635 : 8d851cfdffff xor ecx , ecx ;0x0040a63b : 33c9 push eax ;0x0040a63d : 50 inc ecx ;0x0040a63e : 41 call Fun4157c8 ;0x0040a63f : e884b10000 mov eax , dword ptr [ ebp + 116 ] ;0x0040a644 : 8b4574 or dword ptr [ eax + 0A78h ] , 01h ;0x0040a647 : 8388780a000001 Label40a64e :: lea eax , dword ptr [ ebp + 0FFFFFD00h ] ;0x0040a64e : 8d8500fdffff push eax ;0x0040a654 : 50 lea eax , dword ptr [ ebp + 0FFFFFC68h ] ;0x0040a655 : 8d8568fcffff Label40a65b :: call Fun42d200 ;0x0040a65b : e8a02b0200 Label40a660 :: mov eax , dword ptr [ ebp + 0FFFFFD10h ] ;0x0040a660 : 8b8510fdffff Label40a666 :: mov ecx , dword ptr [ ebp + 100 ] ;0x0040a666 : 8b4d64 call Fun42bf1d ;0x0040a669 : e8af180200 pop edi ;0x0040a66e : 5f pop esi ;0x0040a66f : 5e pop ebx ;0x0040a670 : 5b add ebp , 068h ;0x0040a671 : 83c568 leave ;0x0040a674 : c9 ret 010h ;0x0040a675 : c21000 4. APPLIES TO: VFP 10 (VFP Advanced) 5. REFERENCE WEBSITES: 1, baiyujia.com: http://www.baiyujia.com http://www.baiyujia.com/vfpdocuments/f_vfpconfigterms.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix113.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix271.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix282.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix283.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix284.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix286.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix294.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix296.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. |