<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 2015年06月11日 16:21, Piotr Caban
      wrote:<br>
    </div>
    <blockquote cite="mid:557944EE.7090502@gmail.com" type="cite">The
      _Equivalent tests shows that applications probably shouldn't
      depend on GetLastError value. The function sometimes sets error
      even if it succeeds, sometimes the error depends on arguments
      order. In general while using msvcp/msvcrt functions applications
      are supposed to check errno value that is not set in this case.
      <br>
      <br>
    </blockquote>
    Do you mean that  _Equivalent sets ERROR_SUCCESS when it succeeds?
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <blockquote cite="mid:557944EE.7090502@gmail.com" type="cite">The
      tests shows that Microsoft is probably using different functions
      internally. E.g. this code looks suspicious:
      <br>
      +ULONGLONG __cdecl tr2_sys__File_size(const char* path)
      <br>
      +{
      <br>
      +    WIN32_FILE_ATTRIBUTE_DATA fad;
      <br>
      +
      <br>
      +    TRACE("(%p)\n", path);
      <br>
      +    if(!path) {
      <br>
      +        SetLastError(ERROR_INVALID_PARAMETER);
      <br>
      +        return 0;
      <br>
      +    }
      <br>
      I don't think msvcp should set the error explicitly. It's why I
      think it's better to just skip GetLastError tests and revisit it
      if we find any application that depends on GetLastError value. I
      don't think we will find any.
      <br>
      <br>
    </blockquote>
    I had made two implementation before, another one is like this:<br>
    <small>    HANDLE h1;<br>
          h1 = CreateFileA(path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ
      | FILE_SHARE_WRITE,<br>
                  NULL, OPEN_EXISTING, 0, 0);<br>
          if(h1 == INVALID_HANDLE_VALUE)<br>
              return 0;<br>
          DWORD size;<br>
          LPDWORD high;<br>
          size = GetFileSize( h1, &high );<br>
          TRACE("(%p)\n", path);<br>
          return ((ULONGLONG)(high) << 32) + size;<br>
    </small><br>
    (As I had showed it here, could you please also tell me which
    implementation is better and why?)<br>
    <br>
    This one also needs to set the error explicitly, which I didn't do
    it.<br>
    Do you think that we should ignore GetLastError in these series of
    patches?<br>
    Ps: My tests[1] show that _Copy_file and _Rename return
    GetLastError, but they doesn't matter at all.<br>
    <br>
    Thank you.<br>
    <br>
    [1]:
<a class="moz-txt-link-freetext" href="https://github.com/YongHaoWu/wine-hub/commit/8a5af834d63914e7eaed75553399001458964e74#diff-bb7627a0293c2f936059d8808567b2f3R14344">https://github.com/YongHaoWu/wine-hub/commit/8a5af834d63914e7eaed75553399001458964e74#diff-bb7627a0293c2f936059d8808567b2f3R14344</a><br>
  </body>
</html>