Re: msvcrt: set mode bits in _fstati64

2004-12-05 Thread Juan Lang
--- Dmitry Timoshkov <[EMAIL PROTECTED]> wrote: > 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. Interestingly, you can't _open the root directory of a drive in Windows; it fails

Re: msvcrt: set mode bits in _fstati64

2004-12-05 Thread Dmitry Timoshkov
"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_I

Re: msvcrt: set mode bits in _fstati64

2004-12-04 Thread Juan Lang
--- Dmitry Timoshkov <[EMAIL PROTECTED]> wrote: > Apparently a returned info should be based on whether a file handle > resembles an ordinary disk based file, or pipe, or device, or something > else. But that's a target for a separate patch. Got it. How's this? --Juan _

Re: msvcrt: set mode bits in _fstati64

2004-12-04 Thread Dmitry Timoshkov
"Juan Lang" <[EMAIL PROTECTED]> wrote: > > What you probably need to consider is a type of a file passed in. > > Hm? Not sure what you mean here. Apparently a returned info should be based on whether a file handle resembles an ordinary disk based file, or pipe, or device, or something else. But

Re: msvcrt: set mode bits in _fstati64

2004-12-04 Thread Juan Lang
--- Dmitry Timoshkov <[EMAIL PROTECTED]> wrote: > Why do you take into account (FILE_ATTRIBUTE_HIDDEN | > FILE_ATTRIBUTE_SYSTEM) > at all? They have nothing to do with an ability to read/write files. You're right. I didn't do any tests, it was just my poor memory. > What you probably need to con

Re: msvcrt: set mode bits in _fstati64

2004-12-04 Thread Dmitry Timoshkov
"Juan Lang" <[EMAIL PROTECTED]> wrote: > + buf->st_mode = S_IFREG; > + if (!(hfi.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN | > FILE_ATTRIBUTE_SYSTEM))) > + { > +buf->st_mode |= S_IREAD; > +if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) > + buf->st_mode |= S_IWRITE; > + }