--------------------------------------------------------------------------------------------- [ENHANCED] VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE GETENV() FUNCTION January 2024 --------------------------------------------------------------------------------------------- CCB 1. BUG: In vfp9 (and vfp6, vfp7, vfp8), the maximum number of characters for the GETENV() function is 255, now the maximum number of characters for the GETENV() function is 8191. 2. CAUSE: There are some BUGs in the following code. 3. RESOLUTION: We can write some code to fix the BUG. Label45e0cc :: push ebp ;0x0045e0cc : 55 mov ebp , esp ;0x0045e0cd : 8bec and esp , 0FFFFFFF8h ;0x0045e0cf : 83e4f8 ; ; ---------------------------------------------------------------------------------- ; VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE GETENV() FUNCTION ; November 2019 ; ---------------------------------------------------------------------------------- ; CCB ; ; In vfp9, the maximum number of characters for the GETENV() function is 255, ; now the maximum number of characters for the GETENV() function is 8191. ; ; 2019/11/20, by ccb ; ; sub esp , 020Ch ;0x0045e0d2 : 81ec0c020000 mov eax , 0220Ch ;0x0045e0d2 : 81ec0c020000 call Fun42c118 mov eax , dword ptr [ Data937090 ] ;0x0045e0d8 : a190709300 push ebx ;0x0045e0dd : 53 push esi ;0x0045e0de : 56 push edi ;0x0045e0df : 57 ; ; ---------------------------------------------------------------------------------- ; VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE GETENV() FUNCTION ; November 2019 ; ---------------------------------------------------------------------------------- ; CCB ; ; In vfp9, the maximum number of characters for the GETENV() function is 255, ; now the maximum number of characters for the GETENV() function is 8191. ; ; 2019/11/20, by ccb ; ; mov dword ptr [ esp + 0214h ] , eax ;0x0045e0e0 : 89842414020000 mov dword ptr [ esp + 0214h ][02000h] , eax ;0x0045e0e0 : 89842414020000 call Fun420d8c ;0x0045e0e7 : e8a02cfcff mov esi , eax ;0x0045e0ec : 8bf0 mov dword ptr [ esp + 12 ] , esi ;0x0045e0ee : 8974240c call Fun42371d ;0x0045e0f2 : e82656fcff mov ecx , dword ptr [ esi + 8 ] ;0x0045e0f7 : 8b4e08 mov eax , 0FFh ;0x0045e0fa : b8ff000000 cmp ecx , eax ;0x0045e0ff : 3bc8 ja Label45e105 ;0x0045e101 : 7702 mov eax , ecx ;0x0045e103 : 8bc1 Label45e105 :: mov edx , dword ptr [ esi + 32 ] ;0x0045e105 : 8b5620 mov esi , dword ptr [edx] ;0x0045e108 : 8b32 mov ecx , eax ;0x0045e10a : 8bc8 mov edx , ecx ;0x0045e10c : 8bd1 shr ecx , 02h ;0x0045e10e : c1e902 lea edi , dword ptr [ esp + 16 ] ;0x0045e111 : 8d7c2410 rep movsd ;0x0045e115 : f3a5 mov ecx , edx ;0x0045e117 : 8bca and ecx , 03h ;0x0045e119 : 83e103 rep movsb ;0x0045e11c : f3a4 lea esi , dword ptr [ esp + 16 ] ;0x0045e11e : 8d742410 mov ecx , esi ;0x0045e122 : 8bce mov byte ptr [ esp + eax + 16 ] , 00h ;0x0045e124 : c644041000 call Fun414a67 ;0x0045e129 : e83969fbff ; ; ---------------------------------------------------------------------------------- ; VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE GETENV() FUNCTION ; November 2019 ; ---------------------------------------------------------------------------------- ; CCB ; ; In vfp9, the maximum number of characters for the GETENV() function is 255, ; now the maximum number of characters for the GETENV() function is 8191. ; ; 2019/11/20, by ccb ; ; pushd 0100h ;0x0045e12e : 6800010000 pushd 02000h ;0x0045e12e : 6800010000 mov eax , esi ;0x0045e133 : 8bc6 push eax ;0x0045e135 : 50 lea ebx , dword ptr [ esp + 0118h ] ;0x0045e136 : 8d9c2418010000 call Fun41513d ;0x0045e13d : e8fb6ffbff mov eax , dword ptr [ esp + 12 ] ;0x0045e142 : 8b44240c mov ecx , ebx ;0x0045e146 : 8bcb push ecx ;0x0045e148 : 51 call Fun53c75b ;0x0045e149 : e80de60d00 ; ; ---------------------------------------------------------------------------------- ; VFP 9.0 FIX - THE MAXIMUM NUMBER OF CHARACTERS FOR THE GETENV() FUNCTION ; November 2019 ; ---------------------------------------------------------------------------------- ; CCB ; ; In vfp9, the maximum number of characters for the GETENV() function is 255, ; now the maximum number of characters for the GETENV() function is 8191. ; ; 2019/11/20, by ccb ; ; mov ecx , dword ptr [ esp + 0214h ] ;0x0045e14e : 8b8c2414020000 mov ecx , dword ptr [ esp + 0214h ][02000h] ;0x0045e14e : 8b8c2414020000 call Fun42bf1d ;0x0045e155 : e8c3ddfcff pop edi ;0x0045e15a : 5f pop esi ;0x0045e15b : 5e pop ebx ;0x0045e15c : 5b mov esp , ebp ;0x0045e15d : 8be5 pop ebp ;0x0045e15f : 5d ret ;0x0045e160 : 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_vfp9fix102.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix103.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix287.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix354.asp http://www.baiyujia.com/vfpdocuments/f_vfp9fix355.asp 2, microsoft.com: https://blogs.msdn.microsoft.com/calvin_hsia/2005/12/09/getenv-environment-variable-question/ 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |