<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mike Duigou wrote:
<blockquote cite="mid:64CF203E-7B57-4216-BA53-CEB97D30E59C@oracle.com"
 type="cite">
  <pre wrap="">Would it be possible to call GetFileSizeEx() (or add a call to GetLastError())

MSDN:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Note that if the return value is INVALID_FILE_SIZE (0xffffffff), an application must call GetLastError to determine whether the function has succeeded or failed. The reason the function may appear to fail when it has not is that lpFileSizeHigh could be non-NULL or the file size could be 0xffffffff. In this case, GetLastError will return NO_ERROR (0) upon success. Because of this behavior, it is recommended that you use GetFileSizeEx instead.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
There is a similar problem for for SetFilePosition():

MSDN:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Note  Because INVALID_SET_FILE_POINTER is a valid value for the low-order DWORD of the new file pointer, you must check both the return value of the function and the error code returned by GetLastError to determine whether or not an error has occurred. If an error has occurred, the return value of SetFilePointer is INVALID_SET_FILE_POINTER and GetLastError returns a value other than NO_ERROR. For a code example that demonstrates how to check for failure, see the Remarks section in this topic.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Mike
  </pre>
</blockquote>
I agree with Mike's suggestion to use GetFileSizeEx. Also, well spotted
that the SetFilePointer usage is missing a check to GetLastError. I
quickly checked the other usages of this clunky API and they seem to
check the error.<br>
<br>
Do you plan to include a regression test for this? I know it's not nice
for tests to be create multi-GB files but this is one that we should
have caught a long time ago. If we create it as a sparse file then the
test should be relatively quick.<br>
<br>
-Alan.<br>
</body>
</html>