diff options
Diffstat (limited to 'pr/src/md/windows/ntio.c')
-rw-r--r-- | pr/src/md/windows/ntio.c | 388 |
1 files changed, 210 insertions, 178 deletions
diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c index 1b60a380..5326be68 100644 --- a/pr/src/md/windows/ntio.c +++ b/pr/src/md/windows/ntio.c @@ -37,6 +37,7 @@ #include "primpl.h" #include "pprmwait.h" #include <direct.h> +#include <mbstring.h> static HANDLE _pr_completion_port; static PRThread *_pr_io_completion_thread; @@ -60,6 +61,24 @@ extern PRUint32 _nt_idleCount; #define CLOSE_TIMEOUT PR_SecondsToInterval(5) /* + * NSPR-to-NT access right mapping table for files. + */ +static DWORD fileAccessTable[] = { + FILE_GENERIC_READ, + FILE_GENERIC_WRITE, + FILE_GENERIC_EXECUTE +}; + +/* + * NSPR-to-NT access right mapping table for directories. + */ +static DWORD dirAccessTable[] = { + FILE_GENERIC_READ, + FILE_GENERIC_WRITE|FILE_DELETE_CHILD, + FILE_GENERIC_EXECUTE +}; + +/* * The NSPR epoch (00:00:00 1 Jan 1970 UTC) in FILETIME. * We store the value in a PRTime variable for convenience. * This constant is used by _PR_FileTimeToPRTime(). @@ -76,10 +95,6 @@ PRInt32 IsFileLocal(HANDLE hFile); static PRInt32 _md_MakeNonblock(HANDLE); -/* The _nt_use_async flag is used to prevent nspr from using any async io. - * this is a temporary hack. Don't learn to rely on it. - */ -static int _nt_use_async = 1; PRInt32 _nt_nonblock_accept(PRFileDesc *fd, struct sockaddr_in *addr, int *len, PRIntervalTime); PRInt32 _nt_nonblock_recv(PRFileDesc *fd, char *buf, int len, PRIntervalTime); PRInt32 _nt_nonblock_send(PRFileDesc *fd, char *buf, int len, PRIntervalTime); @@ -889,6 +904,8 @@ _PR_MD_INIT_IO() PR_ASSERT(filetime.prt == _pr_filetime_offset); } #endif /* DEBUG */ + + _PR_NT_InitSids(); } /* --- SOCKET IO --------------------------------------------------------- */ @@ -913,11 +930,6 @@ _md_get_recycled_socket() } _MD_UNLOCK(&_pr_recycle_lock); -#ifdef _PR_INET6 - if (_pr_ipv6_enabled) { - af = AF_INET6; - } -#endif rv = _PR_MD_SOCKET(af, SOCK_STREAM, 0); if (rv != INVALID_SOCKET && _md_Associate((HANDLE)rv) == 0) { closesocket(rv); @@ -1127,7 +1139,7 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRThread *cThread; struct connect_data_s cd; - if (!_nt_use_async || fd->secret->nonblocking) { + if (fd->secret->nonblocking) { PRInt32 rv; fd_set wd; struct timeval tv, *tvp; @@ -1294,7 +1306,7 @@ _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, PRUint32 llen, err; int rv; - if (!_nt_use_async || fd->secret->nonblocking || fd->secret->inheritable) { + if (fd->secret->nonblocking || fd->secret->inheritable) { if (!fd->secret->md.io_model_committed) { rv = _md_MakeNonblock((HANDLE)osfd); PR_ASSERT(0 != rv); @@ -1306,7 +1318,7 @@ _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, * the listening socket. */ accept_sock = _nt_nonblock_accept(fd, (struct sockaddr_in *)raddr, rlen, timeout); - if (_nt_use_async && !fd->secret->nonblocking) { + if (!fd->secret->nonblocking) { u_long zero = 0; rv = ioctlsocket(accept_sock, FIONBIO, &zero); @@ -1441,21 +1453,6 @@ _PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, PRBool isConnected; PRBool madeCallback = PR_FALSE; - if (!_nt_use_async) { - PRFileDesc *nd; - bytes = _PR_EmulateAcceptRead(sd, &nd, raddr, buf, amount, timeout); - if (bytes != -1) { - /* - * This part is the same as SocketClose(nd), except - * that we don't close the osfd. - */ - PR_ASSERT(nd->secret->state == _PR_FILEDESC_OPEN); - *newSock = nd->secret->md.osfd; - PR_FreeFileDesc(nd); - } - return bytes; - } - if (me->io_suspended) { PR_SetError(PR_INVALID_STATE_ERROR, 0); return -1; @@ -1620,15 +1617,6 @@ _PR_MD_SENDFILE(PRFileDesc *sock, PRSendFileData *sfd, PRInt32 tflags; int rv, err; - if (!_nt_use_async) { - if (!sock->secret->md.io_model_committed) { - rv = _md_MakeNonblock((HANDLE)sock->secret->md.osfd); - PR_ASSERT(0 != rv); - sock->secret->md.io_model_committed = PR_TRUE; - } - return _PR_EmulateSendFile(sock, sfd, flags, timeout); - } - if (me->io_suspended) { PR_SetError(PR_INVALID_STATE_ERROR, 0); return -1; @@ -1735,7 +1723,7 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, int bytes; int rv, err; - if (!_nt_use_async || fd->secret->nonblocking || fd->secret->inheritable) { + if (fd->secret->nonblocking || fd->secret->inheritable) { if (!fd->secret->md.io_model_committed) { rv = _md_MakeNonblock((HANDLE)osfd); PR_ASSERT(0 != rv); @@ -1834,7 +1822,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, int bytes; int rv, err; - if (!_nt_use_async || fd->secret->nonblocking || fd->secret->inheritable) { + if (fd->secret->nonblocking || fd->secret->inheritable) { if (!fd->secret->md.io_model_committed) { rv = _md_MakeNonblock((HANDLE)osfd); PR_ASSERT(0 != rv); @@ -1932,7 +1920,7 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PR_ASSERT(0 != rv); fd->secret->md.io_model_committed = PR_TRUE; } - if (_nt_use_async && !fd->secret->nonblocking && !fd->secret->inheritable) + if (!fd->secret->nonblocking && !fd->secret->inheritable) return pt_SendTo(osfd, buf, amount, flags, addr, addrlen, timeout); else return _nt_nonblock_sendto(fd, buf, amount, (struct sockaddr *)addr, addrlen, timeout); @@ -1950,7 +1938,7 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PR_ASSERT(0 != rv); fd->secret->md.io_model_committed = PR_TRUE; } - if (_nt_use_async && !fd->secret->nonblocking && !fd->secret->inheritable) + if (!fd->secret->nonblocking && !fd->secret->inheritable) return pt_RecvFrom(osfd, buf, amount, flags, addr, addrlen, timeout); else return _nt_nonblock_recvfrom(fd, buf, amount, (struct sockaddr *)addr, addrlen, timeout); @@ -1965,7 +1953,7 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTi int sent = 0; int rv; - if (!_nt_use_async || fd->secret->nonblocking || fd->secret->inheritable) { + if (fd->secret->nonblocking || fd->secret->inheritable) { if (!fd->secret->md.io_model_committed) { rv = _md_MakeNonblock((HANDLE)osfd); PR_ASSERT(0 != rv); @@ -2115,79 +2103,102 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode) 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 && osflags & PR_EXCL ) - flags = CREATE_NEW; - else 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_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; + if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; - if (osflags & PR_APPEND) { - if ( SetFilePointer(file, 0, 0, FILE_END) == 0xFFFFFFFF ) { - _PR_MD_MAP_LSEEK_ERROR(GetLastError()); - CloseHandle(file); - return -1; - } - } + if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL ) + flags = CREATE_NEW; + else 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; - return (PRInt32)file; + 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; } - 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 && osflags & PR_EXCL ) - flags = CREATE_NEW; - else 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; + + 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; +} + +PRInt32 +_PR_MD_OPEN_FILE(const char *name, PRIntn osflags, PRIntn mode) +{ + HANDLE file; + PRInt32 access = 0; + PRInt32 flags = 0; + PRInt32 flag6 = 0; + SECURITY_ATTRIBUTES sa; + LPSECURITY_ATTRIBUTES lpSA = NULL; + PSECURITY_DESCRIPTOR pSD = NULL; + PACL pACL = NULL; - 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_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; + + 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 && osflags & PR_EXCL ) + flags = CREATE_NEW; + else 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; + + if (osflags & PR_CREATE_FILE) { + if (_PR_NT_MakeSecurityDescriptorACL(mode, fileAccessTable, + &pSD, &pACL) == PR_SUCCESS) { + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = pSD; + sa.bInheritHandle = FALSE; + lpSA = &sa; } + } + file = CreateFile(name, + access, + FILE_SHARE_READ|FILE_SHARE_WRITE, + lpSA, + flags, + flag6, + NULL); + if (lpSA != NULL) { + _PR_NT_FreeSecurityDescriptorACL(pSD, pACL); + } + if (file == INVALID_HANDLE_VALUE) { + _PR_MD_MAP_OPEN_ERROR(GetLastError()); + return -1; + } - return (PRInt32)file; + 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; } PRInt32 @@ -2196,8 +2207,10 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) PRInt32 f = fd->secret->md.osfd; PRUint32 bytes; int rv, err; + LONG hiOffset = 0; + LONG loOffset; - if (_nt_use_async && !fd->secret->md.sync_file_io) { + if (!fd->secret->md.sync_file_io) { PRThread *me = _PR_MD_CURRENT_THREAD(); if (me->io_suspended) { @@ -2207,7 +2220,8 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) memset(&(me->md.overlapped.overlapped), 0, sizeof(OVERLAPPED)); - me->md.overlapped.overlapped.Offset = SetFilePointer((HANDLE)f, 0, 0, FILE_CURRENT); + me->md.overlapped.overlapped.Offset = SetFilePointer((HANDLE)f, 0, &me->md.overlapped.overlapped.OffsetHigh, FILE_CURRENT); + PR_ASSERT((me->md.overlapped.overlapped.Offset != 0xffffffff) || (GetLastError() == NO_ERROR)); if (fd->secret->inheritable) { rv = ReadFile((HANDLE)f, @@ -2216,7 +2230,8 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) &bytes, &me->md.overlapped.overlapped); if (rv != 0) { - SetFilePointer((HANDLE)f, bytes, 0, FILE_CURRENT); + loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); + PR_ASSERT((loOffset != 0xffffffff) || (GetLastError() == NO_ERROR)); return bytes; } err = GetLastError(); @@ -2224,7 +2239,8 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) rv = GetOverlappedResult((HANDLE)f, &me->md.overlapped.overlapped, &bytes, TRUE); if (rv != 0) { - SetFilePointer((HANDLE)f, bytes, 0, FILE_CURRENT); + loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); + PR_ASSERT((loOffset != 0xffffffff) || (GetLastError() == NO_ERROR)); return bytes; } err = GetLastError(); @@ -2342,8 +2358,10 @@ _PR_MD_WRITE(PRFileDesc *fd, void *buf, PRInt32 len) PRInt32 f = fd->secret->md.osfd; PRInt32 bytes; int rv, err; + LONG hiOffset = 0; + LONG loOffset; - if (_nt_use_async && !fd->secret->md.sync_file_io) { + if (!fd->secret->md.sync_file_io) { PRThread *me = _PR_MD_CURRENT_THREAD(); if (me->io_suspended) { @@ -2353,7 +2371,8 @@ _PR_MD_WRITE(PRFileDesc *fd, void *buf, PRInt32 len) memset(&(me->md.overlapped.overlapped), 0, sizeof(OVERLAPPED)); - me->md.overlapped.overlapped.Offset = SetFilePointer((HANDLE)f, 0, 0, FILE_CURRENT); + me->md.overlapped.overlapped.Offset = SetFilePointer((HANDLE)f, 0, &me->md.overlapped.overlapped.OffsetHigh, FILE_CURRENT); + PR_ASSERT((me->md.overlapped.overlapped.Offset != 0xffffffff) || (GetLastError() == NO_ERROR)); if (fd->secret->inheritable) { rv = WriteFile((HANDLE)f, @@ -2362,7 +2381,8 @@ _PR_MD_WRITE(PRFileDesc *fd, void *buf, PRInt32 len) &bytes, &me->md.overlapped.overlapped); if (rv != 0) { - SetFilePointer((HANDLE)f, bytes, 0, FILE_CURRENT); + loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); + PR_ASSERT((loOffset != 0xffffffff) || (GetLastError() == NO_ERROR)); return bytes; } err = GetLastError(); @@ -2370,7 +2390,8 @@ _PR_MD_WRITE(PRFileDesc *fd, void *buf, PRInt32 len) rv = GetOverlappedResult((HANDLE)f, &me->md.overlapped.overlapped, &bytes, TRUE); if (rv != 0) { - SetFilePointer((HANDLE)f, bytes, 0, FILE_CURRENT); + loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); + PR_ASSERT((loOffset != 0xffffffff) || (GetLastError() == NO_ERROR)); return bytes; } err = GetLastError(); @@ -2587,62 +2608,50 @@ PRInt32 _PR_MD_CLOSE(PRInt32 osfd, PRBool socket) { PRInt32 rv; - if (_nt_use_async) { - PRThread *me = _PR_MD_CURRENT_THREAD(); + PRThread *me = _PR_MD_CURRENT_THREAD(); - if (socket) { - rv = closesocket((SOCKET)osfd); - if (rv < 0) - _PR_MD_MAP_CLOSE_ERROR(WSAGetLastError()); - } else { - rv = CloseHandle((HANDLE)osfd)?0:-1; - if (rv < 0) - _PR_MD_MAP_CLOSE_ERROR(GetLastError()); - } + if (socket) { + rv = closesocket((SOCKET)osfd); + if (rv < 0) + _PR_MD_MAP_CLOSE_ERROR(WSAGetLastError()); + } else { + rv = CloseHandle((HANDLE)osfd)?0:-1; + if (rv < 0) + _PR_MD_MAP_CLOSE_ERROR(GetLastError()); + } - if (rv == 0 && me->io_suspended) { - if (me->io_fd == osfd) { - PRBool fWait; + if (rv == 0 && me->io_suspended) { + if (me->io_fd == osfd) { + PRBool fWait; - _PR_THREAD_LOCK(me); - me->state = _PR_IO_WAIT; - /* The IO could have completed on another thread just after - * calling closesocket while the io_suspended flag was true. - * So we now grab the lock to do a safe check on io_pending to - * see if we need to wait or not. - */ - fWait = me->io_pending; - me->io_suspended = PR_FALSE; - me->md.interrupt_disabled = PR_TRUE; - _PR_THREAD_UNLOCK(me); + _PR_THREAD_LOCK(me); + me->state = _PR_IO_WAIT; + /* The IO could have completed on another thread just after + * calling closesocket while the io_suspended flag was true. + * So we now grab the lock to do a safe check on io_pending to + * see if we need to wait or not. + */ + fWait = me->io_pending; + me->io_suspended = PR_FALSE; + me->md.interrupt_disabled = PR_TRUE; + _PR_THREAD_UNLOCK(me); - if (fWait) - _NT_IO_WAIT(me, PR_INTERVAL_NO_TIMEOUT); - PR_ASSERT(me->io_suspended == PR_FALSE); - PR_ASSERT(me->io_pending == PR_FALSE); - /* - * I/O operation is no longer pending; the thread can now - * run on any cpu - */ - _PR_THREAD_LOCK(me); - me->md.interrupt_disabled = PR_FALSE; - me->md.thr_bound_cpu = NULL; - me->io_suspended = PR_FALSE; - me->io_pending = PR_FALSE; - me->state = _PR_RUNNING; - _PR_THREAD_UNLOCK(me); - } + if (fWait) + _NT_IO_WAIT(me, PR_INTERVAL_NO_TIMEOUT); + PR_ASSERT(me->io_suspended == PR_FALSE); + PR_ASSERT(me->io_pending == PR_FALSE); + /* + * I/O operation is no longer pending; the thread can now + * run on any cpu + */ + _PR_THREAD_LOCK(me); + me->md.interrupt_disabled = PR_FALSE; + me->md.thr_bound_cpu = NULL; + me->io_suspended = PR_FALSE; + me->io_pending = PR_FALSE; + me->state = _PR_RUNNING; + _PR_THREAD_UNLOCK(me); } - } else { - if (socket) { - rv = closesocket((SOCKET)osfd); - if (rv == -1) - _PR_MD_MAP_CLOSE_ERROR(WSAGetLastError()); - } else { - rv = CloseHandle((HANDLE)osfd)?0:-1; - if (rv == -1) - _PR_MD_MAP_CLOSE_ERROR(GetLastError()); - } } return rv; } @@ -2661,7 +2670,7 @@ _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable) HANDLE_FLAG_INHERIT, inheritable ? HANDLE_FLAG_INHERIT : 0); if (0 == rv) { - PR_SetError(PR_UNKNOWN_ERROR, GetLastError()); + _PR_MD_MAP_DEFAULT_ERROR(GetLastError()); return PR_FAILURE; } return PR_SUCCESS; @@ -2675,12 +2684,12 @@ _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable) void FlipSlashes(char *cp, int len) { while (--len >= 0) { - if (cp[0] == '/') { - cp[0] = PR_DIRECTORY_SEPARATOR; - } - cp++; + if (cp[0] == '/') { + cp[0] = PR_DIRECTORY_SEPARATOR; + } + cp = _mbsinc(cp); } -} +} /* end FlipSlashes() */ /* ** @@ -2979,7 +2988,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) * FindFirstFile() expands wildcard characters. So * we make sure the pathname contains no wildcard. */ - if (NULL != strpbrk(fn, "?*")) { + if (NULL != _mbspbrk(fn, "?*")) { PR_SetError(PR_FILE_NOT_FOUND_ERROR, 0); return -1; } @@ -3001,7 +3010,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) * If the pathname does not contain ., \, and /, it cannot be * a root directory or a pathname that ends in a slash. */ - if (NULL == strpbrk(fn, ".\\/")) { + if (NULL == _mbspbrk(fn, ".\\/")) { _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); return -1; } @@ -3177,6 +3186,34 @@ _PR_MD_MKDIR(const char *name, PRIntn mode) } PRInt32 +_PR_MD_MAKE_DIR(const char *name, PRIntn mode) +{ + BOOL rv; + SECURITY_ATTRIBUTES sa; + LPSECURITY_ATTRIBUTES lpSA = NULL; + PSECURITY_DESCRIPTOR pSD = NULL; + PACL pACL = NULL; + + if (_PR_NT_MakeSecurityDescriptorACL(mode, dirAccessTable, + &pSD, &pACL) == PR_SUCCESS) { + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = pSD; + sa.bInheritHandle = FALSE; + lpSA = &sa; + } + rv = CreateDirectory(name, lpSA); + if (lpSA != NULL) { + _PR_NT_FreeSecurityDescriptorACL(pSD, pACL); + } + if (rv) { + return 0; + } else { + _PR_MD_MAP_MKDIR_ERROR(GetLastError()); + return -1; + } +} + +PRInt32 _PR_MD_RMDIR(const char *name) { if (RemoveDirectory(name)) { @@ -3668,11 +3705,6 @@ PRInt32 IsFileLocal(HANDLE hFile) } #endif /* _NEED_351_FILE_LOCKING_HACK */ -PR_IMPLEMENT(void) PR_NT_UseNonblock() -{ - _nt_use_async = 0; -} - PR_IMPLEMENT(PRStatus) PR_NT_CancelIo(PRFileDesc *fd) { PRThread *me = _PR_MD_CURRENT_THREAD(); |