162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright (c) International Business Machines Corp., 2002,2008 562306a36Sopenharmony_ci * Author(s): Steve French (sfrench@us.ibm.com) 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Error mapping routines from Samba libsmb/errormap.c 862306a36Sopenharmony_ci * Copyright (C) Andrew Tridgell 2001 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/net.h> 1262306a36Sopenharmony_ci#include <linux/string.h> 1362306a36Sopenharmony_ci#include <linux/in.h> 1462306a36Sopenharmony_ci#include <linux/ctype.h> 1562306a36Sopenharmony_ci#include <linux/fs.h> 1662306a36Sopenharmony_ci#include <asm/div64.h> 1762306a36Sopenharmony_ci#include <asm/byteorder.h> 1862306a36Sopenharmony_ci#include <linux/inet.h> 1962306a36Sopenharmony_ci#include "cifsfs.h" 2062306a36Sopenharmony_ci#include "cifspdu.h" 2162306a36Sopenharmony_ci#include "cifsglob.h" 2262306a36Sopenharmony_ci#include "cifsproto.h" 2362306a36Sopenharmony_ci#include "smberr.h" 2462306a36Sopenharmony_ci#include "cifs_debug.h" 2562306a36Sopenharmony_ci#include "nterr.h" 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_cistruct smb_to_posix_error { 2862306a36Sopenharmony_ci __u16 smb_err; 2962306a36Sopenharmony_ci int posix_code; 3062306a36Sopenharmony_ci}; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_cistatic const struct smb_to_posix_error mapping_table_ERRDOS[] = { 3362306a36Sopenharmony_ci {ERRbadfunc, -EINVAL}, 3462306a36Sopenharmony_ci {ERRbadfile, -ENOENT}, 3562306a36Sopenharmony_ci {ERRbadpath, -ENOTDIR}, 3662306a36Sopenharmony_ci {ERRnofids, -EMFILE}, 3762306a36Sopenharmony_ci {ERRnoaccess, -EACCES}, 3862306a36Sopenharmony_ci {ERRbadfid, -EBADF}, 3962306a36Sopenharmony_ci {ERRbadmcb, -EIO}, 4062306a36Sopenharmony_ci {ERRnomem, -EREMOTEIO}, 4162306a36Sopenharmony_ci {ERRbadmem, -EFAULT}, 4262306a36Sopenharmony_ci {ERRbadenv, -EFAULT}, 4362306a36Sopenharmony_ci {ERRbadformat, -EINVAL}, 4462306a36Sopenharmony_ci {ERRbadaccess, -EACCES}, 4562306a36Sopenharmony_ci {ERRbaddata, -EIO}, 4662306a36Sopenharmony_ci {ERRbaddrive, -ENXIO}, 4762306a36Sopenharmony_ci {ERRremcd, -EACCES}, 4862306a36Sopenharmony_ci {ERRdiffdevice, -EXDEV}, 4962306a36Sopenharmony_ci {ERRnofiles, -ENOENT}, 5062306a36Sopenharmony_ci {ERRwriteprot, -EROFS}, 5162306a36Sopenharmony_ci {ERRbadshare, -EBUSY}, 5262306a36Sopenharmony_ci {ERRlock, -EACCES}, 5362306a36Sopenharmony_ci {ERRunsup, -EINVAL}, 5462306a36Sopenharmony_ci {ERRnosuchshare, -ENXIO}, 5562306a36Sopenharmony_ci {ERRfilexists, -EEXIST}, 5662306a36Sopenharmony_ci {ERRinvparm, -EINVAL}, 5762306a36Sopenharmony_ci {ERRdiskfull, -ENOSPC}, 5862306a36Sopenharmony_ci {ERRinvname, -ENOENT}, 5962306a36Sopenharmony_ci {ERRinvlevel, -EOPNOTSUPP}, 6062306a36Sopenharmony_ci {ERRdirnotempty, -ENOTEMPTY}, 6162306a36Sopenharmony_ci {ERRnotlocked, -ENOLCK}, 6262306a36Sopenharmony_ci {ERRcancelviolation, -ENOLCK}, 6362306a36Sopenharmony_ci {ERRalreadyexists, -EEXIST}, 6462306a36Sopenharmony_ci {ERRmoredata, -EOVERFLOW}, 6562306a36Sopenharmony_ci {ERReasnotsupported, -EOPNOTSUPP}, 6662306a36Sopenharmony_ci {ErrQuota, -EDQUOT}, 6762306a36Sopenharmony_ci {ErrNotALink, -ENOLINK}, 6862306a36Sopenharmony_ci {ERRnetlogonNotStarted, -ENOPROTOOPT}, 6962306a36Sopenharmony_ci {ERRsymlink, -EOPNOTSUPP}, 7062306a36Sopenharmony_ci {ErrTooManyLinks, -EMLINK}, 7162306a36Sopenharmony_ci {0, 0} 7262306a36Sopenharmony_ci}; 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_cistatic const struct smb_to_posix_error mapping_table_ERRSRV[] = { 7562306a36Sopenharmony_ci {ERRerror, -EIO}, 7662306a36Sopenharmony_ci {ERRbadpw, -EACCES}, /* was EPERM */ 7762306a36Sopenharmony_ci {ERRbadtype, -EREMOTE}, 7862306a36Sopenharmony_ci {ERRaccess, -EACCES}, 7962306a36Sopenharmony_ci {ERRinvtid, -ENXIO}, 8062306a36Sopenharmony_ci {ERRinvnetname, -ENXIO}, 8162306a36Sopenharmony_ci {ERRinvdevice, -ENXIO}, 8262306a36Sopenharmony_ci {ERRqfull, -ENOSPC}, 8362306a36Sopenharmony_ci {ERRqtoobig, -ENOSPC}, 8462306a36Sopenharmony_ci {ERRqeof, -EIO}, 8562306a36Sopenharmony_ci {ERRinvpfid, -EBADF}, 8662306a36Sopenharmony_ci {ERRsmbcmd, -EBADRQC}, 8762306a36Sopenharmony_ci {ERRsrverror, -EIO}, 8862306a36Sopenharmony_ci {ERRbadBID, -EIO}, 8962306a36Sopenharmony_ci {ERRfilespecs, -EINVAL}, 9062306a36Sopenharmony_ci {ERRbadLink, -EIO}, 9162306a36Sopenharmony_ci {ERRbadpermits, -EINVAL}, 9262306a36Sopenharmony_ci {ERRbadPID, -ESRCH}, 9362306a36Sopenharmony_ci {ERRsetattrmode, -EINVAL}, 9462306a36Sopenharmony_ci {ERRpaused, -EHOSTDOWN}, 9562306a36Sopenharmony_ci {ERRmsgoff, -EHOSTDOWN}, 9662306a36Sopenharmony_ci {ERRnoroom, -ENOSPC}, 9762306a36Sopenharmony_ci {ERRrmuns, -EUSERS}, 9862306a36Sopenharmony_ci {ERRtimeout, -ETIME}, 9962306a36Sopenharmony_ci {ERRnoresource, -EREMOTEIO}, 10062306a36Sopenharmony_ci {ERRtoomanyuids, -EUSERS}, 10162306a36Sopenharmony_ci {ERRbaduid, -EACCES}, 10262306a36Sopenharmony_ci {ERRusempx, -EIO}, 10362306a36Sopenharmony_ci {ERRusestd, -EIO}, 10462306a36Sopenharmony_ci {ERR_NOTIFY_ENUM_DIR, -ENOBUFS}, 10562306a36Sopenharmony_ci {ERRnoSuchUser, -EACCES}, 10662306a36Sopenharmony_ci/* {ERRaccountexpired, -EACCES}, 10762306a36Sopenharmony_ci {ERRbadclient, -EACCES}, 10862306a36Sopenharmony_ci {ERRbadLogonTime, -EACCES}, 10962306a36Sopenharmony_ci {ERRpasswordExpired, -EACCES},*/ 11062306a36Sopenharmony_ci {ERRaccountexpired, -EKEYEXPIRED}, 11162306a36Sopenharmony_ci {ERRbadclient, -EACCES}, 11262306a36Sopenharmony_ci {ERRbadLogonTime, -EACCES}, 11362306a36Sopenharmony_ci {ERRpasswordExpired, -EKEYEXPIRED}, 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci {ERRnosupport, -EINVAL}, 11662306a36Sopenharmony_ci {0, 0} 11762306a36Sopenharmony_ci}; 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci/* 12062306a36Sopenharmony_ci * Convert a string containing text IPv4 or IPv6 address to binary form. 12162306a36Sopenharmony_ci * 12262306a36Sopenharmony_ci * Returns 0 on failure. 12362306a36Sopenharmony_ci */ 12462306a36Sopenharmony_cistatic int 12562306a36Sopenharmony_cicifs_inet_pton(const int address_family, const char *cp, int len, void *dst) 12662306a36Sopenharmony_ci{ 12762306a36Sopenharmony_ci int ret = 0; 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci /* calculate length by finding first slash or NULL */ 13062306a36Sopenharmony_ci if (address_family == AF_INET) 13162306a36Sopenharmony_ci ret = in4_pton(cp, len, dst, '\\', NULL); 13262306a36Sopenharmony_ci else if (address_family == AF_INET6) 13362306a36Sopenharmony_ci ret = in6_pton(cp, len, dst , '\\', NULL); 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci cifs_dbg(NOISY, "address conversion returned %d for %*.*s\n", 13662306a36Sopenharmony_ci ret, len, len, cp); 13762306a36Sopenharmony_ci if (ret > 0) 13862306a36Sopenharmony_ci ret = 1; 13962306a36Sopenharmony_ci return ret; 14062306a36Sopenharmony_ci} 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci/* 14362306a36Sopenharmony_ci * Try to convert a string to an IPv4 address and then attempt to convert 14462306a36Sopenharmony_ci * it to an IPv6 address if that fails. Set the family field if either 14562306a36Sopenharmony_ci * succeeds. If it's an IPv6 address and it has a '%' sign in it, try to 14662306a36Sopenharmony_ci * treat the part following it as a numeric sin6_scope_id. 14762306a36Sopenharmony_ci * 14862306a36Sopenharmony_ci * Returns 0 on failure. 14962306a36Sopenharmony_ci */ 15062306a36Sopenharmony_ciint 15162306a36Sopenharmony_cicifs_convert_address(struct sockaddr *dst, const char *src, int len) 15262306a36Sopenharmony_ci{ 15362306a36Sopenharmony_ci int rc, alen, slen; 15462306a36Sopenharmony_ci const char *pct; 15562306a36Sopenharmony_ci char scope_id[13]; 15662306a36Sopenharmony_ci struct sockaddr_in *s4 = (struct sockaddr_in *) dst; 15762306a36Sopenharmony_ci struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) dst; 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_ci /* IPv4 address */ 16062306a36Sopenharmony_ci if (cifs_inet_pton(AF_INET, src, len, &s4->sin_addr.s_addr)) { 16162306a36Sopenharmony_ci s4->sin_family = AF_INET; 16262306a36Sopenharmony_ci return 1; 16362306a36Sopenharmony_ci } 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci /* attempt to exclude the scope ID from the address part */ 16662306a36Sopenharmony_ci pct = memchr(src, '%', len); 16762306a36Sopenharmony_ci alen = pct ? pct - src : len; 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci rc = cifs_inet_pton(AF_INET6, src, alen, &s6->sin6_addr.s6_addr); 17062306a36Sopenharmony_ci if (!rc) 17162306a36Sopenharmony_ci return rc; 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci s6->sin6_family = AF_INET6; 17462306a36Sopenharmony_ci if (pct) { 17562306a36Sopenharmony_ci /* grab the scope ID */ 17662306a36Sopenharmony_ci slen = len - (alen + 1); 17762306a36Sopenharmony_ci if (slen <= 0 || slen > 12) 17862306a36Sopenharmony_ci return 0; 17962306a36Sopenharmony_ci memcpy(scope_id, pct + 1, slen); 18062306a36Sopenharmony_ci scope_id[slen] = '\0'; 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci rc = kstrtouint(scope_id, 0, &s6->sin6_scope_id); 18362306a36Sopenharmony_ci rc = (rc == 0) ? 1 : 0; 18462306a36Sopenharmony_ci } 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci return rc; 18762306a36Sopenharmony_ci} 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_civoid 19062306a36Sopenharmony_cicifs_set_port(struct sockaddr *addr, const unsigned short int port) 19162306a36Sopenharmony_ci{ 19262306a36Sopenharmony_ci switch (addr->sa_family) { 19362306a36Sopenharmony_ci case AF_INET: 19462306a36Sopenharmony_ci ((struct sockaddr_in *)addr)->sin_port = htons(port); 19562306a36Sopenharmony_ci break; 19662306a36Sopenharmony_ci case AF_INET6: 19762306a36Sopenharmony_ci ((struct sockaddr_in6 *)addr)->sin6_port = htons(port); 19862306a36Sopenharmony_ci break; 19962306a36Sopenharmony_ci } 20062306a36Sopenharmony_ci} 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci/***************************************************************************** 20362306a36Sopenharmony_ciconvert a NT status code to a dos class/code 20462306a36Sopenharmony_ci *****************************************************************************/ 20562306a36Sopenharmony_ci/* NT status -> dos error map */ 20662306a36Sopenharmony_cistatic const struct { 20762306a36Sopenharmony_ci __u8 dos_class; 20862306a36Sopenharmony_ci __u16 dos_code; 20962306a36Sopenharmony_ci __u32 ntstatus; 21062306a36Sopenharmony_ci} ntstatus_to_dos_map[] = { 21162306a36Sopenharmony_ci { 21262306a36Sopenharmony_ci ERRDOS, ERRgeneral, NT_STATUS_UNSUCCESSFUL}, { 21362306a36Sopenharmony_ci ERRDOS, ERRbadfunc, NT_STATUS_NOT_IMPLEMENTED}, { 21462306a36Sopenharmony_ci ERRDOS, ERRinvlevel, NT_STATUS_INVALID_INFO_CLASS}, { 21562306a36Sopenharmony_ci ERRDOS, 24, NT_STATUS_INFO_LENGTH_MISMATCH}, { 21662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ACCESS_VIOLATION}, { 21762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_IN_PAGE_ERROR}, { 21862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA}, { 21962306a36Sopenharmony_ci ERRDOS, ERRbadfid, NT_STATUS_INVALID_HANDLE}, { 22062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_INITIAL_STACK}, { 22162306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_BAD_INITIAL_PC}, { 22262306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_CID}, { 22362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TIMER_NOT_CANCELED}, { 22462306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER}, { 22562306a36Sopenharmony_ci ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_DEVICE}, { 22662306a36Sopenharmony_ci ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_FILE}, { 22762306a36Sopenharmony_ci ERRDOS, ERRbadfunc, NT_STATUS_INVALID_DEVICE_REQUEST}, { 22862306a36Sopenharmony_ci ERRDOS, 38, NT_STATUS_END_OF_FILE}, { 22962306a36Sopenharmony_ci ERRDOS, 34, NT_STATUS_WRONG_VOLUME}, { 23062306a36Sopenharmony_ci ERRDOS, 21, NT_STATUS_NO_MEDIA_IN_DEVICE}, { 23162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, { 23262306a36Sopenharmony_ci ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR}, 23362306a36Sopenharmony_ci/* { This NT error code was 'sqashed' 23462306a36Sopenharmony_ci from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK 23562306a36Sopenharmony_ci during the session setup } */ 23662306a36Sopenharmony_ci { 23762306a36Sopenharmony_ci ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, { 23862306a36Sopenharmony_ci ERRDOS, 487, NT_STATUS_CONFLICTING_ADDRESSES}, { 23962306a36Sopenharmony_ci ERRDOS, 487, NT_STATUS_NOT_MAPPED_VIEW}, { 24062306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_UNABLE_TO_FREE_VM}, { 24162306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_UNABLE_TO_DELETE_SECTION}, { 24262306a36Sopenharmony_ci ERRDOS, 2142, NT_STATUS_INVALID_SYSTEM_SERVICE}, { 24362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_INSTRUCTION}, { 24462306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, { 24562306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_INVALID_VIEW_SIZE}, { 24662306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, { 24762306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED}, 24862306a36Sopenharmony_ci/* { This NT error code was 'sqashed' 24962306a36Sopenharmony_ci from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE 25062306a36Sopenharmony_ci during the session setup } */ 25162306a36Sopenharmony_ci { 25262306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, { 25362306a36Sopenharmony_ci ERRDOS, 111, NT_STATUS_BUFFER_TOO_SMALL}, { 25462306a36Sopenharmony_ci ERRDOS, ERRbadfid, NT_STATUS_OBJECT_TYPE_MISMATCH}, { 25562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NONCONTINUABLE_EXCEPTION}, { 25662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_DISPOSITION}, { 25762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNWIND}, { 25862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_STACK}, { 25962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_UNWIND_TARGET}, { 26062306a36Sopenharmony_ci ERRDOS, 158, NT_STATUS_NOT_LOCKED}, { 26162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PARITY_ERROR}, { 26262306a36Sopenharmony_ci ERRDOS, 487, NT_STATUS_UNABLE_TO_DECOMMIT_VM}, { 26362306a36Sopenharmony_ci ERRDOS, 487, NT_STATUS_NOT_COMMITTED}, { 26462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_PORT_ATTRIBUTES}, { 26562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PORT_MESSAGE_TOO_LONG}, { 26662306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, { 26762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, { 26862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, { 26962306a36Sopenharmony_ci /* mapping changed since shell does lookup on * expects FileNotFound */ 27062306a36Sopenharmony_ci ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, { 27162306a36Sopenharmony_ci ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, { 27262306a36Sopenharmony_ci ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, { 27362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, { 27462306a36Sopenharmony_ci ERRDOS, ERRbadfid, NT_STATUS_PORT_DISCONNECTED}, { 27562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DEVICE_ALREADY_ATTACHED}, { 27662306a36Sopenharmony_ci ERRDOS, 161, NT_STATUS_OBJECT_PATH_INVALID}, { 27762306a36Sopenharmony_ci ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND}, { 27862306a36Sopenharmony_ci ERRDOS, 161, NT_STATUS_OBJECT_PATH_SYNTAX_BAD}, { 27962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DATA_OVERRUN}, { 28062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DATA_LATE_ERROR}, { 28162306a36Sopenharmony_ci ERRDOS, 23, NT_STATUS_DATA_ERROR}, { 28262306a36Sopenharmony_ci ERRDOS, 23, NT_STATUS_CRC_ERROR}, { 28362306a36Sopenharmony_ci ERRDOS, ERRnomem, NT_STATUS_SECTION_TOO_BIG}, { 28462306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_PORT_CONNECTION_REFUSED}, { 28562306a36Sopenharmony_ci ERRDOS, ERRbadfid, NT_STATUS_INVALID_PORT_HANDLE}, { 28662306a36Sopenharmony_ci ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION}, { 28762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_QUOTA_EXCEEDED}, { 28862306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PAGE_PROTECTION}, { 28962306a36Sopenharmony_ci ERRDOS, 288, NT_STATUS_MUTANT_NOT_OWNED}, { 29062306a36Sopenharmony_ci ERRDOS, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED}, { 29162306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_PORT_ALREADY_SET}, { 29262306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_SECTION_NOT_IMAGE}, { 29362306a36Sopenharmony_ci ERRDOS, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED}, { 29462306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_THREAD_IS_TERMINATING}, { 29562306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_BAD_WORKING_SET_LIMIT}, { 29662306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INCOMPATIBLE_FILE_MAP}, { 29762306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_SECTION_PROTECTION}, { 29862306a36Sopenharmony_ci ERRDOS, ERReasnotsupported, NT_STATUS_EAS_NOT_SUPPORTED}, { 29962306a36Sopenharmony_ci ERRDOS, 255, NT_STATUS_EA_TOO_LARGE}, { 30062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NONEXISTENT_EA_ENTRY}, { 30162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_EAS_ON_FILE}, { 30262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_EA_CORRUPT_ERROR}, { 30362306a36Sopenharmony_ci ERRDOS, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT}, { 30462306a36Sopenharmony_ci ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED}, { 30562306a36Sopenharmony_ci ERRDOS, ERRbadfile, NT_STATUS_DELETE_PENDING}, { 30662306a36Sopenharmony_ci ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, { 30762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, { 30862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, { 30962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, { 31062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, { 31162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, { 31262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, { 31362306a36Sopenharmony_ci ERRDOS, 2215, NT_STATUS_NO_LOGON_SERVERS}, { 31462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_LOGON_SESSION}, { 31562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PRIVILEGE}, { 31662306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_PRIVILEGE_NOT_HELD}, { 31762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, { 31862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS}, 31962306a36Sopenharmony_ci/* { This NT error code was 'sqashed' 32062306a36Sopenharmony_ci from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE 32162306a36Sopenharmony_ci during the session setup } */ 32262306a36Sopenharmony_ci { 32362306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { /* could map to 2238 */ 32462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, { 32562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, { 32662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, { 32762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, { 32862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN}, 32962306a36Sopenharmony_ci/* { This NT error code was 'sqashed' 33062306a36Sopenharmony_ci from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE 33162306a36Sopenharmony_ci during the session setup } */ 33262306a36Sopenharmony_ci { 33362306a36Sopenharmony_ci ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, { 33462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_PASSWORD}, { 33562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, { 33662306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, { 33762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { 33862306a36Sopenharmony_ci ERRSRV, ERRbadLogonTime, NT_STATUS_INVALID_LOGON_HOURS}, { 33962306a36Sopenharmony_ci ERRSRV, ERRbadclient, NT_STATUS_INVALID_WORKSTATION}, { 34062306a36Sopenharmony_ci ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, { 34162306a36Sopenharmony_ci ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_DISABLED}, { 34262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { 34362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { 34462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, { 34562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_SUB_AUTHORITY}, { 34662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACL}, { 34762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_SID}, { 34862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_SECURITY_DESCR}, { 34962306a36Sopenharmony_ci ERRDOS, 127, NT_STATUS_PROCEDURE_NOT_FOUND}, { 35062306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_INVALID_IMAGE_FORMAT}, { 35162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_TOKEN}, { 35262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_INHERITANCE_ACL}, { 35362306a36Sopenharmony_ci ERRDOS, 158, NT_STATUS_RANGE_NOT_LOCKED}, { 35462306a36Sopenharmony_ci ERRDOS, 112, NT_STATUS_DISK_FULL}, { 35562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SERVER_DISABLED}, { 35662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SERVER_NOT_DISABLED}, { 35762306a36Sopenharmony_ci ERRDOS, 68, NT_STATUS_TOO_MANY_GUIDS_REQUESTED}, { 35862306a36Sopenharmony_ci ERRDOS, 259, NT_STATUS_GUIDS_EXHAUSTED}, { 35962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_ID_AUTHORITY}, { 36062306a36Sopenharmony_ci ERRDOS, 259, NT_STATUS_AGENTS_EXHAUSTED}, { 36162306a36Sopenharmony_ci ERRDOS, 154, NT_STATUS_INVALID_VOLUME_LABEL}, { 36262306a36Sopenharmony_ci ERRDOS, 14, NT_STATUS_SECTION_NOT_EXTENDED}, { 36362306a36Sopenharmony_ci ERRDOS, 487, NT_STATUS_NOT_MAPPED_DATA}, { 36462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_DATA_NOT_FOUND}, { 36562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_TYPE_NOT_FOUND}, { 36662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_NAME_NOT_FOUND}, { 36762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ARRAY_BOUNDS_EXCEEDED}, { 36862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DENORMAL_OPERAND}, { 36962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DIVIDE_BY_ZERO}, { 37062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INEXACT_RESULT}, { 37162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INVALID_OPERATION}, { 37262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOAT_OVERFLOW}, { 37362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOAT_STACK_CHECK}, { 37462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOAT_UNDERFLOW}, { 37562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INTEGER_DIVIDE_BY_ZERO}, { 37662306a36Sopenharmony_ci ERRDOS, 534, NT_STATUS_INTEGER_OVERFLOW}, { 37762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PRIVILEGED_INSTRUCTION}, { 37862306a36Sopenharmony_ci ERRDOS, ERRnomem, NT_STATUS_TOO_MANY_PAGING_FILES}, { 37962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, { 38062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, 38162306a36Sopenharmony_ci/* { This NT error code was 'sqashed' 38262306a36Sopenharmony_ci from NT_STATUS_INSUFFICIENT_RESOURCES to 38362306a36Sopenharmony_ci NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */ 38462306a36Sopenharmony_ci { 38562306a36Sopenharmony_ci ERRDOS, ERRnoresource, NT_STATUS_INSUFFICIENT_RESOURCES}, { 38662306a36Sopenharmony_ci ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, { 38762306a36Sopenharmony_ci ERRDOS, 23, NT_STATUS_DEVICE_DATA_ERROR}, { 38862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_CONNECTED}, { 38962306a36Sopenharmony_ci ERRDOS, 21, NT_STATUS_DEVICE_POWER_FAILURE}, { 39062306a36Sopenharmony_ci ERRDOS, 487, NT_STATUS_FREE_VM_NOT_AT_BASE}, { 39162306a36Sopenharmony_ci ERRDOS, 487, NT_STATUS_MEMORY_NOT_ALLOCATED}, { 39262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_WORKING_SET_QUOTA}, { 39362306a36Sopenharmony_ci ERRDOS, 19, NT_STATUS_MEDIA_WRITE_PROTECTED}, { 39462306a36Sopenharmony_ci ERRDOS, 21, NT_STATUS_DEVICE_NOT_READY}, { 39562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_GROUP_ATTRIBUTES}, { 39662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_IMPERSONATION_LEVEL}, { 39762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANT_OPEN_ANONYMOUS}, { 39862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_VALIDATION_CLASS}, { 39962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_TOKEN_TYPE}, { 40062306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_BAD_MASTER_BOOT_RECORD}, { 40162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INSTRUCTION_MISALIGNMENT}, { 40262306a36Sopenharmony_ci ERRDOS, ERRpipebusy, NT_STATUS_INSTANCE_NOT_AVAILABLE}, { 40362306a36Sopenharmony_ci ERRDOS, ERRpipebusy, NT_STATUS_PIPE_NOT_AVAILABLE}, { 40462306a36Sopenharmony_ci ERRDOS, ERRbadpipe, NT_STATUS_INVALID_PIPE_STATE}, { 40562306a36Sopenharmony_ci ERRDOS, ERRpipebusy, NT_STATUS_PIPE_BUSY}, { 40662306a36Sopenharmony_ci ERRDOS, ERRbadfunc, NT_STATUS_ILLEGAL_FUNCTION}, { 40762306a36Sopenharmony_ci ERRDOS, ERRnotconnected, NT_STATUS_PIPE_DISCONNECTED}, { 40862306a36Sopenharmony_ci ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_CLOSING}, { 40962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PIPE_CONNECTED}, { 41062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PIPE_LISTENING}, { 41162306a36Sopenharmony_ci ERRDOS, ERRbadpipe, NT_STATUS_INVALID_READ_MODE}, { 41262306a36Sopenharmony_ci ERRDOS, 121, NT_STATUS_IO_TIMEOUT}, { 41362306a36Sopenharmony_ci ERRDOS, 38, NT_STATUS_FILE_FORCED_CLOSED}, { 41462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STARTED}, { 41562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STOPPED}, { 41662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_COULD_NOT_INTERPRET}, { 41762306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY}, { 41862306a36Sopenharmony_ci ERRDOS, ERRunsup, NT_STATUS_NOT_SUPPORTED}, { 41962306a36Sopenharmony_ci ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING}, { 42062306a36Sopenharmony_ci ERRDOS, 52, NT_STATUS_DUPLICATE_NAME}, { 42162306a36Sopenharmony_ci ERRDOS, 53, NT_STATUS_BAD_NETWORK_PATH}, { 42262306a36Sopenharmony_ci ERRDOS, 54, NT_STATUS_NETWORK_BUSY}, { 42362306a36Sopenharmony_ci ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST}, { 42462306a36Sopenharmony_ci ERRDOS, 56, NT_STATUS_TOO_MANY_COMMANDS}, { 42562306a36Sopenharmony_ci ERRDOS, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR}, { 42662306a36Sopenharmony_ci ERRDOS, 58, NT_STATUS_INVALID_NETWORK_RESPONSE}, { 42762306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR}, { 42862306a36Sopenharmony_ci ERRDOS, 60, NT_STATUS_BAD_REMOTE_ADAPTER}, { 42962306a36Sopenharmony_ci ERRDOS, 61, NT_STATUS_PRINT_QUEUE_FULL}, { 43062306a36Sopenharmony_ci ERRDOS, 62, NT_STATUS_NO_SPOOL_SPACE}, { 43162306a36Sopenharmony_ci ERRDOS, 63, NT_STATUS_PRINT_CANCELLED}, { 43262306a36Sopenharmony_ci ERRDOS, 64, NT_STATUS_NETWORK_NAME_DELETED}, { 43362306a36Sopenharmony_ci ERRDOS, 65, NT_STATUS_NETWORK_ACCESS_DENIED}, { 43462306a36Sopenharmony_ci ERRDOS, 66, NT_STATUS_BAD_DEVICE_TYPE}, { 43562306a36Sopenharmony_ci ERRDOS, ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME}, { 43662306a36Sopenharmony_ci ERRDOS, 68, NT_STATUS_TOO_MANY_NAMES}, { 43762306a36Sopenharmony_ci ERRDOS, 69, NT_STATUS_TOO_MANY_SESSIONS}, { 43862306a36Sopenharmony_ci ERRDOS, 70, NT_STATUS_SHARING_PAUSED}, { 43962306a36Sopenharmony_ci ERRDOS, 71, NT_STATUS_REQUEST_NOT_ACCEPTED}, { 44062306a36Sopenharmony_ci ERRDOS, 72, NT_STATUS_REDIRECTOR_PAUSED}, { 44162306a36Sopenharmony_ci ERRDOS, 88, NT_STATUS_NET_WRITE_FAULT}, { 44262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PROFILING_AT_LIMIT}, { 44362306a36Sopenharmony_ci ERRDOS, ERRdiffdevice, NT_STATUS_NOT_SAME_DEVICE}, { 44462306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_FILE_RENAMED}, { 44562306a36Sopenharmony_ci ERRDOS, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED}, { 44662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SECURITY_ON_OBJECT}, { 44762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANT_WAIT}, { 44862306a36Sopenharmony_ci ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_EMPTY}, { 44962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANT_ACCESS_DOMAIN_INFO}, { 45062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANT_TERMINATE_SELF}, { 45162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_SERVER_STATE}, { 45262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_STATE}, { 45362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_ROLE}, { 45462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_DOMAIN}, { 45562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_EXISTS}, { 45662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_LIMIT_EXCEEDED}, { 45762306a36Sopenharmony_ci ERRDOS, 300, NT_STATUS_OPLOCK_NOT_GRANTED}, { 45862306a36Sopenharmony_ci ERRDOS, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL}, { 45962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_CORRUPTION}, { 46062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_ERROR}, { 46162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_GENERIC_NOT_MAPPED}, { 46262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_DESCRIPTOR_FORMAT}, { 46362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_USER_BUFFER}, { 46462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_IO_ERROR}, { 46562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_CREATE_ERR}, { 46662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_MAP_ERROR}, { 46762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_EXTEND_ERR}, { 46862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NOT_LOGON_PROCESS}, { 46962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_EXISTS}, { 47062306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_1}, { 47162306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_2}, { 47262306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_3}, { 47362306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_4}, { 47462306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_5}, { 47562306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_6}, { 47662306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_7}, { 47762306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_8}, { 47862306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_9}, { 47962306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_10}, { 48062306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_11}, { 48162306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_12}, { 48262306a36Sopenharmony_ci ERRDOS, ERRbadpath, NT_STATUS_REDIRECTOR_NOT_STARTED}, { 48362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REDIRECTOR_STARTED}, { 48462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW}, { 48562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PACKAGE}, { 48662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_FUNCTION_TABLE}, { 48762306a36Sopenharmony_ci ERRDOS, 203, 0xc0000100}, { 48862306a36Sopenharmony_ci ERRDOS, 145, NT_STATUS_DIRECTORY_NOT_EMPTY}, { 48962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FILE_CORRUPT_ERROR}, { 49062306a36Sopenharmony_ci ERRDOS, 267, NT_STATUS_NOT_A_DIRECTORY}, { 49162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_LOGON_SESSION_STATE}, { 49262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_COLLISION}, { 49362306a36Sopenharmony_ci ERRDOS, 206, NT_STATUS_NAME_TOO_LONG}, { 49462306a36Sopenharmony_ci ERRDOS, 2401, NT_STATUS_FILES_OPEN}, { 49562306a36Sopenharmony_ci ERRDOS, 2404, NT_STATUS_CONNECTION_IN_USE}, { 49662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MESSAGE_NOT_FOUND}, { 49762306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_PROCESS_IS_TERMINATING}, { 49862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_LOGON_TYPE}, { 49962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_GUID_TRANSLATION}, { 50062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANNOT_IMPERSONATE}, { 50162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_IMAGE_ALREADY_LOADED}, { 50262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_PRESENT}, { 50362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_NOT_EXIST}, { 50462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_ALREADY_OWNED}, { 50562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_LID_OWNER}, { 50662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_COMMAND}, { 50762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_LID}, { 50862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE}, { 50962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_SELECTOR}, { 51062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_LDT}, { 51162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_SIZE}, { 51262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_OFFSET}, { 51362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_DESCRIPTOR}, { 51462306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NE_FORMAT}, { 51562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RXACT_INVALID_STATE}, { 51662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RXACT_COMMIT_FAILURE}, { 51762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MAPPED_FILE_SIZE_ZERO}, { 51862306a36Sopenharmony_ci ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES}, { 51962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANCELLED}, { 52062306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_CANNOT_DELETE}, { 52162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_COMPUTER_NAME}, { 52262306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_FILE_DELETED}, { 52362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_ACCOUNT}, { 52462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_GROUP}, { 52562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_USER}, { 52662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MEMBERS_PRIMARY_GROUP}, { 52762306a36Sopenharmony_ci ERRDOS, ERRbadfid, NT_STATUS_FILE_CLOSED}, { 52862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_THREADS}, { 52962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_THREAD_NOT_IN_PROCESS}, { 53062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TOKEN_ALREADY_IN_USE}, { 53162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA_EXCEEDED}, { 53262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_COMMITMENT_LIMIT}, { 53362306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_INVALID_IMAGE_LE_FORMAT}, { 53462306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NOT_MZ}, { 53562306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_INVALID_IMAGE_PROTECT}, { 53662306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_INVALID_IMAGE_WIN_16}, { 53762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOGON_SERVER_CONFLICT}, { 53862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TIME_DIFFERENCE_AT_DC}, { 53962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SYNCHRONIZATION_REQUIRED}, { 54062306a36Sopenharmony_ci ERRDOS, 126, NT_STATUS_DLL_NOT_FOUND}, { 54162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_OPEN_FAILED}, { 54262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_IO_PRIVILEGE_FAILED}, { 54362306a36Sopenharmony_ci ERRDOS, 182, NT_STATUS_ORDINAL_NOT_FOUND}, { 54462306a36Sopenharmony_ci ERRDOS, 127, NT_STATUS_ENTRYPOINT_NOT_FOUND}, { 54562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CONTROL_C_EXIT}, { 54662306a36Sopenharmony_ci ERRDOS, 64, NT_STATUS_LOCAL_DISCONNECT}, { 54762306a36Sopenharmony_ci ERRDOS, 64, NT_STATUS_REMOTE_DISCONNECT}, { 54862306a36Sopenharmony_ci ERRDOS, 51, NT_STATUS_REMOTE_RESOURCES}, { 54962306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_LINK_FAILED}, { 55062306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_LINK_TIMEOUT}, { 55162306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_INVALID_CONNECTION}, { 55262306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_INVALID_ADDRESS}, { 55362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DLL_INIT_FAILED}, { 55462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MISSING_SYSTEMFILE}, { 55562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNHANDLED_EXCEPTION}, { 55662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_APP_INIT_FAILURE}, { 55762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_CREATE_FAILED}, { 55862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_PAGEFILE}, { 55962306a36Sopenharmony_ci ERRDOS, 124, NT_STATUS_INVALID_LEVEL}, { 56062306a36Sopenharmony_ci ERRDOS, 86, NT_STATUS_WRONG_PASSWORD_CORE}, { 56162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_FLOAT_CONTEXT}, { 56262306a36Sopenharmony_ci ERRDOS, 109, NT_STATUS_PIPE_BROKEN}, { 56362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_CORRUPT}, { 56462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_IO_FAILED}, { 56562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_EVENT_PAIR}, { 56662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_VOLUME}, { 56762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SERIAL_NO_DEVICE_INITED}, { 56862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_ALIAS}, { 56962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_ALIAS}, { 57062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_ALIAS}, { 57162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ALIAS_EXISTS}, { 57262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOGON_NOT_GRANTED}, { 57362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SECRETS}, { 57462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SECRET_TOO_LONG}, { 57562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_ERROR}, { 57662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FULLSCREEN_MODE}, { 57762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_CONTEXT_IDS}, { 57862306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_LOGON_TYPE_NOT_GRANTED}, { 57962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NOT_REGISTRY_FILE}, { 58062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED}, { 58162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR}, { 58262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FT_MISSING_MEMBER}, { 58362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_SERVICE_ENTRY}, { 58462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_CHARACTER}, { 58562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNMAPPABLE_CHARACTER}, { 58662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNDEFINED_CHARACTER}, { 58762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_VOLUME}, { 58862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND}, { 58962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_WRONG_CYLINDER}, { 59062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_UNKNOWN_ERROR}, { 59162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_BAD_REGISTERS}, { 59262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DISK_RECALIBRATE_FAILED}, { 59362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DISK_OPERATION_FAILED}, { 59462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DISK_RESET_FAILED}, { 59562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SHARED_IRQ_BUSY}, { 59662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FT_ORPHANING}, { 59762306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000016e}, { 59862306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000016f}, { 59962306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc0000170}, { 60062306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc0000171}, { 60162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PARTITION_FAILURE}, { 60262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_BLOCK_LENGTH}, { 60362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_PARTITIONED}, { 60462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_LOCK_MEDIA}, { 60562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_UNLOAD_MEDIA}, { 60662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_EOM_OVERFLOW}, { 60762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_MEDIA}, { 60862306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc0000179}, { 60962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_MEMBER}, { 61062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_MEMBER}, { 61162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_KEY_DELETED}, { 61262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_LOG_SPACE}, { 61362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SIDS}, { 61462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED}, { 61562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_KEY_HAS_CHILDREN}, { 61662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CHILD_MUST_BE_VOLATILE}, { 61762306a36Sopenharmony_ci ERRDOS, 87, NT_STATUS_DEVICE_CONFIGURATION_ERROR}, { 61862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DRIVER_INTERNAL_ERROR}, { 61962306a36Sopenharmony_ci ERRDOS, 22, NT_STATUS_INVALID_DEVICE_STATE}, { 62062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_IO_DEVICE_ERROR}, { 62162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DEVICE_PROTOCOL_ERROR}, { 62262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BACKUP_CONTROLLER}, { 62362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOG_FILE_FULL}, { 62462306a36Sopenharmony_ci ERRDOS, 19, NT_STATUS_TOO_LATE}, { 62562306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET}, 62662306a36Sopenharmony_ci/* { This NT error code was 'sqashed' 62762306a36Sopenharmony_ci from NT_STATUS_NO_TRUST_SAM_ACCOUNT to 62862306a36Sopenharmony_ci NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE during the session setup } */ 62962306a36Sopenharmony_ci { 63062306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, { 63162306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, { 63262306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE}, { 63362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CORRUPT}, { 63462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_CANT_START}, { 63562306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, { 63662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, { 63762306a36Sopenharmony_ci ERRDOS, ERRnetlogonNotStarted, NT_STATUS_NETLOGON_NOT_STARTED}, { 63862306a36Sopenharmony_ci ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_EXPIRED}, { 63962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, { 64062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, { 64162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, { 64262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CHANGED}, { 64362306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}, { 64462306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, { 64562306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT}, 64662306a36Sopenharmony_ci/* { This NT error code was 'sqashed' 64762306a36Sopenharmony_ci from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE 64862306a36Sopenharmony_ci during the session setup } */ 64962306a36Sopenharmony_ci { 65062306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, { 65162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FS_DRIVER_REQUIRED}, { 65262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_USER_SESSION_KEY}, { 65362306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_USER_SESSION_DELETED}, { 65462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_LANG_NOT_FOUND}, { 65562306a36Sopenharmony_ci ERRDOS, ERRnoresource, NT_STATUS_INSUFF_SERVER_RESOURCES}, { 65662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_BUFFER_SIZE}, { 65762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_COMPONENT}, { 65862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_WILDCARD}, { 65962306a36Sopenharmony_ci ERRDOS, 68, NT_STATUS_TOO_MANY_ADDRESSES}, { 66062306a36Sopenharmony_ci ERRDOS, 52, NT_STATUS_ADDRESS_ALREADY_EXISTS}, { 66162306a36Sopenharmony_ci ERRDOS, 64, NT_STATUS_ADDRESS_CLOSED}, { 66262306a36Sopenharmony_ci ERRDOS, 64, NT_STATUS_CONNECTION_DISCONNECTED}, { 66362306a36Sopenharmony_ci ERRDOS, 64, NT_STATUS_CONNECTION_RESET}, { 66462306a36Sopenharmony_ci ERRDOS, 68, NT_STATUS_TOO_MANY_NODES}, { 66562306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_TRANSACTION_ABORTED}, { 66662306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_TRANSACTION_TIMED_OUT}, { 66762306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_TRANSACTION_NO_RELEASE}, { 66862306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_TRANSACTION_NO_MATCH}, { 66962306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_TRANSACTION_RESPONDED}, { 67062306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_ID}, { 67162306a36Sopenharmony_ci ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_TYPE}, { 67262306a36Sopenharmony_ci ERRDOS, ERRunsup, NT_STATUS_NOT_SERVER_SESSION}, { 67362306a36Sopenharmony_ci ERRDOS, ERRunsup, NT_STATUS_NOT_CLIENT_SESSION}, { 67462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CANNOT_LOAD_REGISTRY_FILE}, { 67562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DEBUG_ATTACH_FAILED}, { 67662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_SYSTEM_PROCESS_TERMINATED}, { 67762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DATA_NOT_ACCEPTED}, { 67862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_BROWSER_SERVERS_FOUND}, { 67962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_VDM_HARD_ERROR}, { 68062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DRIVER_CANCEL_TIMEOUT}, { 68162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REPLY_MESSAGE_MISMATCH}, { 68262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MAPPED_ALIGNMENT}, { 68362306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, { 68462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, { 68562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, { 68662306a36Sopenharmony_ci ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_MUST_CHANGE}, { 68762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, { 68862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, { 68962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, { 69062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW_READ}, { 69162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FAIL_CHECK}, { 69262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DUPLICATE_OBJECTID}, { 69362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_OBJECTID_EXISTS}, { 69462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CONVERT_TO_LARGE}, { 69562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_RETRY}, { 69662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FOUND_OUT_OF_SCOPE}, { 69762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ALLOCATE_BUCKET}, { 69862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PROPSET_NOT_FOUND}, { 69962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_MARSHALL_OVERFLOW}, { 70062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_VARIANT}, { 70162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND}, { 70262306a36Sopenharmony_ci ERRDOS, ERRnoaccess, NT_STATUS_ACCOUNT_LOCKED_OUT}, { 70362306a36Sopenharmony_ci ERRDOS, ERRbadfid, NT_STATUS_HANDLE_NOT_CLOSABLE}, { 70462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_REFUSED}, { 70562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_GRACEFUL_DISCONNECT}, { 70662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_ALREADY_ASSOCIATED}, { 70762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_NOT_ASSOCIATED}, { 70862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_INVALID}, { 70962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ACTIVE}, { 71062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NETWORK_UNREACHABLE}, { 71162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_HOST_UNREACHABLE}, { 71262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PROTOCOL_UNREACHABLE}, { 71362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PORT_UNREACHABLE}, { 71462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REQUEST_ABORTED}, { 71562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ABORTED}, { 71662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_COMPRESSION_BUFFER}, { 71762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_USER_MAPPED_FILE}, { 71862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_AUDIT_FAILED}, { 71962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_TIMER_RESOLUTION_NOT_SET}, { 72062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_COUNT_LIMIT}, { 72162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOGIN_TIME_RESTRICTION}, { 72262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LOGIN_WKSTA_RESTRICTION}, { 72362306a36Sopenharmony_ci ERRDOS, 193, NT_STATUS_IMAGE_MP_UP_MISMATCH}, { 72462306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000024a}, { 72562306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000024b}, { 72662306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000024c}, { 72762306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000024d}, { 72862306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000024e}, { 72962306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000024f}, { 73062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INSUFFICIENT_LOGON_INFO}, { 73162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_DLL_ENTRYPOINT}, { 73262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_BAD_SERVICE_ENTRYPOINT}, { 73362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LPC_REPLY_LOST}, { 73462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT1}, { 73562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT2}, { 73662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_QUOTA_LIMIT}, { 73762306a36Sopenharmony_ci ERRSRV, 3, NT_STATUS_PATH_NOT_COVERED}, { 73862306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_NO_CALLBACK_ACTIVE}, { 73962306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_LICENSE_QUOTA_EXCEEDED}, { 74062306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_SHORT}, { 74162306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_RECENT}, { 74262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PWD_HISTORY_CONFLICT}, { 74362306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000025d}, { 74462306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_PLUGPLAY_NO_DEVICE}, { 74562306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_UNSUPPORTED_COMPRESSION}, { 74662306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_HW_PROFILE}, { 74762306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH}, { 74862306a36Sopenharmony_ci ERRDOS, 182, NT_STATUS_DRIVER_ORDINAL_NOT_FOUND}, { 74962306a36Sopenharmony_ci ERRDOS, 127, NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND}, { 75062306a36Sopenharmony_ci ERRDOS, 288, NT_STATUS_RESOURCE_NOT_OWNED}, { 75162306a36Sopenharmony_ci ERRDOS, ErrTooManyLinks, NT_STATUS_TOO_MANY_LINKS}, { 75262306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_QUOTA_LIST_INCONSISTENT}, { 75362306a36Sopenharmony_ci ERRHRD, ERRgeneral, NT_STATUS_FILE_IS_OFFLINE}, { 75462306a36Sopenharmony_ci ERRDOS, 21, 0xc000026e}, { 75562306a36Sopenharmony_ci ERRDOS, 161, 0xc0000281}, { 75662306a36Sopenharmony_ci ERRDOS, ERRnoaccess, 0xc000028a}, { 75762306a36Sopenharmony_ci ERRDOS, ERRnoaccess, 0xc000028b}, { 75862306a36Sopenharmony_ci ERRHRD, ERRgeneral, 0xc000028c}, { 75962306a36Sopenharmony_ci ERRDOS, ERRnoaccess, 0xc000028d}, { 76062306a36Sopenharmony_ci ERRDOS, ERRnoaccess, 0xc000028e}, { 76162306a36Sopenharmony_ci ERRDOS, ERRnoaccess, 0xc000028f}, { 76262306a36Sopenharmony_ci ERRDOS, ERRnoaccess, 0xc0000290}, { 76362306a36Sopenharmony_ci ERRDOS, ERRbadfunc, 0xc000029c}, { 76462306a36Sopenharmony_ci ERRDOS, ERRsymlink, NT_STATUS_STOPPED_ON_SYMLINK}, { 76562306a36Sopenharmony_ci ERRDOS, ERRinvlevel, 0x007c0001}, { 76662306a36Sopenharmony_ci 0, 0, 0 } 76762306a36Sopenharmony_ci}; 76862306a36Sopenharmony_ci 76962306a36Sopenharmony_ci/***************************************************************************** 77062306a36Sopenharmony_ci Print an error message from the status code 77162306a36Sopenharmony_ci *****************************************************************************/ 77262306a36Sopenharmony_cistatic void 77362306a36Sopenharmony_cicifs_print_status(__u32 status_code) 77462306a36Sopenharmony_ci{ 77562306a36Sopenharmony_ci int idx = 0; 77662306a36Sopenharmony_ci 77762306a36Sopenharmony_ci while (nt_errs[idx].nt_errstr != NULL) { 77862306a36Sopenharmony_ci if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) == 77962306a36Sopenharmony_ci (status_code & 0xFFFFFF)) { 78062306a36Sopenharmony_ci pr_notice("Status code returned 0x%08x %s\n", 78162306a36Sopenharmony_ci status_code, nt_errs[idx].nt_errstr); 78262306a36Sopenharmony_ci } 78362306a36Sopenharmony_ci idx++; 78462306a36Sopenharmony_ci } 78562306a36Sopenharmony_ci return; 78662306a36Sopenharmony_ci} 78762306a36Sopenharmony_ci 78862306a36Sopenharmony_ci 78962306a36Sopenharmony_cistatic void 79062306a36Sopenharmony_cintstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode) 79162306a36Sopenharmony_ci{ 79262306a36Sopenharmony_ci int i; 79362306a36Sopenharmony_ci if (ntstatus == 0) { 79462306a36Sopenharmony_ci *eclass = 0; 79562306a36Sopenharmony_ci *ecode = 0; 79662306a36Sopenharmony_ci return; 79762306a36Sopenharmony_ci } 79862306a36Sopenharmony_ci for (i = 0; ntstatus_to_dos_map[i].ntstatus; i++) { 79962306a36Sopenharmony_ci if (ntstatus == ntstatus_to_dos_map[i].ntstatus) { 80062306a36Sopenharmony_ci *eclass = ntstatus_to_dos_map[i].dos_class; 80162306a36Sopenharmony_ci *ecode = ntstatus_to_dos_map[i].dos_code; 80262306a36Sopenharmony_ci return; 80362306a36Sopenharmony_ci } 80462306a36Sopenharmony_ci } 80562306a36Sopenharmony_ci *eclass = ERRHRD; 80662306a36Sopenharmony_ci *ecode = ERRgeneral; 80762306a36Sopenharmony_ci} 80862306a36Sopenharmony_ci 80962306a36Sopenharmony_ciint 81062306a36Sopenharmony_cimap_smb_to_linux_error(char *buf, bool logErr) 81162306a36Sopenharmony_ci{ 81262306a36Sopenharmony_ci struct smb_hdr *smb = (struct smb_hdr *)buf; 81362306a36Sopenharmony_ci unsigned int i; 81462306a36Sopenharmony_ci int rc = -EIO; /* if transport error smb error may not be set */ 81562306a36Sopenharmony_ci __u8 smberrclass; 81662306a36Sopenharmony_ci __u16 smberrcode; 81762306a36Sopenharmony_ci 81862306a36Sopenharmony_ci /* BB if NT Status codes - map NT BB */ 81962306a36Sopenharmony_ci 82062306a36Sopenharmony_ci /* old style smb error codes */ 82162306a36Sopenharmony_ci if (smb->Status.CifsError == 0) 82262306a36Sopenharmony_ci return 0; 82362306a36Sopenharmony_ci 82462306a36Sopenharmony_ci if (smb->Flags2 & SMBFLG2_ERR_STATUS) { 82562306a36Sopenharmony_ci /* translate the newer STATUS codes to old style SMB errors 82662306a36Sopenharmony_ci * and then to POSIX errors */ 82762306a36Sopenharmony_ci __u32 err = le32_to_cpu(smb->Status.CifsError); 82862306a36Sopenharmony_ci if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED))) 82962306a36Sopenharmony_ci cifs_print_status(err); 83062306a36Sopenharmony_ci else if (cifsFYI & CIFS_RC) 83162306a36Sopenharmony_ci cifs_print_status(err); 83262306a36Sopenharmony_ci ntstatus_to_dos(err, &smberrclass, &smberrcode); 83362306a36Sopenharmony_ci } else { 83462306a36Sopenharmony_ci smberrclass = smb->Status.DosError.ErrorClass; 83562306a36Sopenharmony_ci smberrcode = le16_to_cpu(smb->Status.DosError.Error); 83662306a36Sopenharmony_ci } 83762306a36Sopenharmony_ci 83862306a36Sopenharmony_ci /* old style errors */ 83962306a36Sopenharmony_ci 84062306a36Sopenharmony_ci /* DOS class smb error codes - map DOS */ 84162306a36Sopenharmony_ci if (smberrclass == ERRDOS) { 84262306a36Sopenharmony_ci /* 1 byte field no need to byte reverse */ 84362306a36Sopenharmony_ci for (i = 0; 84462306a36Sopenharmony_ci i < 84562306a36Sopenharmony_ci sizeof(mapping_table_ERRDOS) / 84662306a36Sopenharmony_ci sizeof(struct smb_to_posix_error); i++) { 84762306a36Sopenharmony_ci if (mapping_table_ERRDOS[i].smb_err == 0) 84862306a36Sopenharmony_ci break; 84962306a36Sopenharmony_ci else if (mapping_table_ERRDOS[i].smb_err == 85062306a36Sopenharmony_ci smberrcode) { 85162306a36Sopenharmony_ci rc = mapping_table_ERRDOS[i].posix_code; 85262306a36Sopenharmony_ci break; 85362306a36Sopenharmony_ci } 85462306a36Sopenharmony_ci /* else try next error mapping one to see if match */ 85562306a36Sopenharmony_ci } 85662306a36Sopenharmony_ci } else if (smberrclass == ERRSRV) { 85762306a36Sopenharmony_ci /* server class of error codes */ 85862306a36Sopenharmony_ci for (i = 0; 85962306a36Sopenharmony_ci i < 86062306a36Sopenharmony_ci sizeof(mapping_table_ERRSRV) / 86162306a36Sopenharmony_ci sizeof(struct smb_to_posix_error); i++) { 86262306a36Sopenharmony_ci if (mapping_table_ERRSRV[i].smb_err == 0) 86362306a36Sopenharmony_ci break; 86462306a36Sopenharmony_ci else if (mapping_table_ERRSRV[i].smb_err == 86562306a36Sopenharmony_ci smberrcode) { 86662306a36Sopenharmony_ci rc = mapping_table_ERRSRV[i].posix_code; 86762306a36Sopenharmony_ci break; 86862306a36Sopenharmony_ci } 86962306a36Sopenharmony_ci /* else try next error mapping to see if match */ 87062306a36Sopenharmony_ci } 87162306a36Sopenharmony_ci } 87262306a36Sopenharmony_ci /* else ERRHRD class errors or junk - return EIO */ 87362306a36Sopenharmony_ci 87462306a36Sopenharmony_ci cifs_dbg(FYI, "Mapping smb error code 0x%x to POSIX err %d\n", 87562306a36Sopenharmony_ci le32_to_cpu(smb->Status.CifsError), rc); 87662306a36Sopenharmony_ci 87762306a36Sopenharmony_ci /* generic corrective action e.g. reconnect SMB session on 87862306a36Sopenharmony_ci * ERRbaduid could be added */ 87962306a36Sopenharmony_ci 88062306a36Sopenharmony_ci return rc; 88162306a36Sopenharmony_ci} 88262306a36Sopenharmony_ci 88362306a36Sopenharmony_ciint 88462306a36Sopenharmony_cimap_and_check_smb_error(struct mid_q_entry *mid, bool logErr) 88562306a36Sopenharmony_ci{ 88662306a36Sopenharmony_ci int rc; 88762306a36Sopenharmony_ci struct smb_hdr *smb = (struct smb_hdr *)mid->resp_buf; 88862306a36Sopenharmony_ci 88962306a36Sopenharmony_ci rc = map_smb_to_linux_error((char *)smb, logErr); 89062306a36Sopenharmony_ci if (rc == -EACCES && !(smb->Flags2 & SMBFLG2_ERR_STATUS)) { 89162306a36Sopenharmony_ci /* possible ERRBaduid */ 89262306a36Sopenharmony_ci __u8 class = smb->Status.DosError.ErrorClass; 89362306a36Sopenharmony_ci __u16 code = le16_to_cpu(smb->Status.DosError.Error); 89462306a36Sopenharmony_ci 89562306a36Sopenharmony_ci /* switch can be used to handle different errors */ 89662306a36Sopenharmony_ci if (class == ERRSRV && code == ERRbaduid) { 89762306a36Sopenharmony_ci cifs_dbg(FYI, "Server returned 0x%x, reconnecting session...\n", 89862306a36Sopenharmony_ci code); 89962306a36Sopenharmony_ci cifs_signal_cifsd_for_reconnect(mid->server, false); 90062306a36Sopenharmony_ci } 90162306a36Sopenharmony_ci } 90262306a36Sopenharmony_ci 90362306a36Sopenharmony_ci return rc; 90462306a36Sopenharmony_ci} 90562306a36Sopenharmony_ci 90662306a36Sopenharmony_ci 90762306a36Sopenharmony_ci/* 90862306a36Sopenharmony_ci * calculate the size of the SMB message based on the fixed header 90962306a36Sopenharmony_ci * portion, the number of word parameters and the data portion of the message 91062306a36Sopenharmony_ci */ 91162306a36Sopenharmony_ciunsigned int 91262306a36Sopenharmony_cismbCalcSize(void *buf) 91362306a36Sopenharmony_ci{ 91462306a36Sopenharmony_ci struct smb_hdr *ptr = buf; 91562306a36Sopenharmony_ci return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) + 91662306a36Sopenharmony_ci 2 /* size of the bcc field */ + get_bcc(ptr)); 91762306a36Sopenharmony_ci} 91862306a36Sopenharmony_ci 91962306a36Sopenharmony_ci/* The following are taken from fs/ntfs/util.c */ 92062306a36Sopenharmony_ci 92162306a36Sopenharmony_ci#define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) 92262306a36Sopenharmony_ci 92362306a36Sopenharmony_ci/* 92462306a36Sopenharmony_ci * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units) 92562306a36Sopenharmony_ci * into Unix UTC (based 1970-01-01, in seconds). 92662306a36Sopenharmony_ci */ 92762306a36Sopenharmony_cistruct timespec64 92862306a36Sopenharmony_cicifs_NTtimeToUnix(__le64 ntutc) 92962306a36Sopenharmony_ci{ 93062306a36Sopenharmony_ci struct timespec64 ts; 93162306a36Sopenharmony_ci /* BB what about the timezone? BB */ 93262306a36Sopenharmony_ci 93362306a36Sopenharmony_ci /* Subtract the NTFS time offset, then convert to 1s intervals. */ 93462306a36Sopenharmony_ci s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; 93562306a36Sopenharmony_ci u64 abs_t; 93662306a36Sopenharmony_ci 93762306a36Sopenharmony_ci /* 93862306a36Sopenharmony_ci * Unfortunately can not use normal 64 bit division on 32 bit arch, but 93962306a36Sopenharmony_ci * the alternative, do_div, does not work with negative numbers so have 94062306a36Sopenharmony_ci * to special case them 94162306a36Sopenharmony_ci */ 94262306a36Sopenharmony_ci if (t < 0) { 94362306a36Sopenharmony_ci abs_t = -t; 94462306a36Sopenharmony_ci ts.tv_nsec = (time64_t)(do_div(abs_t, 10000000) * 100); 94562306a36Sopenharmony_ci ts.tv_nsec = -ts.tv_nsec; 94662306a36Sopenharmony_ci ts.tv_sec = -abs_t; 94762306a36Sopenharmony_ci } else { 94862306a36Sopenharmony_ci abs_t = t; 94962306a36Sopenharmony_ci ts.tv_nsec = (time64_t)do_div(abs_t, 10000000) * 100; 95062306a36Sopenharmony_ci ts.tv_sec = abs_t; 95162306a36Sopenharmony_ci } 95262306a36Sopenharmony_ci 95362306a36Sopenharmony_ci return ts; 95462306a36Sopenharmony_ci} 95562306a36Sopenharmony_ci 95662306a36Sopenharmony_ci/* Convert the Unix UTC into NT UTC. */ 95762306a36Sopenharmony_ciu64 95862306a36Sopenharmony_cicifs_UnixTimeToNT(struct timespec64 t) 95962306a36Sopenharmony_ci{ 96062306a36Sopenharmony_ci /* Convert to 100ns intervals and then add the NTFS time offset. */ 96162306a36Sopenharmony_ci return (u64) t.tv_sec * 10000000 + t.tv_nsec/100 + NTFS_TIME_OFFSET; 96262306a36Sopenharmony_ci} 96362306a36Sopenharmony_ci 96462306a36Sopenharmony_cistatic const int total_days_of_prev_months[] = { 96562306a36Sopenharmony_ci 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 96662306a36Sopenharmony_ci}; 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_cistruct timespec64 cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset) 96962306a36Sopenharmony_ci{ 97062306a36Sopenharmony_ci struct timespec64 ts; 97162306a36Sopenharmony_ci time64_t sec, days; 97262306a36Sopenharmony_ci int min, day, month, year; 97362306a36Sopenharmony_ci u16 date = le16_to_cpu(le_date); 97462306a36Sopenharmony_ci u16 time = le16_to_cpu(le_time); 97562306a36Sopenharmony_ci SMB_TIME *st = (SMB_TIME *)&time; 97662306a36Sopenharmony_ci SMB_DATE *sd = (SMB_DATE *)&date; 97762306a36Sopenharmony_ci 97862306a36Sopenharmony_ci cifs_dbg(FYI, "date %d time %d\n", date, time); 97962306a36Sopenharmony_ci 98062306a36Sopenharmony_ci sec = 2 * st->TwoSeconds; 98162306a36Sopenharmony_ci min = st->Minutes; 98262306a36Sopenharmony_ci if ((sec > 59) || (min > 59)) 98362306a36Sopenharmony_ci cifs_dbg(VFS, "Invalid time min %d sec %lld\n", min, sec); 98462306a36Sopenharmony_ci sec += (min * 60); 98562306a36Sopenharmony_ci sec += 60 * 60 * st->Hours; 98662306a36Sopenharmony_ci if (st->Hours > 24) 98762306a36Sopenharmony_ci cifs_dbg(VFS, "Invalid hours %d\n", st->Hours); 98862306a36Sopenharmony_ci day = sd->Day; 98962306a36Sopenharmony_ci month = sd->Month; 99062306a36Sopenharmony_ci if (day < 1 || day > 31 || month < 1 || month > 12) { 99162306a36Sopenharmony_ci cifs_dbg(VFS, "Invalid date, month %d day: %d\n", month, day); 99262306a36Sopenharmony_ci day = clamp(day, 1, 31); 99362306a36Sopenharmony_ci month = clamp(month, 1, 12); 99462306a36Sopenharmony_ci } 99562306a36Sopenharmony_ci month -= 1; 99662306a36Sopenharmony_ci days = day + total_days_of_prev_months[month]; 99762306a36Sopenharmony_ci days += 3652; /* account for difference in days between 1980 and 1970 */ 99862306a36Sopenharmony_ci year = sd->Year; 99962306a36Sopenharmony_ci days += year * 365; 100062306a36Sopenharmony_ci days += (year/4); /* leap year */ 100162306a36Sopenharmony_ci /* generalized leap year calculation is more complex, ie no leap year 100262306a36Sopenharmony_ci for years/100 except for years/400, but since the maximum number for DOS 100362306a36Sopenharmony_ci year is 2**7, the last year is 1980+127, which means we need only 100462306a36Sopenharmony_ci consider 2 special case years, ie the years 2000 and 2100, and only 100562306a36Sopenharmony_ci adjust for the lack of leap year for the year 2100, as 2000 was a 100662306a36Sopenharmony_ci leap year (divisable by 400) */ 100762306a36Sopenharmony_ci if (year >= 120) /* the year 2100 */ 100862306a36Sopenharmony_ci days = days - 1; /* do not count leap year for the year 2100 */ 100962306a36Sopenharmony_ci 101062306a36Sopenharmony_ci /* adjust for leap year where we are still before leap day */ 101162306a36Sopenharmony_ci if (year != 120) 101262306a36Sopenharmony_ci days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0); 101362306a36Sopenharmony_ci sec += 24 * 60 * 60 * days; 101462306a36Sopenharmony_ci 101562306a36Sopenharmony_ci ts.tv_sec = sec + offset; 101662306a36Sopenharmony_ci 101762306a36Sopenharmony_ci /* cifs_dbg(FYI, "sec after cnvrt dos to unix time %d\n",sec); */ 101862306a36Sopenharmony_ci 101962306a36Sopenharmony_ci ts.tv_nsec = 0; 102062306a36Sopenharmony_ci return ts; 102162306a36Sopenharmony_ci} 1022