On Wed, Oct 22, 2008 at 10:13 PM, Ivan Peevski cyberhorse@gmail.com wrote:
Followed the documentation at http://msdn.microsoft.com/en-us/library/w7sa2b22(VS.80).aspx. Ignore pmode if the file already exist and emulate permissions as best we can during file creation.
dlls/msvcrt/file.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 7c0f74d..7b2a33e 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -1422,6 +1422,7 @@ int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... ) int pmode; DWORD access = 0, creation = 0, attrib; DWORD sharing;
- struct MSVCRT__stat buf; int wxflag = 0, fd; HANDLE hand; SECURITY_ATTRIBUTES sa;
@@ -1430,6 +1431,8 @@ int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... ) TRACE(":file (%s) oflags: 0x%04x shflags: 0x%04x\n", path, oflags, shflags);
- attrib = FILE_ATTRIBUTE_NORMAL;
- wxflag = split_oflags(oflags); switch (oflags & (MSVCRT__O_RDONLY | MSVCRT__O_WRONLY | MSVCRT__O_RDWR)) {
@@ -1444,10 +1447,11 @@ int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... ) pmode = va_arg(ap, int); va_end(ap);
- if(pmode & ~(MSVCRT__S_IREAD | MSVCRT__S_IWRITE))
FIXME(": pmode 0x%04x ignored\n", pmode);
- else
WARN(": pmode 0x%04x ignored\n", pmode);
/* Ignore _S_IREAD and _S_IWRITE if file exists. */
if (MSVCRT__stat(path, &buf) != 0)
if (pmode & (MSVCRT__S_IREAD & !MSVCRT__S_IWRITE))
attrib |= FILE_ATTRIBUTE_READONLY;
/* Ignore any irrelevant flags. */
if (oflags & MSVCRT__O_EXCL) creation = CREATE_NEW;
@@ -1482,7 +1486,6 @@ int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... ) ERR( "Unhandled shflags 0x%x\n", shflags ); return -1; }
attrib = FILE_ATTRIBUTE_NORMAL;
if (oflags & MSVCRT__O_TEMPORARY) {
-- 1.5.4.3
Can you add a testcase for this to dlls/msvcrt/tests/file.c?