----------------------------------------------------------------------------------------- [BUG/PRB.] VFP 9.0 FIX - THE STRTOFILE() FUNCTION USES THE WINDOWS SYSTEM CACHE January 2024 ----------------------------------------------------------------------------------------- CCB 1. BUG: In vfp9 (and vfp6, vfp7, vfp8), somtimes the STRTOFILE() function runs failed on Windows Vista or later. 2. CAUSE: There are some compatible problems when the STRTOFILE() function calls the CreateFileA Windows API for the Windows Defender program or the antivirus programs. Now if the STRTOFILE() function calls the CreateFileA Windows API failed, it will call the CreateFileA Windows API 3 times again. There are some BUGs in the following code. 3. RESOLUTION: We can write some code to fix the BUG. Label52ba3f :: push ebp ;0x0052ba3f : 55 lea ebp , dword ptr [ esp + 0FFFFFE08h ] ;0x0052ba40 : 8dac2408feffff sub esp , 0278h ;0x0052ba47 : 81ec78020000 mov eax , dword ptr [ Data937090 ] ;0x0052ba4d : a190709300 or dword ptr [ ebp - 40 ] , 0FFFFFFFFh ;0x0052ba52 : 834dd8ff and dword ptr [ ebp - 28 ] , 00h ;0x0052ba56 : 8365e400 push ebx ;0x0052ba5a : 53 push esi ;0x0052ba5b : 56 push edi ;0x0052ba5c : 57 mov dword ptr [ ebp + 01F4h ] , eax ;0x0052ba5d : 8985f4010000 mov dword ptr [ ebp - 36 ] , 08h ;0x0052ba63 : c745dc08000000 call Fun420d8c ;0x0052ba6a : e81d53efff mov ebx , eax ;0x0052ba6f : 8bd8 mov dword ptr [ ebp - 44 ] , ebx ;0x0052ba71 : 895dd4 call Fun42371d ;0x0052ba74 : e8a47cefff lea esi , dword ptr [ ebx + 44 ] ;0x0052ba79 : 8d732c mov eax , esi ;0x0052ba7c : 8bc6 call Fun42371d ;0x0052ba7e : e89a7cefff cmp byte ptr [ebx] , 048h ;0x0052ba83 : 803b48 jne Label60c6e8 ;0x0052ba86 : 0f855c0c0e00 cmp byte ptr [esi] , 048h ;0x0052ba8c : 803e48 jne Label60c6e8 ;0x0052ba8f : 0f85530c0e00 cmp dword ptr [ Data936f1c ] , 03h ;0x0052ba95 : 833d1c6f930003 jne Label52bac3 ;0x0052ba9c : 7525 lea edi , dword ptr [ ebx + 88 ] ;0x0052ba9e : 8d7b58 call Fun529a6e ;0x0052baa1 : e8c8dfffff mov al , byte ptr [edi] ;0x0052baa6 : 8a07 cmp al , 049h ;0x0052baa8 : 3c49 je Label52bbc4 ;0x0052baaa : 0f8414010000 cmp al , 04Ch ;0x0052bab0 : 3c4c jne Label60c6e8 ;0x0052bab2 : 0f85300c0e00 xor eax , eax ;0x0052bab8 : 33c0 cmp dword ptr [ ebx + 96 ] , eax ;0x0052baba : 394360 setne al ;0x0052babd : 0f95c0 mov dword ptr [ ebp - 28 ] , eax ;0x0052bac0 : 8945e4 Label52bac3 :: mov edx , esi ;0x0052bac3 : 8bd6 lea ebx , dword ptr [ ebp - 24 ] ;0x0052bac5 : 8d5de8 call Fun52b398 ;0x0052bac8 : e8cbf8ffff xor esi , esi ;0x0052bacd : 33f6 push esi ;0x0052bacf : 56 push esi ;0x0052bad0 : 56 pushd offset Data91aed0 ;0x0052bad1 : 68d0ae9100 pushd 0104h ;0x0052bad6 : 6804010000 mov eax , ebx ;0x0052badb : 8bc3 push eax ;0x0052badd : 50 call Fun437e2a ;0x0052bade : e847c3f0ff push eax ;0x0052bae3 : 50 mov edx , ebx ;0x0052bae4 : 8bd3 lea ecx , dword ptr [ ebp + 0ECh ] ;0x0052bae6 : 8d8dec000000 call Fun42cc34 ;0x0052baec : e84311f0ff lea edx , dword ptr [ ebp - 48 ] ;0x0052baf1 : 8d55d0 lea eax , dword ptr [ ebp - 128 ] ;0x0052baf4 : 8d4580 call Fun42c27f ;0x0052baf7 : e88307f0ff push esi ;0x0052bafc : 56 push eax ;0x0052bafd : 50 call Fun42c2be ;0x0052bafe : e8bb07f0ff mov ebx , eax ;0x0052bb03 : 8bd8 pop ecx ;0x0052bb05 : 59 cmp ebx , esi ;0x0052bb06 : 3bde mov esi , dword ptr [ ebp - 44 ] ;0x0052bb08 : 8b75d4 pop ecx ;0x0052bb0b : 59 jne Label52bbd5 ;0x0052bb0c : 0f85c3000000 cmp dword ptr [ ebp - 28 ] , 01h ;0x0052bb12 : 837de401 lea eax , dword ptr [ ebp + 0ECh ] ;0x0052bb16 : 8d85ec000000 jne Label50b798 ;0x0052bb1c : 0f8576fcfdff pushd 00h ;0x0052bb22 : 6a00 push eax ;0x0052bb24 : 50 call Fun42c9be ;0x0052bb25 : e8940ef0ff test eax , eax ;0x0052bb2a : 85c0 je Label52bb32 ;0x0052bb2c : 7404 and dword ptr [ ebp - 36 ] , 00h ;0x0052bb2e : 8365dc00 Label52bb32 :: ; ; ------------------------------------------------------------------------------ ; VFP 9.0 FIX - THE STRTOFILE() FUNCTION USES THE WINDOWS SYSTEM CACHE ; February 2019 ; ------------------------------------------------------------------------------ ; CCB ; ; The STRTOFILE() function uses the Windows system cache. ; ; 2019/2/28, by ccb ; ; mov dword ptr vfpa_strtofile_isstrtofile,01h mov edx , dword ptr [ ebp - 36 ] ;0x0052bb32 : 8b55dc and dword ptr [ ebp - 32 ] , 00h ;0x0052bb35 : 8365e000 or edx , 020h ;0x0052bb39 : 83ca20 lea ecx , dword ptr [ ebp + 0ECh ] ;0x0052bb3c : 8d8dec000000 call Fun42ce21 ;0x0052bb42 : e8da12f0ff ; ; ------------------------------------------------------------------------------ ; VFP 9.0 FIX - THE STRTOFILE() FUNCTION USES THE WINDOWS SYSTEM CACHE ; February 2019 ; ------------------------------------------------------------------------------ ; CCB ; ; The STRTOFILE() function uses the Windows system cache. ; ; 2019/2/28, by ccb ; Label52bb46 :: ; mov dword ptr vfpa_strtofile_isstrtofile,00h Label52bb47 :: mov edi , eax ;0x0052bb47 : 8bf8 cmp edi , 0FFFFFFFFh ;0x0052bb49 : 83ffff mov dword ptr [ ebp - 40 ] , edi ;0x0052bb4c : 897dd8 je Label52bb80 ;0x0052bb4f : 742f mov eax , dword ptr [ ebp - 28 ] ;0x0052bb51 : 8b45e4 dec eax ;0x0052bb54 : 48 jne Label50b7ad ;0x0052bb55 : 0f8552fcfdff call Fun433ef7 ;0x0052bb5b : e89783f0ff mov edx , dword ptr [ Data93757c ] ;0x0052bb60 : 8b157c759300 mov ecx , edi ;0x0052bb66 : 8bcf imul ecx , ecx , 038h ;0x0052bb68 : 6bc938 mov dword ptr [ ecx + edx + 4 ] , eax ;0x0052bb6b : 89441104 Label52bb6f :: push dword ptr [ esi + 8 ] ;0x0052bb6f : ff7608 mov eax , dword ptr [ esi + 32 ] ;0x0052bb72 : 8b4620 push dword ptr [eax] ;0x0052bb75 : ff30 push edi ;0x0052bb77 : 57 call Fun431e4d ;0x0052bb78 : e8d062f0ff add dword ptr [ ebp - 32 ] , eax ;0x0052bb7d : 0145e0 Label52bb80 :: lea eax , dword ptr [ ebp - 48 ] ;0x0052bb80 : 8d45d0 push eax ;0x0052bb83 : 50 lea eax , dword ptr [ ebp - 128 ] ;0x0052bb84 : 8d4580 call Fun42d200 ;0x0052bb87 : e87416f0ff cmp edi , 0FFFFFFFFh ;0x0052bb8c : 83ffff je Label52bb98 ;0x0052bb8f : 7407 mov ecx , edi ;0x0052bb91 : 8bcf call Fun42ddf2 ;0x0052bb93 : e85a22f0ff Label52bb98 :: neg ebx ;0x0052bb98 : f7db sbb ebx , ebx ;0x0052bb9a : 1bdb not ebx ;0x0052bb9c : f7d3 and ebx , dword ptr [ ebp - 32 ] ;0x0052bb9e : 235de0 mov dword ptr [ esi + 12 ] , ebx ;0x0052bba1 : 895e0c mov dword ptr [ esi + 4 ] , 0Ah ;0x0052bba4 : c746040a000000 mov byte ptr [esi] , 049h ;0x0052bbab : c60649 Label52bbae :: mov ecx , dword ptr [ ebp + 01F4h ] ;0x0052bbae : 8b8df4010000 call Fun42bf1d ;0x0052bbb4 : e86403f0ff pop edi ;0x0052bbb9 : 5f pop esi ;0x0052bbba : 5e pop ebx ;0x0052bbbb : 5b add ebp , 01F8h ;0x0052bbbc : 81c5f8010000 leave ;0x0052bbc2 : c9 ret ;0x0052bbc3 : c3 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_vfp9fix67.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix65.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix66.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix69.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix70.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix71.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix72.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix73.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix74.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix84.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix85.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix107.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix108.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix109.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix110.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix143.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix144.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix145.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix146.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix147.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix148.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix149.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix150.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix203.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix261.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix262.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix269.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix270.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix278.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix279.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix348.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix349.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix350.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix351.asp 2, microsoft.com: https://devblogs.microsoft.com/oldnewthing/20120907-00/?p=6663 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |