if (osflags & PR_CREATE_FILE) {
if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL ) flags = CREATE_NEW; else if (osflags & PR_CREATE_FILE) {
_PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode){    HANDLE file;    PRInt32 access = 0;    PRInt32 flags = 0;    PRInt32 flag6 = 0;        if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH;     if (_nt_use_async)    {        if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ;        if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE;        if (osflags & PR_CREATE_FILE)            flags = (0 != (osflags & PR_TRUNCATE)) ? CREATE_ALWAYS : OPEN_ALWAYS;        else if (osflags & PR_TRUNCATE) flags = TRUNCATE_EXISTING;        else flags = OPEN_EXISTING;                flag6 |= FILE_FLAG_OVERLAPPED;        file = CreateFile(name,                           access,                           FILE_SHARE_READ|FILE_SHARE_WRITE,                          NULL,                          flags,                           flag6,                          NULL);        if (file == INVALID_HANDLE_VALUE) {            _PR_MD_MAP_OPEN_ERROR(GetLastError());            return -1;        }        if (osflags & PR_APPEND) {            if ( SetFilePointer(file, 0, 0, FILE_END) == 0xFFFFFFFF ) {                _PR_MD_MAP_LSEEK_ERROR(GetLastError());                CloseHandle(file);                return -1;            }        }        return (PRInt32)file;    }    else    {           if (osflags & PR_RDONLY || osflags & PR_RDWR)            access |= GENERIC_READ;        if (osflags & PR_WRONLY || osflags & PR_RDWR)            access |= GENERIC_WRITE;        if (osflags & PR_CREATE_FILE) {            if (osflags & PR_TRUNCATE)                flags = CREATE_ALWAYS;            else                flags = OPEN_ALWAYS;        } else {            if (osflags & PR_TRUNCATE)                flags = TRUNCATE_EXISTING;            else                flags = OPEN_EXISTING;        }        file = CreateFile(name,                          access,                          FILE_SHARE_READ|FILE_SHARE_WRITE,                          NULL,                          flags,                          flag6,                          NULL);        if (file == INVALID_HANDLE_VALUE) {            _PR_MD_MAP_OPEN_ERROR(GetLastError());            return -1;         }        return (PRInt32)file;    }}