[PATCH 1/4] msvcp110: Add tr2_sys__File_size implementation and test.(try 3)

Piotr Caban piotr.caban at gmail.com
Thu Jun 11 04:51:38 CDT 2015


On 06/11/15 11:31, YongHao Hu wrote:
> Do you mean that  _Equivalent sets ERROR_SUCCESS when it succeeds?
No. I mean that native doesn't really care about error returned by 
GetLastError. It looks like it's just a side effect of the way how it's 
implemented. Probably there's no need to be compatible here.

> I had made two implementation before, another one is like this:
>      HANDLE h1;
>      h1 = CreateFileA(path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ |
> FILE_SHARE_WRITE,
>              NULL, OPEN_EXISTING, 0, 0);
>      if(h1 == INVALID_HANDLE_VALUE)
>          return 0;
>      DWORD size;
>      LPDWORD high;
>      size = GetFileSize( h1, &high );
>      TRACE("(%p)\n", path);
>      return ((ULONGLONG)(high) << 32) + size;
>
> (As I had showed it here, could you please also tell me which
> implementation is better and why?)
Both implementations are good.

> This one also needs to set the error explicitly, which I didn't do it.
> Do you think that we should ignore GetLastError in these series of patches?
I don't know, probably yes. The code is nicer when the error is not set 
explicitly with SetLastError call. The functions from kernel32 will set 
the error anyway. It just will not match error set by native msvcp120.

Thanks,
Piotr



More information about the wine-devel mailing list