"Juan Lang" <[EMAIL PROTECTED]> wrote: > Got it. How's this?
> + dw = GetFileType(hand); > + buf->st_mode = S_IREAD; > + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) > + buf->st_mode |= S_IWRITE; > + if (hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) > + buf->st_mode |= S_IFDIR; > + else if (dw == FILE_TYPE_CHAR) > + buf->st_mode |= S_IFCHR; > + else > + buf->st_mode |= S_IFREG; > + TRACE(":dwFileAttributes = 0x%lx, mode set to 0x%x\n",hfi.dwFileAttributes, > + buf->st_mode); Looks better, except that according to MSDN "_S_IFREG bit is set if path specifies an ordinary file or a device", so you need to add a check for FILE_TYPE_DISK. And FILE_TYPE_PIPE perhaps should have _S_IFIFO set. Not sure if it's worth to write a test case for it. -- Dmitry.