Re: [PATCH 5/6]: msvcp110: Add tr2_sys__Lstat implementation and test.(resend)
On 07/03/15 06:00, YongHaoHu wrote:
+/* ?_Lstat(a)sys@tr2(a)std@@YA?AW4file_type(a)123@PBDAAH(a)Z */ +/* ?_Lstat(a)sys@tr2(a)std@@YA?AW4file_type(a)123@PEBDAEAH(a)Z */ +file_type tr2_sys__Lstat(char const* path, int *err_code) +{ + DWORD attr; + TRACE("(%s %p)\n", debugstr_a(path), err_code); + if(!path) { + *err_code = ERROR_INVALID_PARAMETER; + return status_unknown; + } + + attr = GetFileAttributesA(path); + if(attr == INVALID_FILE_ATTRIBUTES) + return stat_set_error(err_code); + if(attr & FILE_ATTRIBUTE_REPARSE_POINT) + FIXME("reparse point is not supported yet\n"); + + *err_code = ERROR_SUCCESS; + return (attr & FILE_ATTRIBUTE_DIRECTORY)?directory_file:regular_file; +} What's the reason for not calling tr2_sys__Stat function here?
Thanks, Piotr
Hi. On 15/7/3 下午6:51, Piotr Caban wrote:
On 07/03/15 06:00, YongHaoHu wrote:
+/* ?_Lstat(a)sys@tr2(a)std@@YA?AW4file_type(a)123@PBDAAH(a)Z */ +/* ?_Lstat(a)sys@tr2(a)std@@YA?AW4file_type(a)123@PEBDAEAH(a)Z */ +file_type tr2_sys__Lstat(char const* path, int *err_code) +{ + DWORD attr; + TRACE("(%s %p)\n", debugstr_a(path), err_code); + if(!path) { + *err_code = ERROR_INVALID_PARAMETER; + return status_unknown; + } + + attr = GetFileAttributesA(path); + if(attr == INVALID_FILE_ATTRIBUTES) + return stat_set_error(err_code); + if(attr & FILE_ATTRIBUTE_REPARSE_POINT) + FIXME("reparse point is not supported yet\n"); + + *err_code = ERROR_SUCCESS; + return (attr & FILE_ATTRIBUTE_DIRECTORY)?directory_file:regular_file; +} What's the reason for not calling tr2_sys__Stat function here?
The handling of REPARSE_POINT in tr2_sys__Stat is different from tr2_sys__Lstat, so we need to implement it again. That's why I want to reuse my function stat_set_error. Regarding ERROR_SUCCESS, I handle it wrong. Thank you. ;)
On 07/03/15 17:29, YongHao Hu wrote:
What's the reason for not calling tr2_sys__Stat function here?
The handling of REPARSE_POINT in tr2_sys__Stat is different from tr2_sys__Lstat, so we need to implement it again. That's why I want to reuse my function stat_set_error. Could you please describe the difference?
According to my testing reparse points have FILE_ATTRIBUTE_DIRECTORY attribute if it's a directory. I don't see where _Lstat behaves differently than _Stat and why reparse points needs any special handling?
On 15/7/3 下午11:50, Piotr Caban wrote:
On 07/03/15 17:29, YongHao Hu wrote:
What's the reason for not calling tr2_sys__Stat function here?
The handling of REPARSE_POINT in tr2_sys__Stat is different from tr2_sys__Lstat, so we need to implement it again. That's why I want to reuse my function stat_set_error. Could you please describe the difference? Sry, it seems that I made a mistake. I will add more tests in the patch. Thank you. ^^
participants (2)
-
Piotr Caban -
YongHao Hu