As mentioned in http://support.micro....com/?id=318293 Windows 98SE shell fails at trying to copy files over 2Gb. According to M$...
Quote
Unfortunately, M$ is only partially right. I've inspected and traced through the copying code in shell32.dll, and the actual problem seems to lie within the kernel itself, at the _llseek API.
7FCEB349 mov [ebp+nNumberOfBytesToWrite], eax 7FCEB34C mov eax, [edi+20h] 7FCEB34F cmp eax, 30000h; over 192Kb in size? 7FCEB354 jbe short 7FCEB386; no pre-enlargement if not 7FCEB356 push ebx; iOrigin 7FCEB357 mov ebx, ds:_llseek 7FCEB35D push eax; lOffset 7FCEB35E push [ebp+hDestFile]; hFile 7FCEB361 call ebx; _llseek apparently has problems seeking over 2Gb 7FCEB363 cmp eax, 0FFFFFFFFh 7FCEB366 jz loc_0_7FCEB55D; fails here 7FCEB36C push [ebp+hDestFile]; hFile 7FCEB36F call ds:SetEndOfFile 7FCEB375 test eax, eax 7FCEB377 jz loc_0_7FCEB55D 7FCEB37D push 0; iOrigin 7FCEB37F push 0; lOffset 7FCEB381 push [ebp+hDestFile]; hFile 7FCEB384 call ebx; _llseekFor those that don't understand the above code, what it does is attempt to enlarge the destination file to the correct size by seeking to the source filesize and then setting the file's end there. Unfortunately, if the file is >2Gb, _llseek fails with "invalid parameter" error. Also note that unless the file is over 192Kb in size, no attempt to pre-enlarge is made - the file just enlarges automatically as data is written to it.
Either the bug is with the _llseek function in the kernel and the code in shell32 is fine, or _llseek was designed to do that (i.e. interprets >2Gb as moving the file pointer backwards, but the pointer is already at the start of the file so it complains) and shell32 is flawed. I can see several possible fixes:
1. Patch shell32.dll to use newer SetFilePointer function which uses 64-bit signed integers - difficult, but possibly the most "correct" solution.
2. Patch kernel32.dll _llseek to interpret seeking from the beginning with a negative offset as a positive offset - moderate, might break some other apps, but what program would want to move the file pointer past the start of the file?
3. Change conditional jump at 7FCEB354 to a permanent jump - easiest, but no more pre-enlargement - is pre-enlargement really needed?
-------------------------------------------------------------------------------------------------
Update:
Fixed kernels:
4.10.1998
4.10.2001
4.10.2222
4.10.2225
4.90.3000
(kernels are too big to attach)
Verification Tool:
Attached File(s)
-
MAKE2GB.ZIP (1.45K)
Number of downloads: 7
This post has been edited by dencorso: 08 December 2010 - 08:22 PM
Reason for edit: Made the MAKE2GB test app available again!



Help


Back to top











