coinhelper / dokan

Automatically exported from code.google.com/p/dokan
0 stars 0 forks source link

SetFilePos is failing after reading end_of_file #179

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open small file on dokan mounted volume using CreateFile(...)
2. Call ReadFile with buffer big enough to read entire file at once
3. Call ReadFile again, it returns 0 in lpNumberOfBytesRead
4. Now call SetFilePointer(handle, -2, FILE_CURRENT)

That will fail with error saying that file pointer cannot be moved before 
beginning of file

What is the expected output? What do you see instead?
SetFilePointer should return fileSize - 2

What version of the product are you using? On what operating system?
Any OS

Please provide any additional information below.
Problem is in read.c file in dokan folder, line 70. If readLength == 0, 
eventInfo->Read.CurrentByteOffset.QuadPart is not set so it will be 0 which 
means that file pointer is moved to the beginning of the file which is not 
correct. It should stay at the end of the file. Problem can be easily fixed by 
moving that line outside of the "else" block so it's always executed.

Original issue reported on code.google.com by sslav...@gmail.com on 24 Aug 2010 at 6:30

GoogleCodeExporter commented 9 years ago
Seems working correctly with the latest version in trunk.

Original comment by asa...@gmail.com on 8 Jan 2011 at 6:15