-------------------------------------------------------------------------------- [NEW.....] VFP 9.0 FIX - THE LOCKMEMORY TERM IN THE CONFIGURATION FILE January 2024 -------------------------------------------------------------------------------- CCB 1. THE LOCKMEMORY TERM: LOCKMEMORY - Enables or disables locking memory into the working set Enables or disables locking memory into the working set. LOCKMEMORY = ON | OFF Parameters ON Enables locking memory into the working set. OFF Disables locking memory into the working set. OFF is the startup default for Visual FoxPro Advanced 10.2 or later. Remarks If we set LOCKMEMORY = ON (and SETWORKINGSETSIZE = ON), Visual FoxPro Advanced 10.2 or later version will lock memory into the working set. If we set LOCKMEMORY = OFF (or SETWORKINGSETSIZE = OFF), Visual FoxPro Advanced 10.2 or later version will not lock memory into the working set. The LOCKMEMORY term is only used in Visual FoxPro Advanced 10.2 or later. The LOCKMEMORY term is only used for Visual FoxPro Large Memory Driver (VFPLMD) on Windows 8, Windows Server 2012 or later, it is not used for Visual FoxPro Large Memory Driver (VFPLMD) on Windows 7, Windows Server 2008 or earlier, it is not used for Visual FoxPro Large Memory Manager (VFPLMM) and Visual FoxPro Address Windowing Extensions (VFPAWE). For some performance reasons, we ALWAYS set LOCKMEMORY = OFF for Visual FoxPro Advanced Multi-threaded Runtime. For more information about locking memory, please refer to: https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtuallock https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/enable-the-lock-pages-in-memory-option-windows To enable the lock pages in memory option, 1, On the Start menu, select Run. In the Open box, type gpedit.msc. The Group Policy dialog box opens. 2, On the Local Group Group Policy console, expand Computer Configuration. 3, Expand Windows Settings. 4, Expand Security Settings. 5, Expand Local Policies. 6, Select the User Rights Assignment folder. The policies will be displayed in the details pane. 7, In the pane, scroll to and double-click the Lock pages in memory policy. 8, In the Local Security Policy Setting dialog box, select "Add User or Group" to add the user or group account. 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 LOCKMEMORY TERM IN THE CONFIGURATION FILE ; January 2024 ; --------------------------------------------------------------------- ; CCB ; ; The LOCKMEMORY term in the configuration file. ; ; 2024/1/1, by ccb ; lea ecx , dword ptr [ ebp + 0FFFFFF60h ] vfpa_config_lockmemory_start: cmp byte ptr [ecx] , 04Ch ;; L jne vfpa_config_lockmemory_end cmp byte ptr [ecx+1] , 04Fh ;; O jne vfpa_config_lockmemory_end cmp byte ptr [ecx+2] , 043h ;; C jne vfpa_config_lockmemory_end cmp byte ptr [ecx+3] , 04Bh ;; K jne vfpa_config_lockmemory_end cmp byte ptr [ecx+4] , 04Dh ;; M jne vfpa_config_lockmemory_end cmp byte ptr [ecx+5] , 045h ;; E jne vfpa_config_lockmemory_end cmp byte ptr [ecx+6] , 04Dh ;; M jne vfpa_config_lockmemory_end cmp byte ptr [ecx+7] , 04Fh ;; O jne vfpa_config_lockmemory_end cmp byte ptr [ecx+8] , 052h ;; R jne vfpa_config_lockmemory_end cmp byte ptr [ecx+9] , 059h ;; Y jne vfpa_config_lockmemory_end cmp byte ptr [ecx+10] , 000h jne vfpa_config_lockmemory_end push ebx xor edi , edi inc edi 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 lea eax , dword ptr [ ebp + 0FFFFFF38h ] lea edi , dword ptr [ ebp + 0FFFFFD0Ch ] call Fun87dfe0 cmp eax , 01h jne vfpa_config_lockmemory_default xor eax , eax cmp dword ptr [ ebp + 0FFFFFD0Ch ] , 00h setne al IF VFPA_VERSION GE 102 mov dword ptr vfpa_config_lockmemory_data,eax mov dword ptr vfpa_config_lockmemory2_data,eax ELSE mov dword ptr vfpa_config_lockmemory_data,00h mov dword ptr vfpa_config_lockmemory2_data,00h ENDIF IF VFPA_CONST_X64_MODULEID EQ 02h mov dword ptr vfpa_config_lockmemory_data,00h mov dword ptr vfpa_config_lockmemory2_data,00h ENDIF jmp Label40a660 vfpa_config_lockmemory_default: cmp dword ptr [ ebp + 0FFFFFF3Ch ] , 0Eh jne Label5d6256 IF VFPA_VERSION GE 102 mov dword ptr vfpa_config_lockmemory_data,00h mov dword ptr vfpa_config_lockmemory2_data,00h ELSE mov dword ptr vfpa_config_lockmemory_data,00h mov dword ptr vfpa_config_lockmemory2_data,00h ENDIF IF VFPA_CONST_X64_MODULEID EQ 02h mov dword ptr vfpa_config_lockmemory_data,00h mov dword ptr vfpa_config_lockmemory2_data,00h ENDIF jmp Label40a660 vfpa_config_lockmemory_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_vfp9fix282.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix283.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix284.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix285.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix294.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix297.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. |