14bff34e3Sthurlow /* 24bff34e3Sthurlow * Copyright (c) 2000-2001 Boris Popov 34bff34e3Sthurlow * All rights reserved. 44bff34e3Sthurlow * 54bff34e3Sthurlow * Redistribution and use in source and binary forms, with or without 64bff34e3Sthurlow * modification, are permitted provided that the following conditions 74bff34e3Sthurlow * are met: 84bff34e3Sthurlow * 1. Redistributions of source code must retain the above copyright 94bff34e3Sthurlow * notice, this list of conditions and the following disclaimer. 104bff34e3Sthurlow * 2. Redistributions in binary form must reproduce the above copyright 114bff34e3Sthurlow * notice, this list of conditions and the following disclaimer in the 124bff34e3Sthurlow * documentation and/or other materials provided with the distribution. 134bff34e3Sthurlow * 3. All advertising materials mentioning features or use of this software 144bff34e3Sthurlow * must display the following acknowledgement: 154bff34e3Sthurlow * This product includes software developed by Boris Popov. 164bff34e3Sthurlow * 4. Neither the name of the author nor the names of any co-contributors 174bff34e3Sthurlow * may be used to endorse or promote products derived from this software 184bff34e3Sthurlow * without specific prior written permission. 194bff34e3Sthurlow * 204bff34e3Sthurlow * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 214bff34e3Sthurlow * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224bff34e3Sthurlow * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234bff34e3Sthurlow * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 244bff34e3Sthurlow * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254bff34e3Sthurlow * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264bff34e3Sthurlow * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274bff34e3Sthurlow * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284bff34e3Sthurlow * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294bff34e3Sthurlow * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304bff34e3Sthurlow * SUCH DAMAGE. 314bff34e3Sthurlow * 324bff34e3Sthurlow * $Id: smb_subr.c,v 1.27.108.1 2005/06/02 00:55:39 lindak Exp $ 334bff34e3Sthurlow */ 344bff34e3Sthurlow 354bff34e3Sthurlow #pragma ident "%Z%%M% %I% %E% SMI" 364bff34e3Sthurlow 374bff34e3Sthurlow #include <sys/param.h> 384bff34e3Sthurlow #include <sys/systm.h> 394bff34e3Sthurlow #include <sys/kmem.h> 404bff34e3Sthurlow #include <sys/proc.h> 414bff34e3Sthurlow #include <sys/lock.h> 424bff34e3Sthurlow #include <sys/socket.h> 434bff34e3Sthurlow #include <sys/isa_defs.h> 444bff34e3Sthurlow #include <sys/stream.h> 454bff34e3Sthurlow #include <sys/strsun.h> 464bff34e3Sthurlow #include <sys/sunddi.h> 474bff34e3Sthurlow #include <sys/cmn_err.h> 484bff34e3Sthurlow #include <sys/sdt.h> 494bff34e3Sthurlow #include <sys/priv.h> 504bff34e3Sthurlow #include <sys/u8_textprep.h> 514bff34e3Sthurlow 524bff34e3Sthurlow #include <netsmb/smb_osdep.h> 534bff34e3Sthurlow #include <netsmb/smb.h> 544bff34e3Sthurlow #include <netsmb/smb_conn.h> 554bff34e3Sthurlow #include <netsmb/smb_rq.h> 564bff34e3Sthurlow #include <netsmb/smb_subr.h> 574bff34e3Sthurlow 584bff34e3Sthurlow /* 594bff34e3Sthurlow * XXX:This conversion might not be fully MS-Compatible 604bff34e3Sthurlow * for calculating hashes. The output length may differ 614bff34e3Sthurlow * for some locales and needs to be handled from where 624bff34e3Sthurlow * the call is made. 634bff34e3Sthurlow */ 644bff34e3Sthurlow int 654bff34e3Sthurlow smb_toupper(const char *inbuf, char *outbuf, size_t outlen) 664bff34e3Sthurlow { 674bff34e3Sthurlow int err = 0; 684bff34e3Sthurlow size_t inlen, inrem, outrem; 694bff34e3Sthurlow 704bff34e3Sthurlow inrem = inlen = strlen(inbuf); 714bff34e3Sthurlow outrem = outlen; 724bff34e3Sthurlow (void) u8_textprep_str((char *)inbuf, &inrem, outbuf, &outrem, 734bff34e3Sthurlow U8_TEXTPREP_TOUPPER, U8_UNICODE_LATEST, &err); 744bff34e3Sthurlow /* inrem, outrem are bytes unused, remaining */ 754bff34e3Sthurlow if (inrem) { 764bff34e3Sthurlow SMBSDEBUG("input %d remains: %s\n", (int)inrem, inbuf); 774bff34e3Sthurlow inlen -= inrem; 784bff34e3Sthurlow } 794bff34e3Sthurlow if (outrem) { 804bff34e3Sthurlow outlen -= outrem; 814bff34e3Sthurlow outbuf[outlen] = '\0'; 824bff34e3Sthurlow } 834bff34e3Sthurlow if (outlen > inlen) { 844bff34e3Sthurlow SMBSDEBUG("outlen > inlen! (%d > %d)\n", 854bff34e3Sthurlow (int)outlen, (int)inlen); 864bff34e3Sthurlow /* Truncate to inlen here? */ 874bff34e3Sthurlow } 884bff34e3Sthurlow 894bff34e3Sthurlow return (err); 904bff34e3Sthurlow } 914bff34e3Sthurlow 924bff34e3Sthurlow void 934bff34e3Sthurlow smb_credinit(struct smb_cred *scred, struct proc *p, cred_t *icr) 944bff34e3Sthurlow { 954bff34e3Sthurlow scred->vc_pid = p->p_pidp->pid_id; 964bff34e3Sthurlow if (!icr) 974bff34e3Sthurlow icr = p->p_cred; 984bff34e3Sthurlow if (is_system_labeled()) { 994bff34e3Sthurlow icr = crdup(icr); 1004bff34e3Sthurlow (void) setpflags(NET_MAC_AWARE, 1, icr); 1014bff34e3Sthurlow } else { 1024bff34e3Sthurlow crhold(icr); 1034bff34e3Sthurlow } 1044bff34e3Sthurlow scred->vc_ucred = icr; 1054bff34e3Sthurlow } 1064bff34e3Sthurlow 1074bff34e3Sthurlow void 1084bff34e3Sthurlow smb_credrele(struct smb_cred *scred) 1094bff34e3Sthurlow { 1104bff34e3Sthurlow crfree(scred->vc_ucred); 1114bff34e3Sthurlow scred->vc_ucred = NULL; 1124bff34e3Sthurlow } 1134bff34e3Sthurlow 1144bff34e3Sthurlow #ifdef APPLE 1154bff34e3Sthurlow /*ARGSUSED*/ 1164bff34e3Sthurlow int 1174bff34e3Sthurlow smb_sigintr(vfs_context_t vfsctx) 1184bff34e3Sthurlow { 1194bff34e3Sthurlow /* 1204bff34e3Sthurlow * I cannot find something to match vfs_context_issignal. 1214bff34e3Sthurlow * It calls proc_pendingsignals() in Darwin code. 1224bff34e3Sthurlow */ 1234bff34e3Sthurlow if (vfsctx && vfs_context_issignal(vfsctx, SMB_SIGMASK)) 1244bff34e3Sthurlow return (EINTR); 1254bff34e3Sthurlow return (0); 1264bff34e3Sthurlow } 1274bff34e3Sthurlow #endif 1284bff34e3Sthurlow 1294bff34e3Sthurlow char * 1304bff34e3Sthurlow smb_strdup(const char *s) 1314bff34e3Sthurlow { 1324bff34e3Sthurlow char *p; 1334bff34e3Sthurlow int len; 1344bff34e3Sthurlow 1354bff34e3Sthurlow len = s ? strlen(s) + 1 : 1; 1364bff34e3Sthurlow p = kmem_alloc(len, KM_SLEEP); 1374bff34e3Sthurlow if (s) 1384bff34e3Sthurlow bcopy(s, p, len); 1394bff34e3Sthurlow else 1404bff34e3Sthurlow *p = 0; 1414bff34e3Sthurlow return (p); 1424bff34e3Sthurlow } 1434bff34e3Sthurlow 1444bff34e3Sthurlow /* 1454bff34e3Sthurlow * duplicate string from a user space. 1464bff34e3Sthurlow */ 1474bff34e3Sthurlow char * 1484bff34e3Sthurlow smb_strdupin(char *s, int maxlen) 1494bff34e3Sthurlow { 1504bff34e3Sthurlow char *p, bt; 1514bff34e3Sthurlow int len = 0; 1524bff34e3Sthurlow 1534bff34e3Sthurlow for (p = s; ; p++) { 1544bff34e3Sthurlow if (copyin(p, &bt, 1)) 1554bff34e3Sthurlow return (NULL); 1564bff34e3Sthurlow len++; 1574bff34e3Sthurlow if (maxlen && len > maxlen) 1584bff34e3Sthurlow return (NULL); 1594bff34e3Sthurlow if (bt == 0) 1604bff34e3Sthurlow break; 1614bff34e3Sthurlow } 1624bff34e3Sthurlow p = kmem_alloc(len, KM_SLEEP); 1634bff34e3Sthurlow copyin(s, p, len); 1644bff34e3Sthurlow return (p); 1654bff34e3Sthurlow } 1664bff34e3Sthurlow 1674bff34e3Sthurlow /* 1684bff34e3Sthurlow * duplicate memory block from a user space. 1694bff34e3Sthurlow */ 1704bff34e3Sthurlow void * 1714bff34e3Sthurlow smb_memdupin(void *umem, int len) 1724bff34e3Sthurlow { 1734bff34e3Sthurlow char *p; 1744bff34e3Sthurlow 1754bff34e3Sthurlow if (len > 32 * 1024) 1764bff34e3Sthurlow return (NULL); 1774bff34e3Sthurlow p = kmem_alloc(len, KM_SLEEP); 1784bff34e3Sthurlow if (copyin(umem, p, len) == 0) 1794bff34e3Sthurlow return (p); 1804bff34e3Sthurlow kmem_free(p, len); 1814bff34e3Sthurlow return (NULL); 1824bff34e3Sthurlow } 1834bff34e3Sthurlow 1844bff34e3Sthurlow /* 1854bff34e3Sthurlow * duplicate memory block in the kernel space. 1864bff34e3Sthurlow */ 1874bff34e3Sthurlow void * 1884bff34e3Sthurlow smb_memdup(const void *umem, int len) 1894bff34e3Sthurlow { 1904bff34e3Sthurlow char *p; 1914bff34e3Sthurlow 1924bff34e3Sthurlow if (len > 32 * 1024) 1934bff34e3Sthurlow return (NULL); 1944bff34e3Sthurlow p = kmem_alloc(len, KM_SLEEP); 1954bff34e3Sthurlow if (p == NULL) 1964bff34e3Sthurlow return (NULL); 1974bff34e3Sthurlow bcopy(umem, p, len); 1984bff34e3Sthurlow return (p); 1994bff34e3Sthurlow } 2004bff34e3Sthurlow 2014bff34e3Sthurlow void 2024bff34e3Sthurlow smb_strfree(char *s) 2034bff34e3Sthurlow { 2044bff34e3Sthurlow kmem_free(s, strlen(s) + 1); 2054bff34e3Sthurlow } 2064bff34e3Sthurlow 2074bff34e3Sthurlow void 2084bff34e3Sthurlow smb_memfree(void *s) 2094bff34e3Sthurlow { 2104bff34e3Sthurlow kmem_free(s, strlen(s)); 2114bff34e3Sthurlow } 2124bff34e3Sthurlow 2134bff34e3Sthurlow void * 2144bff34e3Sthurlow smb_zmalloc(unsigned long size) 2154bff34e3Sthurlow { 2164bff34e3Sthurlow void *p = kmem_zalloc(size, KM_SLEEP); 2174bff34e3Sthurlow return (p); 2184bff34e3Sthurlow } 2194bff34e3Sthurlow 2204bff34e3Sthurlow size_t 2214bff34e3Sthurlow smb_strtouni(u_int16_t *dst, const char *src, size_t inlen, int flags) 2224bff34e3Sthurlow { 2234bff34e3Sthurlow size_t outlen = 0; 2244bff34e3Sthurlow 2254bff34e3Sthurlow if (!inlen) 2264bff34e3Sthurlow inlen = strlen(src); 2274bff34e3Sthurlow 2284bff34e3Sthurlow /* Force output format to little-endian. */ 2294bff34e3Sthurlow flags &= ~UCONV_OUT_BIG_ENDIAN; 2304bff34e3Sthurlow flags |= UCONV_OUT_LITTLE_ENDIAN; 2314bff34e3Sthurlow 2324bff34e3Sthurlow outlen = inlen * 2; 2334bff34e3Sthurlow if (uconv_u8tou16((uchar_t *)src, &inlen, dst, &outlen, flags) != 0) { 2344bff34e3Sthurlow outlen = 0; 2354bff34e3Sthurlow } 2364bff34e3Sthurlow return (outlen * 2); 2374bff34e3Sthurlow } 2384bff34e3Sthurlow 2394bff34e3Sthurlow /* 2404bff34e3Sthurlow * Helper for the SMBERROR macro, etc. 2414bff34e3Sthurlow * This is also a good place for a breakpoint 2424bff34e3Sthurlow * or a dtrace probe, i.e. fbt:nsmb:smb_errmsg 2434bff34e3Sthurlow */ 2444bff34e3Sthurlow void 2454bff34e3Sthurlow smb_errmsg(int cel, const char *func_name, const char *fmt, ...) 2464bff34e3Sthurlow { 2474bff34e3Sthurlow va_list adx; 2484bff34e3Sthurlow char buf[100]; 2494bff34e3Sthurlow 2504bff34e3Sthurlow va_start(adx, fmt); 2514bff34e3Sthurlow if (cel == CE_CONT) { 2524bff34e3Sthurlow /* 2534bff34e3Sthurlow * This is one of our xxxDEBUG macros. 2544bff34e3Sthurlow * Don't bother to log these, but just 2554bff34e3Sthurlow * fire a dtrace probe with the message. 2564bff34e3Sthurlow */ 2574bff34e3Sthurlow vsnprintf(buf, sizeof (buf), fmt, adx); 2584bff34e3Sthurlow DTRACE_PROBE2(debugmsg2, 2594bff34e3Sthurlow (char *), func_name, 2604bff34e3Sthurlow (char *), buf); 2614bff34e3Sthurlow } else { 2624bff34e3Sthurlow /* 2634bff34e3Sthurlow * This is one of our xxxERROR macros. 2644bff34e3Sthurlow * Add a prefix to the fmt string, 2654bff34e3Sthurlow * then let vcmn_err do the args. 2664bff34e3Sthurlow */ 2674bff34e3Sthurlow snprintf(buf, sizeof (buf), "?%s: %s", func_name, fmt); 2684bff34e3Sthurlow DTRACE_PROBE3(debugmsg3, 2694bff34e3Sthurlow (char *), func_name, 2704bff34e3Sthurlow (char *), buf, 2714bff34e3Sthurlow va_list, adx); 2724bff34e3Sthurlow vcmn_err(cel, buf, adx); 2734bff34e3Sthurlow } 2744bff34e3Sthurlow va_end(adx); 2754bff34e3Sthurlow } 2764bff34e3Sthurlow 2774bff34e3Sthurlow #if 1 /* def SMB_SOCKETDATA_DEBUG */ 2784bff34e3Sthurlow void 2794bff34e3Sthurlow m_dumpm(mblk_t *m) 2804bff34e3Sthurlow { 2814bff34e3Sthurlow int len, seg; 2824bff34e3Sthurlow 2834bff34e3Sthurlow len = msgdsize(m); 2844bff34e3Sthurlow DTRACE_PROBE2(dsize, int, len, (mblk_t *), m); 2854bff34e3Sthurlow 2864bff34e3Sthurlow for (seg = 0; m; seg++) { 2874bff34e3Sthurlow DTRACE_PROBE2(mblk, int, seg, (mblk_t *), m); 2884bff34e3Sthurlow m = m->b_cont; 2894bff34e3Sthurlow } 2904bff34e3Sthurlow } 2914bff34e3Sthurlow #endif 2924bff34e3Sthurlow 2934bff34e3Sthurlow /* all these need review XXX */ 2944bff34e3Sthurlow #ifndef EPROTO 2954bff34e3Sthurlow #define EPROTO ECONNABORTED 2964bff34e3Sthurlow #endif 2974bff34e3Sthurlow #ifndef ELIBACC 2984bff34e3Sthurlow #define ELIBACC ENOENT 2994bff34e3Sthurlow #endif 3004bff34e3Sthurlow #ifndef ENODATA 3014bff34e3Sthurlow #define ENODATA EINVAL 3024bff34e3Sthurlow #endif 3034bff34e3Sthurlow #ifndef ENOTUNIQ 3044bff34e3Sthurlow #define ENOTUNIQ EADDRINUSE 3054bff34e3Sthurlow #endif 3064bff34e3Sthurlow #ifndef ECOMM 3074bff34e3Sthurlow #define ECOMM EIO 3084bff34e3Sthurlow #endif 3094bff34e3Sthurlow #ifndef ENOMEDIUM 3104bff34e3Sthurlow #define ENOMEDIUM EIO 3114bff34e3Sthurlow #endif 3124bff34e3Sthurlow #ifndef ETIME 3134bff34e3Sthurlow #define ETIME ETIMEDOUT 3144bff34e3Sthurlow #endif 3154bff34e3Sthurlow 3164bff34e3Sthurlow static struct { 3174bff34e3Sthurlow unsigned nterr; 3184bff34e3Sthurlow unsigned errno; 3194bff34e3Sthurlow } nt2errno[] = { 3204bff34e3Sthurlow {NT_STATUS_ACCESS_DENIED, EACCES}, 3214bff34e3Sthurlow {NT_STATUS_ACCESS_VIOLATION, EACCES}, 3224bff34e3Sthurlow {NT_STATUS_ACCOUNT_DISABLED, EACCES}, 3234bff34e3Sthurlow {NT_STATUS_ACCOUNT_RESTRICTION, EACCES}, 3244bff34e3Sthurlow {NT_STATUS_ADDRESS_ALREADY_EXISTS, EADDRINUSE}, 3254bff34e3Sthurlow {NT_STATUS_BAD_NETWORK_NAME, ENOENT}, 3264bff34e3Sthurlow {NT_STATUS_BUFFER_TOO_SMALL, EMOREDATA}, 3274bff34e3Sthurlow {NT_STATUS_CANNOT_DELETE, EACCES}, 3284bff34e3Sthurlow {NT_STATUS_CONFLICTING_ADDRESSES, EADDRINUSE}, 3294bff34e3Sthurlow {NT_STATUS_CONNECTION_ABORTED, ECONNABORTED}, 3304bff34e3Sthurlow {NT_STATUS_CONNECTION_DISCONNECTED, ECONNABORTED}, 3314bff34e3Sthurlow {NT_STATUS_CONNECTION_REFUSED, ECONNREFUSED}, 3324bff34e3Sthurlow {NT_STATUS_CONNECTION_RESET, ENETRESET}, 3334bff34e3Sthurlow {NT_STATUS_DEVICE_DOES_NOT_EXIST, ENODEV}, 3344bff34e3Sthurlow {NT_STATUS_DEVICE_PROTOCOL_ERROR, EPROTO}, 3354bff34e3Sthurlow {NT_STATUS_DIRECTORY_NOT_EMPTY, ENOTEMPTY}, 3364bff34e3Sthurlow {NT_STATUS_DISK_FULL, ENOSPC}, 3374bff34e3Sthurlow {NT_STATUS_DLL_NOT_FOUND, ELIBACC}, 3384bff34e3Sthurlow {NT_STATUS_END_OF_FILE, ENODATA}, 3394bff34e3Sthurlow {NT_STATUS_FILE_IS_A_DIRECTORY, EISDIR}, 3404bff34e3Sthurlow {NT_STATUS_FLOAT_INEXACT_RESULT, ERANGE}, 3414bff34e3Sthurlow {NT_STATUS_FLOAT_OVERFLOW, ERANGE}, 3424bff34e3Sthurlow {NT_STATUS_FLOAT_UNDERFLOW, ERANGE}, 3434bff34e3Sthurlow {NT_STATUS_HOST_UNREACHABLE, EHOSTUNREACH}, 3444bff34e3Sthurlow {NT_STATUS_ILL_FORMED_PASSWORD, EACCES}, 3454bff34e3Sthurlow {NT_STATUS_INTEGER_OVERFLOW, ERANGE}, 3464bff34e3Sthurlow {NT_STATUS_INVALID_HANDLE, EBADF}, 3474bff34e3Sthurlow {NT_STATUS_INVALID_LOGON_HOURS, EACCES}, 3484bff34e3Sthurlow {NT_STATUS_INVALID_PARAMETER, EINVAL}, 3494bff34e3Sthurlow {NT_STATUS_INVALID_PIPE_STATE, EPIPE}, 3504bff34e3Sthurlow {NT_STATUS_INVALID_WORKSTATION, EACCES}, 3514bff34e3Sthurlow {NT_STATUS_IN_PAGE_ERROR, EFAULT}, 3524bff34e3Sthurlow {NT_STATUS_IO_TIMEOUT, ETIMEDOUT}, 3534bff34e3Sthurlow {NT_STATUS_IP_ADDRESS_CONFLICT1, ENOTUNIQ}, 3544bff34e3Sthurlow {NT_STATUS_IP_ADDRESS_CONFLICT2, ENOTUNIQ}, 3554bff34e3Sthurlow {NT_STATUS_LICENSE_QUOTA_EXCEEDED, EDQUOT}, 3564bff34e3Sthurlow {NT_STATUS_LOGON_FAILURE, EACCES}, 3574bff34e3Sthurlow {NT_STATUS_MEDIA_WRITE_PROTECTED, EROFS}, 3584bff34e3Sthurlow {NT_STATUS_MEMORY_NOT_ALLOCATED, EFAULT}, 3594bff34e3Sthurlow {NT_STATUS_NAME_TOO_LONG, ENAMETOOLONG}, 3604bff34e3Sthurlow {NT_STATUS_NETWORK_ACCESS_DENIED, EACCES}, 3614bff34e3Sthurlow {NT_STATUS_NETWORK_BUSY, EBUSY}, 3624bff34e3Sthurlow {NT_STATUS_NETWORK_UNREACHABLE, ENETUNREACH}, 3634bff34e3Sthurlow {NT_STATUS_NET_WRITE_FAULT, ECOMM}, 3644bff34e3Sthurlow {NT_STATUS_NONEXISTENT_SECTOR, ESPIPE}, 3654bff34e3Sthurlow {NT_STATUS_NOT_A_DIRECTORY, ENOTDIR}, 3664bff34e3Sthurlow {NT_STATUS_NOT_IMPLEMENTED, ENOSYS}, 3674bff34e3Sthurlow {NT_STATUS_NOT_MAPPED_VIEW, EINVAL}, 3684bff34e3Sthurlow {NT_STATUS_NOT_SUPPORTED, ENOSYS}, 3694bff34e3Sthurlow {NT_STATUS_NO_MEDIA, ENOMEDIUM}, 3704bff34e3Sthurlow {NT_STATUS_NO_MEDIA_IN_DEVICE, ENOMEDIUM}, 3714bff34e3Sthurlow {NT_STATUS_NO_MEMORY, ENOMEM}, 3724bff34e3Sthurlow {NT_STATUS_NO_SUCH_DEVICE, ENODEV}, 3734bff34e3Sthurlow {NT_STATUS_NO_SUCH_FILE, ENOENT}, 3744bff34e3Sthurlow {NT_STATUS_OBJECT_NAME_COLLISION, EEXIST}, 3754bff34e3Sthurlow {NT_STATUS_OBJECT_NAME_NOT_FOUND, ENOENT}, 376*91d632c8Sgwr {NT_STATUS_OBJECT_NAME_INVALID, EINVAL}, 3774bff34e3Sthurlow {NT_STATUS_OBJECT_PATH_INVALID, ENOTDIR}, 3784bff34e3Sthurlow {NT_STATUS_PAGEFILE_QUOTA, EDQUOT}, 3794bff34e3Sthurlow {NT_STATUS_PASSWORD_EXPIRED, EACCES}, 3804bff34e3Sthurlow {NT_STATUS_PASSWORD_RESTRICTION, EACCES}, 3814bff34e3Sthurlow {NT_STATUS_PATH_NOT_COVERED, ENOENT}, 3824bff34e3Sthurlow {NT_STATUS_PIPE_BROKEN, EPIPE}, 3834bff34e3Sthurlow {NT_STATUS_PIPE_BUSY, EPIPE}, 3844bff34e3Sthurlow {NT_STATUS_PIPE_CONNECTED, EISCONN}, 3854bff34e3Sthurlow {NT_STATUS_PIPE_DISCONNECTED, EPIPE}, 3864bff34e3Sthurlow {NT_STATUS_PIPE_NOT_AVAILABLE, ENOSYS}, 3874bff34e3Sthurlow {NT_STATUS_PORT_CONNECTION_REFUSED, ECONNREFUSED}, 3884bff34e3Sthurlow {NT_STATUS_PORT_MESSAGE_TOO_LONG, EMSGSIZE}, 3894bff34e3Sthurlow {NT_STATUS_PORT_UNREACHABLE, EHOSTUNREACH}, 3904bff34e3Sthurlow {NT_STATUS_PROTOCOL_UNREACHABLE, ENOPROTOOPT}, 3914bff34e3Sthurlow {NT_STATUS_QUOTA_EXCEEDED, EDQUOT}, 3924bff34e3Sthurlow {NT_STATUS_REGISTRY_QUOTA_LIMIT, EDQUOT}, 3934bff34e3Sthurlow {NT_STATUS_REMOTE_DISCONNECT, ESHUTDOWN}, 3944bff34e3Sthurlow {NT_STATUS_REMOTE_NOT_LISTENING, ECONNREFUSED}, 3954bff34e3Sthurlow {NT_STATUS_REQUEST_NOT_ACCEPTED, EACCES}, 3964bff34e3Sthurlow {NT_STATUS_RETRY, EAGAIN}, 3974bff34e3Sthurlow {NT_STATUS_SHARING_VIOLATION, EBUSY}, 3984bff34e3Sthurlow {NT_STATUS_TIMER_NOT_CANCELED, ETIME}, 3994bff34e3Sthurlow {NT_STATUS_TOO_MANY_LINKS, EMLINK}, 4004bff34e3Sthurlow {NT_STATUS_TOO_MANY_OPENED_FILES, EMFILE}, 4014bff34e3Sthurlow {NT_STATUS_UNABLE_TO_FREE_VM, EADDRINUSE}, 4024bff34e3Sthurlow {NT_STATUS_UNSUCCESSFUL, EINVAL}, 4034bff34e3Sthurlow {NT_STATUS_WRONG_PASSWORD, EACCES}, 4044bff34e3Sthurlow {0, 0} 4054bff34e3Sthurlow }; 4064bff34e3Sthurlow 4074bff34e3Sthurlow static struct { 4084bff34e3Sthurlow unsigned dclass; 4094bff34e3Sthurlow unsigned derr; 4104bff34e3Sthurlow unsigned nterr; 4114bff34e3Sthurlow } nt2doserr[] = { 4124bff34e3Sthurlow {ERRDOS, ERRgeneral, NT_STATUS_UNSUCCESSFUL}, 4134bff34e3Sthurlow {ERRDOS, ERRbadfunc, NT_STATUS_NOT_IMPLEMENTED}, 4144bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_INFO_CLASS}, 4154bff34e3Sthurlow {ERRDOS, ERRbadlength, NT_STATUS_INFO_LENGTH_MISMATCH}, 4164bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ACCESS_VIOLATION}, 4174bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_IN_PAGE_ERROR}, 4184bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA}, 4194bff34e3Sthurlow {ERRDOS, ERRbadfid, NT_STATUS_INVALID_HANDLE}, 4204bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_INITIAL_STACK}, 4214bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_BAD_INITIAL_PC}, 4224bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_CID}, 4234bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TIMER_NOT_CANCELED}, 4244bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER}, 4254bff34e3Sthurlow {ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_DEVICE}, 4264bff34e3Sthurlow {ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_FILE}, 4274bff34e3Sthurlow {ERRDOS, ERRbadfunc, NT_STATUS_INVALID_DEVICE_REQUEST}, 4284bff34e3Sthurlow {ERRDOS, ERRhandleeof, NT_STATUS_END_OF_FILE}, 4294bff34e3Sthurlow {ERRDOS, ERRwrongdisk, NT_STATUS_WRONG_VOLUME}, 4304bff34e3Sthurlow {ERRDOS, ERRnotready, NT_STATUS_NO_MEDIA_IN_DEVICE}, 4314bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, 4324bff34e3Sthurlow {ERRDOS, ERRsectornotfound, NT_STATUS_NONEXISTENT_SECTOR}, 4334bff34e3Sthurlow {ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, 4344bff34e3Sthurlow {ERRDOS, 487, NT_STATUS_CONFLICTING_ADDRESSES}, 4354bff34e3Sthurlow {ERRDOS, 487, NT_STATUS_NOT_MAPPED_VIEW}, 4364bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_UNABLE_TO_FREE_VM}, 4374bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_UNABLE_TO_DELETE_SECTION}, 4384bff34e3Sthurlow {ERRDOS, 2142, NT_STATUS_INVALID_SYSTEM_SERVICE}, 4394bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_INSTRUCTION}, 4404bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, 4414bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_INVALID_VIEW_SIZE}, 4424bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, 4434bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED}, 4444bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, 4454bff34e3Sthurlow {ERRDOS, 111, NT_STATUS_BUFFER_TOO_SMALL}, 4464bff34e3Sthurlow {ERRDOS, ERRbadfid, NT_STATUS_OBJECT_TYPE_MISMATCH}, 4474bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NONCONTINUABLE_EXCEPTION}, 4484bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_DISPOSITION}, 4494bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNWIND}, 4504bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_STACK}, 4514bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_UNWIND_TARGET}, 4524bff34e3Sthurlow {ERRDOS, 158, NT_STATUS_NOT_LOCKED}, 4534bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PARITY_ERROR}, 4544bff34e3Sthurlow {ERRDOS, 487, NT_STATUS_UNABLE_TO_DECOMMIT_VM}, 4554bff34e3Sthurlow {ERRDOS, 487, NT_STATUS_NOT_COMMITTED}, 4564bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_PORT_ATTRIBUTES}, 4574bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PORT_MESSAGE_TOO_LONG}, 4584bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_MIX}, 4594bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, 4604bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, 4614bff34e3Sthurlow {ERRDOS, ERRinvalidname, NT_STATUS_OBJECT_NAME_INVALID}, 4624bff34e3Sthurlow {ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, 4634bff34e3Sthurlow {ERRDOS, 183, NT_STATUS_OBJECT_NAME_COLLISION}, 4644bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, 4654bff34e3Sthurlow {ERRDOS, ERRbadfid, NT_STATUS_PORT_DISCONNECTED}, 4664bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DEVICE_ALREADY_ATTACHED}, 4674bff34e3Sthurlow {ERRDOS, 161, NT_STATUS_OBJECT_PATH_INVALID}, 4684bff34e3Sthurlow {ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND}, 4694bff34e3Sthurlow {ERRDOS, 161, NT_STATUS_OBJECT_PATH_SYNTAX_BAD}, 4704bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DATA_OVERRUN}, 4714bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DATA_LATE_ERROR}, 4724bff34e3Sthurlow {ERRDOS, ERRcrc, NT_STATUS_DATA_ERROR}, 4734bff34e3Sthurlow {ERRDOS, ERRcrc, NT_STATUS_CRC_ERROR}, 4744bff34e3Sthurlow {ERRDOS, ERRnomem, NT_STATUS_SECTION_TOO_BIG}, 4754bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_PORT_CONNECTION_REFUSED}, 4764bff34e3Sthurlow {ERRDOS, ERRbadfid, NT_STATUS_INVALID_PORT_HANDLE}, 4774bff34e3Sthurlow {ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION}, 4784bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_QUOTA_EXCEEDED}, 4794bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PAGE_PROTECTION}, 4804bff34e3Sthurlow {ERRDOS, 288, NT_STATUS_MUTANT_NOT_OWNED}, 4814bff34e3Sthurlow {ERRDOS, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED}, 4824bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_PORT_ALREADY_SET}, 4834bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_SECTION_NOT_IMAGE}, 4844bff34e3Sthurlow {ERRDOS, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED}, 4854bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_THREAD_IS_TERMINATING}, 4864bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_BAD_WORKING_SET_LIMIT}, 4874bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INCOMPATIBLE_FILE_MAP}, 4884bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_SECTION_PROTECTION}, 4894bff34e3Sthurlow {ERRDOS, 282, NT_STATUS_EAS_NOT_SUPPORTED}, 4904bff34e3Sthurlow {ERRDOS, 255, NT_STATUS_EA_TOO_LARGE}, 4914bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NONEXISTENT_EA_ENTRY}, 4924bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_EAS_ON_FILE}, 4934bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_EA_CORRUPT_ERROR}, 4944bff34e3Sthurlow {ERRDOS, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT}, 4954bff34e3Sthurlow {ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED}, 4964bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_DELETE_PENDING}, 4974bff34e3Sthurlow {ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, 4984bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, 4994bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, 5004bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, 5014bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, 5024bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, 5034bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, 5044bff34e3Sthurlow {ERRDOS, 2215, NT_STATUS_NO_LOGON_SERVERS}, 5054bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_LOGON_SESSION}, 5064bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PRIVILEGE}, 5074bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_PRIVILEGE_NOT_HELD}, 5084bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, 5094bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS}, 5104bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, 5114bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, 5124bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, 5134bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, 5144bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, 5154bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN}, 5164bff34e3Sthurlow {ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, 5174bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_PASSWORD}, 5184bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, 5194bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, 5204bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, 5214bff34e3Sthurlow {ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, 5224bff34e3Sthurlow {ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, 5234bff34e3Sthurlow {ERRSRV, 2242, NT_STATUS_PASSWORD_EXPIRED}, 5244bff34e3Sthurlow {ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, 5254bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, 5264bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, 5274bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, 5284bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_SUB_AUTHORITY}, 5294bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACL}, 5304bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_SID}, 5314bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_SECURITY_DESCR}, 5324bff34e3Sthurlow {ERRDOS, 127, NT_STATUS_PROCEDURE_NOT_FOUND}, 5334bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_INVALID_IMAGE_FORMAT}, 5344bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_TOKEN}, 5354bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_INHERITANCE_ACL}, 5364bff34e3Sthurlow {ERRDOS, 158, NT_STATUS_RANGE_NOT_LOCKED}, 5374bff34e3Sthurlow {ERRDOS, 112, NT_STATUS_DISK_FULL}, 5384bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SERVER_DISABLED}, 5394bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SERVER_NOT_DISABLED}, 5404bff34e3Sthurlow {ERRDOS, ERRtoomanynames, NT_STATUS_TOO_MANY_GUIDS_REQUESTED}, 5414bff34e3Sthurlow {ERRDOS, 259, NT_STATUS_GUIDS_EXHAUSTED}, 5424bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_ID_AUTHORITY}, 5434bff34e3Sthurlow {ERRDOS, 259, NT_STATUS_AGENTS_EXHAUSTED}, 5444bff34e3Sthurlow {ERRDOS, 154, NT_STATUS_INVALID_VOLUME_LABEL}, 5454bff34e3Sthurlow {ERRDOS, ERRoutofmem, NT_STATUS_SECTION_NOT_EXTENDED}, 5464bff34e3Sthurlow {ERRDOS, 487, NT_STATUS_NOT_MAPPED_DATA}, 5474bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_DATA_NOT_FOUND}, 5484bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_TYPE_NOT_FOUND}, 5494bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_NAME_NOT_FOUND}, 5504bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ARRAY_BOUNDS_EXCEEDED}, 5514bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DENORMAL_OPERAND}, 5524bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DIVIDE_BY_ZERO}, 5534bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INEXACT_RESULT}, 5544bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INVALID_OPERATION}, 5554bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOAT_OVERFLOW}, 5564bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOAT_STACK_CHECK}, 5574bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOAT_UNDERFLOW}, 5584bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INTEGER_DIVIDE_BY_ZERO}, 5594bff34e3Sthurlow {ERRDOS, 534, NT_STATUS_INTEGER_OVERFLOW}, 5604bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PRIVILEGED_INSTRUCTION}, 5614bff34e3Sthurlow {ERRDOS, ERRnomem, NT_STATUS_TOO_MANY_PAGING_FILES}, 5624bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, 5634bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, 5644bff34e3Sthurlow {ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, 5654bff34e3Sthurlow {ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, 5664bff34e3Sthurlow {ERRDOS, ERRcrc, NT_STATUS_DEVICE_DATA_ERROR}, 5674bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_CONNECTED}, 5684bff34e3Sthurlow {ERRDOS, ERRnotready, NT_STATUS_DEVICE_POWER_FAILURE}, 5694bff34e3Sthurlow {ERRDOS, 487, NT_STATUS_FREE_VM_NOT_AT_BASE}, 5704bff34e3Sthurlow {ERRDOS, 487, NT_STATUS_MEMORY_NOT_ALLOCATED}, 5714bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_WORKING_SET_QUOTA}, 5724bff34e3Sthurlow {ERRDOS, ERRwriteprotect, NT_STATUS_MEDIA_WRITE_PROTECTED}, 5734bff34e3Sthurlow {ERRDOS, ERRnotready, NT_STATUS_DEVICE_NOT_READY}, 5744bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_GROUP_ATTRIBUTES}, 5754bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_IMPERSONATION_LEVEL}, 5764bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANT_OPEN_ANONYMOUS}, 5774bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_VALIDATION_CLASS}, 5784bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_TOKEN_TYPE}, 5794bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_BAD_MASTER_BOOT_RECORD}, 5804bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INSTRUCTION_MISALIGNMENT}, 5814bff34e3Sthurlow {ERRDOS, ERRpipebusy, NT_STATUS_INSTANCE_NOT_AVAILABLE}, 5824bff34e3Sthurlow {ERRDOS, ERRpipebusy, NT_STATUS_PIPE_NOT_AVAILABLE}, 5834bff34e3Sthurlow {ERRDOS, ERRbadpipe, NT_STATUS_INVALID_PIPE_STATE}, 5844bff34e3Sthurlow {ERRDOS, ERRpipebusy, NT_STATUS_PIPE_BUSY}, 5854bff34e3Sthurlow {ERRDOS, ERRbadfunc, NT_STATUS_ILLEGAL_FUNCTION}, 5864bff34e3Sthurlow {ERRDOS, ERRnotconnected, NT_STATUS_PIPE_DISCONNECTED}, 5874bff34e3Sthurlow {ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_CLOSING}, 5884bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PIPE_CONNECTED}, 5894bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PIPE_LISTENING}, 5904bff34e3Sthurlow {ERRDOS, ERRbadpipe, NT_STATUS_INVALID_READ_MODE}, 5914bff34e3Sthurlow {ERRDOS, 121, NT_STATUS_IO_TIMEOUT}, 5924bff34e3Sthurlow {ERRDOS, ERRhandleeof, NT_STATUS_FILE_FORCED_CLOSED}, 5934bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STARTED}, 5944bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STOPPED}, 5954bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_COULD_NOT_INTERPRET}, 5964bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY}, 5974bff34e3Sthurlow {ERRDOS, ERRunsup, NT_STATUS_NOT_SUPPORTED}, 5984bff34e3Sthurlow {ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING}, 5994bff34e3Sthurlow {ERRDOS, 52, NT_STATUS_DUPLICATE_NAME}, 6004bff34e3Sthurlow {ERRDOS, 53, NT_STATUS_BAD_NETWORK_PATH}, 6014bff34e3Sthurlow {ERRDOS, 54, NT_STATUS_NETWORK_BUSY}, 6024bff34e3Sthurlow {ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST}, 6034bff34e3Sthurlow {ERRDOS, 56, NT_STATUS_TOO_MANY_COMMANDS}, 6044bff34e3Sthurlow {ERRDOS, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR}, 6054bff34e3Sthurlow {ERRDOS, 58, NT_STATUS_INVALID_NETWORK_RESPONSE}, 6064bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR}, 6074bff34e3Sthurlow {ERRDOS, 60, NT_STATUS_BAD_REMOTE_ADAPTER}, 6084bff34e3Sthurlow {ERRDOS, 61, NT_STATUS_PRINT_QUEUE_FULL}, 6094bff34e3Sthurlow {ERRDOS, 62, NT_STATUS_NO_SPOOL_SPACE}, 6104bff34e3Sthurlow {ERRDOS, 63, NT_STATUS_PRINT_CANCELLED}, 6114bff34e3Sthurlow {ERRDOS, 64, NT_STATUS_NETWORK_NAME_DELETED}, 6124bff34e3Sthurlow {ERRDOS, 65, NT_STATUS_NETWORK_ACCESS_DENIED}, 6134bff34e3Sthurlow {ERRDOS, 66, NT_STATUS_BAD_DEVICE_TYPE}, 6144bff34e3Sthurlow {ERRDOS, ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME}, 6154bff34e3Sthurlow {ERRDOS, 68, NT_STATUS_TOO_MANY_NAMES}, 6164bff34e3Sthurlow {ERRDOS, 69, NT_STATUS_TOO_MANY_SESSIONS}, 6174bff34e3Sthurlow {ERRDOS, 70, NT_STATUS_SHARING_PAUSED}, 6184bff34e3Sthurlow {ERRDOS, 71, NT_STATUS_REQUEST_NOT_ACCEPTED}, 6194bff34e3Sthurlow {ERRDOS, 72, NT_STATUS_REDIRECTOR_PAUSED}, 6204bff34e3Sthurlow {ERRDOS, 88, NT_STATUS_NET_WRITE_FAULT}, 6214bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PROFILING_AT_LIMIT}, 6224bff34e3Sthurlow {ERRDOS, ERRdiffdevice, NT_STATUS_NOT_SAME_DEVICE}, 6234bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_FILE_RENAMED}, 6244bff34e3Sthurlow {ERRDOS, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED}, 6254bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SECURITY_ON_OBJECT}, 6264bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANT_WAIT}, 6274bff34e3Sthurlow {ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_EMPTY}, 6284bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANT_ACCESS_DOMAIN_INFO}, 6294bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANT_TERMINATE_SELF}, 6304bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_SERVER_STATE}, 6314bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_STATE}, 6324bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_ROLE}, 6334bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_DOMAIN}, 6344bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_EXISTS}, 6354bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_LIMIT_EXCEEDED}, 6364bff34e3Sthurlow {ERRDOS, 300, NT_STATUS_OPLOCK_NOT_GRANTED}, 6374bff34e3Sthurlow {ERRDOS, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL}, 6384bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_CORRUPTION}, 6394bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_ERROR}, 6404bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_GENERIC_NOT_MAPPED}, 6414bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_DESCRIPTOR_FORMAT}, 6424bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_USER_BUFFER}, 6434bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_IO_ERROR}, 6444bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_CREATE_ERR}, 6454bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_MAP_ERROR}, 6464bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_EXTEND_ERR}, 6474bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NOT_LOGON_PROCESS}, 6484bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_EXISTS}, 6494bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_1}, 6504bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_2}, 6514bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_3}, 6524bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_4}, 6534bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_5}, 6544bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_6}, 6554bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_7}, 6564bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_8}, 6574bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_9}, 6584bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_10}, 6594bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_11}, 6604bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_INVALID_PARAMETER_12}, 6614bff34e3Sthurlow {ERRDOS, ERRbadpath, NT_STATUS_REDIRECTOR_NOT_STARTED}, 6624bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REDIRECTOR_STARTED}, 6634bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW}, 6644bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PACKAGE}, 6654bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_FUNCTION_TABLE}, 6664bff34e3Sthurlow {ERRDOS, 203, NT_STATUS_VARIABLE_NOT_FOUND}, 6674bff34e3Sthurlow {ERRDOS, 145, NT_STATUS_DIRECTORY_NOT_EMPTY}, 6684bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FILE_CORRUPT_ERROR}, 6694bff34e3Sthurlow {ERRDOS, 267, NT_STATUS_NOT_A_DIRECTORY}, 6704bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_LOGON_SESSION_STATE}, 6714bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_COLLISION}, 6724bff34e3Sthurlow {ERRDOS, 206, NT_STATUS_NAME_TOO_LONG}, 6734bff34e3Sthurlow {ERRDOS, 2401, NT_STATUS_FILES_OPEN}, 6744bff34e3Sthurlow {ERRDOS, 2404, NT_STATUS_CONNECTION_IN_USE}, 6754bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MESSAGE_NOT_FOUND}, 6764bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_PROCESS_IS_TERMINATING}, 6774bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_LOGON_TYPE}, 6784bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_GUID_TRANSLATION}, 6794bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANNOT_IMPERSONATE}, 6804bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_IMAGE_ALREADY_LOADED}, 6814bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_PRESENT}, 6824bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_NOT_EXIST}, 6834bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_ALREADY_OWNED}, 6844bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_LID_OWNER}, 6854bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_COMMAND}, 6864bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_LID}, 6874bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE}, 6884bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_SELECTOR}, 6894bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_LDT}, 6904bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_SIZE}, 6914bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_OFFSET}, 6924bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_DESCRIPTOR}, 6934bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NE_FORMAT}, 6944bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RXACT_INVALID_STATE}, 6954bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RXACT_COMMIT_FAILURE}, 6964bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MAPPED_FILE_SIZE_ZERO}, 6974bff34e3Sthurlow {ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES}, 6984bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANCELLED}, 6994bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_CANNOT_DELETE}, 7004bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_COMPUTER_NAME}, 7014bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_FILE_DELETED}, 7024bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_ACCOUNT}, 7034bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_GROUP}, 7044bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_USER}, 7054bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MEMBERS_PRIMARY_GROUP}, 7064bff34e3Sthurlow {ERRDOS, ERRbadfid, NT_STATUS_FILE_CLOSED}, 7074bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_THREADS}, 7084bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_THREAD_NOT_IN_PROCESS}, 7094bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TOKEN_ALREADY_IN_USE}, 7104bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA_EXCEEDED}, 7114bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_COMMITMENT_LIMIT}, 7124bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_INVALID_IMAGE_LE_FORMAT}, 7134bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NOT_MZ}, 7144bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_INVALID_IMAGE_PROTECT}, 7154bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_INVALID_IMAGE_WIN_16}, 7164bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOGON_SERVER_CONFLICT}, 7174bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TIME_DIFFERENCE_AT_DC}, 7184bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SYNCHRONIZATION_REQUIRED}, 7194bff34e3Sthurlow {ERRDOS, 126, NT_STATUS_DLL_NOT_FOUND}, 7204bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_OPEN_FAILED}, 7214bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_IO_PRIVILEGE_FAILED}, 7224bff34e3Sthurlow {ERRDOS, 182, NT_STATUS_ORDINAL_NOT_FOUND}, 7234bff34e3Sthurlow {ERRDOS, 127, NT_STATUS_ENTRYPOINT_NOT_FOUND}, 7244bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CONTROL_C_EXIT}, 7254bff34e3Sthurlow {ERRDOS, 64, NT_STATUS_LOCAL_DISCONNECT}, 7264bff34e3Sthurlow {ERRDOS, 64, NT_STATUS_REMOTE_DISCONNECT}, 7274bff34e3Sthurlow {ERRDOS, 51, NT_STATUS_REMOTE_RESOURCES}, 7284bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_LINK_FAILED}, 7294bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_LINK_TIMEOUT}, 7304bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_INVALID_CONNECTION}, 7314bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_INVALID_ADDRESS}, 7324bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DLL_INIT_FAILED}, 7334bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MISSING_SYSTEMFILE}, 7344bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNHANDLED_EXCEPTION}, 7354bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_APP_INIT_FAILURE}, 7364bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_CREATE_FAILED}, 7374bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_PAGEFILE}, 7384bff34e3Sthurlow {ERRDOS, 124, NT_STATUS_INVALID_LEVEL}, 7394bff34e3Sthurlow {ERRDOS, 86, NT_STATUS_WRONG_PASSWORD_CORE}, 7404bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_FLOAT_CONTEXT}, 7414bff34e3Sthurlow {ERRDOS, 109, NT_STATUS_PIPE_BROKEN}, 7424bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_CORRUPT}, 7434bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_IO_FAILED}, 7444bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_EVENT_PAIR}, 7454bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_VOLUME}, 7464bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SERIAL_NO_DEVICE_INITED}, 7474bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_ALIAS}, 7484bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_ALIAS}, 7494bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_ALIAS}, 7504bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ALIAS_EXISTS}, 7514bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOGON_NOT_GRANTED}, 7524bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SECRETS}, 7534bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SECRET_TOO_LONG}, 7544bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_ERROR}, 7554bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FULLSCREEN_MODE}, 7564bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_CONTEXT_IDS}, 7574bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_LOGON_TYPE_NOT_GRANTED}, 7584bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NOT_REGISTRY_FILE}, 7594bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED}, 7604bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR}, 7614bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FT_MISSING_MEMBER}, 7624bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_SERVICE_ENTRY}, 7634bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_CHARACTER}, 7644bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNMAPPABLE_CHARACTER}, 7654bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNDEFINED_CHARACTER}, 7664bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_VOLUME}, 7674bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND}, 7684bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_WRONG_CYLINDER}, 7694bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_UNKNOWN_ERROR}, 7704bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_BAD_REGISTERS}, 7714bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DISK_RECALIBRATE_FAILED}, 7724bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DISK_OPERATION_FAILED}, 7734bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DISK_RESET_FAILED}, 7744bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SHARED_IRQ_BUSY}, 7754bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FT_ORPHANING}, 7764bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT}, 7774bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_16F}, 7784bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_170}, 7794bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_171}, 7804bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PARTITION_FAILURE}, 7814bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_BLOCK_LENGTH}, 7824bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_PARTITIONED}, 7834bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_LOCK_MEDIA}, 7844bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_UNLOAD_MEDIA}, 7854bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_EOM_OVERFLOW}, 7864bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_MEDIA}, 7874bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_179}, 7884bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_MEMBER}, 7894bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_MEMBER}, 7904bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_KEY_DELETED}, 7914bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_LOG_SPACE}, 7924bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SIDS}, 7934bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED}, 7944bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_KEY_HAS_CHILDREN}, 7954bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CHILD_MUST_BE_VOLATILE}, 7964bff34e3Sthurlow {ERRDOS, ERRinvalidparam, NT_STATUS_DEVICE_CONFIGURATION_ERROR}, 7974bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DRIVER_INTERNAL_ERROR}, 7984bff34e3Sthurlow {ERRDOS, ERRbadcmd, NT_STATUS_INVALID_DEVICE_STATE}, 7994bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_IO_DEVICE_ERROR}, 8004bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DEVICE_PROTOCOL_ERROR}, 8014bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BACKUP_CONTROLLER}, 8024bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOG_FILE_FULL}, 8034bff34e3Sthurlow {ERRDOS, ERRwriteprotect, NT_STATUS_TOO_LATE}, 8044bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET}, 8054bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, 8064bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, 8074bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE}, 8084bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CORRUPT}, 8094bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_CANT_START}, 8104bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, 8114bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, 8124bff34e3Sthurlow {ERRDOS, ERRinvgroup, NT_STATUS_NETLOGON_NOT_STARTED}, 8134bff34e3Sthurlow {ERRSRV, 2239, NT_STATUS_ACCOUNT_EXPIRED}, 8144bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, 8154bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, 8164bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, 8174bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CHANGED}, 8184bff34e3Sthurlow {ERRDOS, ERRnoaccess, 8194bff34e3Sthurlow NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}, 8204bff34e3Sthurlow {ERRDOS, ERRnoaccess, 8214bff34e3Sthurlow NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, 8224bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT}, 8234bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, 8244bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FS_DRIVER_REQUIRED}, 8254bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_USER_SESSION_KEY}, 8264bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_USER_SESSION_DELETED}, 8274bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_LANG_NOT_FOUND}, 8284bff34e3Sthurlow {ERRDOS, ERRnomem, NT_STATUS_INSUFF_SERVER_RESOURCES}, 8294bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_BUFFER_SIZE}, 8304bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_COMPONENT}, 8314bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_WILDCARD}, 8324bff34e3Sthurlow {ERRDOS, 68, NT_STATUS_TOO_MANY_ADDRESSES}, 8334bff34e3Sthurlow {ERRDOS, 52, NT_STATUS_ADDRESS_ALREADY_EXISTS}, 8344bff34e3Sthurlow {ERRDOS, 64, NT_STATUS_ADDRESS_CLOSED}, 8354bff34e3Sthurlow {ERRDOS, 64, NT_STATUS_CONNECTION_DISCONNECTED}, 8364bff34e3Sthurlow {ERRDOS, 64, NT_STATUS_CONNECTION_RESET}, 8374bff34e3Sthurlow {ERRDOS, 68, NT_STATUS_TOO_MANY_NODES}, 8384bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_TRANSACTION_ABORTED}, 8394bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_TRANSACTION_TIMED_OUT}, 8404bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_TRANSACTION_NO_RELEASE}, 8414bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_TRANSACTION_NO_MATCH}, 8424bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_TRANSACTION_RESPONDED}, 8434bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_ID}, 8444bff34e3Sthurlow {ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_TYPE}, 8454bff34e3Sthurlow {ERRDOS, ERRunsup, NT_STATUS_NOT_SERVER_SESSION}, 8464bff34e3Sthurlow {ERRDOS, ERRunsup, NT_STATUS_NOT_CLIENT_SESSION}, 8474bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CANNOT_LOAD_REGISTRY_FILE}, 8484bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DEBUG_ATTACH_FAILED}, 8494bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_SYSTEM_PROCESS_TERMINATED}, 8504bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DATA_NOT_ACCEPTED}, 8514bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_BROWSER_SERVERS_FOUND}, 8524bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_VDM_HARD_ERROR}, 8534bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DRIVER_CANCEL_TIMEOUT}, 8544bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REPLY_MESSAGE_MISMATCH}, 8554bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MAPPED_ALIGNMENT}, 8564bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, 8574bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, 8584bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, 8594bff34e3Sthurlow {ERRSRV, 2242, NT_STATUS_PASSWORD_MUST_CHANGE}, 8604bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, 8614bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, 8624bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, 8634bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW_READ}, 8644bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FAIL_CHECK}, 8654bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DUPLICATE_OBJECTID}, 8664bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_OBJECTID_EXISTS}, 8674bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CONVERT_TO_LARGE}, 8684bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RETRY}, 8694bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FOUND_OUT_OF_SCOPE}, 8704bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ALLOCATE_BUCKET}, 8714bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PROPSET_NOT_FOUND}, 8724bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_MARSHALL_OVERFLOW}, 8734bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_VARIANT}, 8744bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND}, 8754bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_ACCOUNT_LOCKED_OUT}, 8764bff34e3Sthurlow {ERRDOS, ERRbadfid, NT_STATUS_HANDLE_NOT_CLOSABLE}, 8774bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_REFUSED}, 8784bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_GRACEFUL_DISCONNECT}, 8794bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_ALREADY_ASSOCIATED}, 8804bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_NOT_ASSOCIATED}, 8814bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_INVALID}, 8824bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ACTIVE}, 8834bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NETWORK_UNREACHABLE}, 8844bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_HOST_UNREACHABLE}, 8854bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PROTOCOL_UNREACHABLE}, 8864bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PORT_UNREACHABLE}, 8874bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REQUEST_ABORTED}, 8884bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ABORTED}, 8894bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_COMPRESSION_BUFFER}, 8904bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_USER_MAPPED_FILE}, 8914bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_AUDIT_FAILED}, 8924bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TIMER_RESOLUTION_NOT_SET}, 8934bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_COUNT_LIMIT}, 8944bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOGIN_TIME_RESTRICTION}, 8954bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LOGIN_WKSTA_RESTRICTION}, 8964bff34e3Sthurlow {ERRDOS, 193, NT_STATUS_IMAGE_MP_UP_MISMATCH}, 8974bff34e3Sthurlow {ERRHRD, ERRgeneral, 0x000024a}, 8984bff34e3Sthurlow {ERRHRD, ERRgeneral, 0x000024b}, 8994bff34e3Sthurlow {ERRHRD, ERRgeneral, 0x000024c}, 9004bff34e3Sthurlow {ERRHRD, ERRgeneral, 0x000024d}, 9014bff34e3Sthurlow {ERRHRD, ERRgeneral, 0x000024e}, 9024bff34e3Sthurlow {ERRHRD, ERRgeneral, 0x000024f}, 9034bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INSUFFICIENT_LOGON_INFO}, 9044bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_DLL_ENTRYPOINT}, 9054bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_BAD_SERVICE_ENTRYPOINT}, 9064bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LPC_REPLY_LOST}, 9074bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT1}, 9084bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT2}, 9094bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_QUOTA_LIMIT}, 9104bff34e3Sthurlow {ERRSRV, ERRbadtype, NT_STATUS_PATH_NOT_COVERED}, 9114bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_NO_CALLBACK_ACTIVE}, 9124bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_LICENSE_QUOTA_EXCEEDED}, 9134bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_SHORT}, 9144bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_RECENT}, 9154bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PWD_HISTORY_CONFLICT}, 9164bff34e3Sthurlow {ERRHRD, ERRgeneral, 0x000025d}, 9174bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_PLUGPLAY_NO_DEVICE}, 9184bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_UNSUPPORTED_COMPRESSION}, 9194bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_HW_PROFILE}, 9204bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH}, 9214bff34e3Sthurlow {ERRDOS, 182, NT_STATUS_DRIVER_ORDINAL_NOT_FOUND}, 9224bff34e3Sthurlow {ERRDOS, 127, NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND}, 9234bff34e3Sthurlow {ERRDOS, 288, NT_STATUS_RESOURCE_NOT_OWNED}, 9244bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LINKS}, 9254bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_QUOTA_LIST_INCONSISTENT}, 9264bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_FILE_IS_OFFLINE}, 9274bff34e3Sthurlow {ERRDOS, ERRnotready, NT_STATUS_VOLUME_DISMOUNTED}, 9284bff34e3Sthurlow {ERRDOS, 161, NT_STATUS_DIRECTORY_IS_A_REPARSE_POINT}, 9294bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_ENCRYPTION_FAILED}, 9304bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_DECRYPTION_FAILED}, 9314bff34e3Sthurlow {ERRHRD, ERRgeneral, NT_STATUS_RANGE_NOT_FOUND}, 9324bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_NO_RECOVERY_POLICY}, 9334bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_NO_EFS}, 9344bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_WRONG_EFS}, 9354bff34e3Sthurlow {ERRDOS, ERRnoaccess, NT_STATUS_NO_USER_KEYS}, 9364bff34e3Sthurlow {ERRDOS, ERRbadfunc, NT_STATUS_VOLUME_NOT_UPGRADED}, 9374bff34e3Sthurlow }; 9384bff34e3Sthurlow 9394bff34e3Sthurlow u_int32_t 9404bff34e3Sthurlow smb_maperr32(u_int32_t eno) 9414bff34e3Sthurlow { 9424bff34e3Sthurlow int i; 9434bff34e3Sthurlow unsigned orig = eno; 9444bff34e3Sthurlow 9454bff34e3Sthurlow /* 9464bff34e3Sthurlow * Hi two bits are "severity". Ignore "success" (0) and 9474bff34e3Sthurlow * "informational" (1) values. 9484bff34e3Sthurlow */ 9494bff34e3Sthurlow if (!(eno & 0x80000000)) 9504bff34e3Sthurlow return (0); 9514bff34e3Sthurlow /* mask off "severity" and the "component" bit */ 9524bff34e3Sthurlow eno &= ~(0xe0000000); 9534bff34e3Sthurlow 9544bff34e3Sthurlow /* first try direct map to unix */ 9554bff34e3Sthurlow for (i = 0; nt2errno[i].errno; i++) 9564bff34e3Sthurlow if (nt2errno[i].nterr == eno) 9574bff34e3Sthurlow return (nt2errno[i].errno); 9584bff34e3Sthurlow SMBERROR("no direct map for 32 bit server error (0x%x)\n", orig); 9594bff34e3Sthurlow 9604bff34e3Sthurlow /* ok, then try mapping to dos to unix */ 9614bff34e3Sthurlow for (i = 0; nt2doserr[i].derr; i++) 9624bff34e3Sthurlow if (nt2doserr[i].nterr == eno) 9634bff34e3Sthurlow return (smb_maperror(nt2doserr[i].dclass, 9644bff34e3Sthurlow nt2doserr[i].derr)); 9654bff34e3Sthurlow return (smb_maperror(ERRHRD, ERRgeneral)); 9664bff34e3Sthurlow } 9674bff34e3Sthurlow 9684bff34e3Sthurlow 9694bff34e3Sthurlow int 9704bff34e3Sthurlow smb_maperror(int eclass, int eno) 9714bff34e3Sthurlow { 9724bff34e3Sthurlow if (eclass == 0 && eno == 0) 9734bff34e3Sthurlow return (0); 9744bff34e3Sthurlow switch (eclass) { 9754bff34e3Sthurlow case ERRDOS: 9764bff34e3Sthurlow switch (eno) { 9774bff34e3Sthurlow case ERRbadfunc: 9784bff34e3Sthurlow case ERRbadenv: 9794bff34e3Sthurlow case ERRbadformat: 9804bff34e3Sthurlow case ERRremcd: 9814bff34e3Sthurlow case ERRrmuns: 982*91d632c8Sgwr case ERRunknownlevel: 9834bff34e3Sthurlow return (EINVAL); 9844bff34e3Sthurlow case ERRbadfile: 9854bff34e3Sthurlow case ERRbadpath: 9864bff34e3Sthurlow case ERRnoipc: 9874bff34e3Sthurlow case ERRnosuchshare: 9884bff34e3Sthurlow return (ENOENT); 9894bff34e3Sthurlow case ERRnofids: 9904bff34e3Sthurlow return (EMFILE); 9914bff34e3Sthurlow case ERRnoaccess: 9924bff34e3Sthurlow /* 9934bff34e3Sthurlow * XXX CSM Reported on samba-technical 12/7/2002 9944bff34e3Sthurlow * 9954bff34e3Sthurlow * There is a case for which server(s) return 9964bff34e3Sthurlow * ERRnoaccess but should return ERRdiskfull: When 9974bff34e3Sthurlow * the offset for a write is exactly the server 9984bff34e3Sthurlow * file size limit then Samba (at least) thinks 9994bff34e3Sthurlow * the reason for zero bytes having been written 10004bff34e3Sthurlow * must have been "access denied" from the local 10014bff34e3Sthurlow * filesystem. This cannot be easily worked 10024bff34e3Sthurlow * around since the server behaviour is 10034bff34e3Sthurlow * indistinguishable from actual access denied. 10044bff34e3Sthurlow * An incomplete workaround: attempt a 2 byte write 10054bff34e3Sthurlow * from "offset-1". (That may require reading at 10064bff34e3Sthurlow * offset-1 first.) The flaw is that reading or 10074bff34e3Sthurlow * writing at offset-1 could cause an 10084bff34e3Sthurlow * unrelated error (due to a byte range lock 10094bff34e3Sthurlow * for instance) and we can't presume the 10104bff34e3Sthurlow * order servers check errors in. 10114bff34e3Sthurlow */ 10124bff34e3Sthurlow case ERRbadaccess: 10134bff34e3Sthurlow return (EACCES); 10144bff34e3Sthurlow case ERRbadshare: 10154bff34e3Sthurlow return (EBUSY); 10164bff34e3Sthurlow case ERRbadfid: 10174bff34e3Sthurlow return (EBADF); 10184bff34e3Sthurlow case ERRbadmcb: 10194bff34e3Sthurlow return (EIO); 10204bff34e3Sthurlow case ERRnomem: 10214bff34e3Sthurlow return (ENOMEM); /* actually remote no mem... */ 10224bff34e3Sthurlow case ERRbadmem: 10234bff34e3Sthurlow return (EFAULT); 10244bff34e3Sthurlow case ERRbaddata: 10254bff34e3Sthurlow return (E2BIG); 10264bff34e3Sthurlow case ERRbaddrive: 10274bff34e3Sthurlow case ERRnotready: /* nt */ 10284bff34e3Sthurlow return (ENXIO); 10294bff34e3Sthurlow case ERRdiffdevice: 10304bff34e3Sthurlow return (EXDEV); 10314bff34e3Sthurlow case ERRnofiles: 10324bff34e3Sthurlow return (0); /* eeof ? */ 10334bff34e3Sthurlow case ERRlock: 10344bff34e3Sthurlow return (EDEADLK); 10354bff34e3Sthurlow case ERRfilexists: 10364bff34e3Sthurlow return (EEXIST); 10374bff34e3Sthurlow case ERRinvalidname: /* samba maps as noent */ 10384bff34e3Sthurlow return (ENOENT); 10394bff34e3Sthurlow case ERRdirnotempty: /* samba */ 10404bff34e3Sthurlow return (ENOTEMPTY); 10414bff34e3Sthurlow case ERRnotlocked: 10424bff34e3Sthurlow return (0); /* 0 since bsd unlocks on any close */ 10434bff34e3Sthurlow case ERRrename: 10444bff34e3Sthurlow return (EEXIST); 10454bff34e3Sthurlow case ERRmoredata: 10464bff34e3Sthurlow return (EMOREDATA); 10474bff34e3Sthurlow } 10484bff34e3Sthurlow break; 10494bff34e3Sthurlow case ERRSRV: 10504bff34e3Sthurlow switch (eno) { 10514bff34e3Sthurlow case ERRerror: 10524bff34e3Sthurlow return (EINVAL); 10534bff34e3Sthurlow case ERRbadpw: 10544bff34e3Sthurlow return (EAUTH); 10554bff34e3Sthurlow case ERRaccess: 10564bff34e3Sthurlow case ERRbaduid: 10574bff34e3Sthurlow return (EACCES); 10584bff34e3Sthurlow case ERRinvnid: 10594bff34e3Sthurlow return (ENETRESET); 10604bff34e3Sthurlow case ERRinvnetname: 10614bff34e3Sthurlow SMBERROR("NetBIOS name is invalid: %d\n", 10624bff34e3Sthurlow ERRinvnetname); 10634bff34e3Sthurlow return (EAUTH); 10644bff34e3Sthurlow case ERRbadtype: /* reserved and returned */ 10654bff34e3Sthurlow return (EIO); 10664bff34e3Sthurlow case ERRacctexpired: /* NT: account exists but disabled */ 10674bff34e3Sthurlow return (EPERM); 10684bff34e3Sthurlow } 10694bff34e3Sthurlow break; 10704bff34e3Sthurlow case ERRHRD: 10714bff34e3Sthurlow switch (eno) { 10724bff34e3Sthurlow case ERRnowrite: 10734bff34e3Sthurlow return (EROFS); 10744bff34e3Sthurlow case ERRbadunit: 10754bff34e3Sthurlow return (ENODEV); 10764bff34e3Sthurlow case ERRbadreq: 10774bff34e3Sthurlow return (EBADRPC); 10784bff34e3Sthurlow case ERRbadshare: 10794bff34e3Sthurlow return (ETXTBSY); 10804bff34e3Sthurlow case ERRlock: 10814bff34e3Sthurlow return (EDEADLK); 10824bff34e3Sthurlow case ERRdiskfull: 10834bff34e3Sthurlow return (EFBIG); 10844bff34e3Sthurlow case ERRnotready: 10854bff34e3Sthurlow case ERRbadcmd: 10864bff34e3Sthurlow case ERRdata: 10874bff34e3Sthurlow case ERRgeneral: 10884bff34e3Sthurlow return (EIO); 10894bff34e3Sthurlow default: 10904bff34e3Sthurlow SMBERROR("Unmapped DOS error %d:%d\n", eclass, eno); 10914bff34e3Sthurlow return (EIO); 10924bff34e3Sthurlow } 10934bff34e3Sthurlow } 10944bff34e3Sthurlow SMBERROR("Unmapped DOS error %d:%d\n", eclass, eno); 10954bff34e3Sthurlow return (EBADRPC); 10964bff34e3Sthurlow } 10974bff34e3Sthurlow 10984bff34e3Sthurlow #if defined(NOICONVSUPPORT) || defined(lint) 10994bff34e3Sthurlow extern int iconv_conv(void *handle, const char **inbuf, 11004bff34e3Sthurlow size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 11014bff34e3Sthurlow #endif 11024bff34e3Sthurlow 11034bff34e3Sthurlow #define SMALL_CONV 256 11044bff34e3Sthurlow 11054bff34e3Sthurlow /*ARGSUSED*/ 11064bff34e3Sthurlow int 11074bff34e3Sthurlow smb_put_dmem(struct mbchain *mbp, struct smb_vc *vcp, const char *src, 11084bff34e3Sthurlow int size, int caseopt, int *lenp) 11094bff34e3Sthurlow { 11104bff34e3Sthurlow uint16_t convbuf[SMALL_CONV]; 11114bff34e3Sthurlow uint16_t *cbuf; 11124bff34e3Sthurlow size_t cbufalloc, inlen, outlen; 11134bff34e3Sthurlow int error; 11144bff34e3Sthurlow 11154bff34e3Sthurlow if (size <= 0) 11164bff34e3Sthurlow return (0); 11174bff34e3Sthurlow 11184bff34e3Sthurlow /* 11194bff34e3Sthurlow * Handle the easy case (non-unicode). 11204bff34e3Sthurlow * XXX: Technically, we should convert 11214bff34e3Sthurlow * the string to OEM codeset first... 11224bff34e3Sthurlow * Modern servers all use Unicode, so 11234bff34e3Sthurlow * this is good enough. 11244bff34e3Sthurlow */ 11254bff34e3Sthurlow if (SMB_UNICODE_STRINGS(vcp) == 0) { 11264bff34e3Sthurlow error = mb_put_mem(mbp, src, size, MB_MSYSTEM); 11274bff34e3Sthurlow if (!error && lenp) 11284bff34e3Sthurlow *lenp += size; 11294bff34e3Sthurlow return (error); 11304bff34e3Sthurlow } 11314bff34e3Sthurlow 11324bff34e3Sthurlow /* 11334bff34e3Sthurlow * Convert to UCS-2 (really UTF-16). 11344bff34e3Sthurlow * Use stack buffer if the string is 11354bff34e3Sthurlow * small enough, else allocate. 11364bff34e3Sthurlow */ 11374bff34e3Sthurlow if (size <= SMALL_CONV) { 11384bff34e3Sthurlow cbufalloc = 0; 11394bff34e3Sthurlow outlen = SMALL_CONV; 11404bff34e3Sthurlow cbuf = convbuf; 11414bff34e3Sthurlow } else { 11424bff34e3Sthurlow outlen = size; /* in utf-16 characters */ 11434bff34e3Sthurlow cbufalloc = outlen * 2; 11444bff34e3Sthurlow cbuf = kmem_alloc(cbufalloc, KM_SLEEP); 11454bff34e3Sthurlow } 11464bff34e3Sthurlow 11474bff34e3Sthurlow inlen = size; 11484bff34e3Sthurlow error = uconv_u8tou16((uchar_t *)src, &inlen, cbuf, &outlen, 11494bff34e3Sthurlow UCONV_OUT_LITTLE_ENDIAN | UCONV_IGNORE_NULL); 11504bff34e3Sthurlow outlen *= 2; /* convert to bytes */ 11514bff34e3Sthurlow 11524bff34e3Sthurlow if (!error) { 11534bff34e3Sthurlow (void) mb_put_padbyte(mbp); /* align */ 11544bff34e3Sthurlow error = mb_put_mem(mbp, (char *)cbuf, outlen, MB_MSYSTEM); 11554bff34e3Sthurlow } 11564bff34e3Sthurlow if (!error && lenp) 11574bff34e3Sthurlow *lenp += outlen; 11584bff34e3Sthurlow 11594bff34e3Sthurlow if (cbufalloc) 11604bff34e3Sthurlow kmem_free(cbuf, cbufalloc); 11614bff34e3Sthurlow 11624bff34e3Sthurlow return (error); 11634bff34e3Sthurlow } 11644bff34e3Sthurlow 11654bff34e3Sthurlow int 11664bff34e3Sthurlow smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp, const char *src, 11674bff34e3Sthurlow int caseopt) 11684bff34e3Sthurlow { 11694bff34e3Sthurlow int error, len; 11704bff34e3Sthurlow 11714bff34e3Sthurlow /* 11724bff34e3Sthurlow * Let smb_put_dmem put both the string 11734bff34e3Sthurlow * and the terminating null. 11744bff34e3Sthurlow */ 11754bff34e3Sthurlow len = strlen(src) + 1; 11764bff34e3Sthurlow error = smb_put_dmem(mbp, vcp, src, len, caseopt, NULL); 11774bff34e3Sthurlow if (error) 11784bff34e3Sthurlow return (error); 11794bff34e3Sthurlow 11804bff34e3Sthurlow return (error); 11814bff34e3Sthurlow } 1182