Fixed dealing with errors getting the file size from Windows

Using SetFilePointer() for compatibility with old Windows implies
a specific management of errors....
edge.strict_endians
Jean-Pierre André 2013-08-06 11:39:13 +02:00
parent ebf35000c9
commit a28e2a8606
1 changed files with 3 additions and 1 deletions

View File

@ -592,9 +592,11 @@ static s64 ntfs_device_win32_getsize(HANDLE handle)
{
LONG loword, hiword;
SetLastError(NO_ERROR);
hiword = 0;
loword = SetFilePointer(handle, 0, &hiword, 2);
if (loword == INVALID_FILE_SIZE) {
if ((loword == INVALID_SET_FILE_POINTER)
&& (GetLastError() != NO_ERROR)) {
errno = ntfs_w32error_to_errno(GetLastError());
ntfs_log_trace("Couldn't get file size.\n");
return -1;