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