From 4120647ae7f29f98f24c04dc9d6445f1541b57e7 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 6 Dec 2004 16:14:09 +0000 Subject: [PATCH] Set st_mode bits in _fstati64. --- dlls/msvcrt/file.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index aa8ce1b0ba6..72f31b0cd10 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -994,7 +994,19 @@ int MSVCRT__fstati64(int fd, struct MSVCRT__stati64* buf) msvcrt_set_errno(ERROR_INVALID_PARAMETER); return -1; } - FIXME(":dwFileAttributes = %ld, mode set to 0\n",hfi.dwFileAttributes); + dw = GetFileType(hand); + buf->st_mode = S_IREAD; + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + buf->st_mode |= S_IWRITE; + /* interestingly, Windows never seems to set S_IFDIR */ + if (dw == FILE_TYPE_CHAR) + buf->st_mode |= S_IFCHR; + else if (dw == FILE_TYPE_PIPE) + buf->st_mode |= S_IFIFO; + else + buf->st_mode |= S_IFREG; + TRACE(":dwFileAttributes = 0x%lx, mode set to 0x%x\n",hfi.dwFileAttributes, + buf->st_mode); buf->st_nlink = hfi.nNumberOfLinks; buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); -- 2.11.4.GIT