4 * Copyright (c) International Business Machines Corp., 2002,2008
5 * Author(s): Steve French (sfrench@us.ibm.com)
7 * Error mapping routines from Samba libsmb/errormap.c
8 * Copyright (C) Andrew Tridgell 2001
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
18 * the GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <linux/net.h>
26 #include <linux/string.h>
28 #include <linux/ctype.h>
30 #include <asm/div64.h>
31 #include <asm/byteorder.h>
32 #include <linux/inet.h>
36 #include "cifsproto.h"
38 #include "cifs_debug.h"
41 struct smb_to_posix_error {
46 static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
47 {ERRbadfunc, -EINVAL},
48 {ERRbadfile, -ENOENT},
49 {ERRbadpath, -ENOTDIR},
51 {ERRnoaccess, -EACCES},
57 {ERRbadformat, -EINVAL},
58 {ERRbadaccess, -EACCES},
60 {ERRbaddrive, -ENXIO},
62 {ERRdiffdevice, -EXDEV},
63 {ERRnofiles, -ENOENT},
64 {ERRbadshare, -ETXTBSY},
67 {ERRnosuchshare, -ENXIO},
68 {ERRfilexists, -EEXIST},
69 {ERRinvparm, -EINVAL},
70 {ERRdiskfull, -ENOSPC},
71 {ERRinvname, -ENOENT},
72 {ERRinvlevel, -EOPNOTSUPP},
73 {ERRdirnotempty, -ENOTEMPTY},
74 {ERRnotlocked, -ENOLCK},
75 {ERRcancelviolation, -ENOLCK},
76 {ERRalreadyexists, -EEXIST},
77 {ERRmoredata, -EOVERFLOW},
78 {ERReasnotsupported, -EOPNOTSUPP},
80 {ErrNotALink, -ENOLINK},
81 {ERRnetlogonNotStarted, -ENOPROTOOPT},
82 {ErrTooManyLinks, -EMLINK},
86 static const struct smb_to_posix_error mapping_table_ERRSRV[] = {
88 {ERRbadpw, -EACCES}, /* was EPERM */
89 {ERRbadtype, -EREMOTE},
92 {ERRinvnetname, -ENXIO},
93 {ERRinvdevice, -ENXIO},
95 {ERRqtoobig, -ENOSPC},
98 {ERRsmbcmd, -EBADRQC},
101 {ERRfilespecs, -EINVAL},
103 {ERRbadpermits, -EINVAL},
105 {ERRsetattrmode, -EINVAL},
106 {ERRpaused, -EHOSTDOWN},
107 {ERRmsgoff, -EHOSTDOWN},
108 {ERRnoroom, -ENOSPC},
110 {ERRtimeout, -ETIME},
111 {ERRnoresource, -ENOBUFS},
112 {ERRtoomanyuids, -EUSERS},
113 {ERRbaduid, -EACCES},
116 {ERR_NOTIFY_ENUM_DIR, -ENOBUFS},
117 {ERRnoSuchUser, -EACCES},
118 /* {ERRaccountexpired, -EACCES},
119 {ERRbadclient, -EACCES},
120 {ERRbadLogonTime, -EACCES},
121 {ERRpasswordExpired, -EACCES},*/
122 {ERRaccountexpired, -EKEYEXPIRED},
123 {ERRbadclient, -EACCES},
124 {ERRbadLogonTime, -EACCES},
125 {ERRpasswordExpired, -EKEYEXPIRED},
127 {ERRnosupport, -EINVAL},
131 static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
136 /* if the mount helper is missing we need to reverse the 1st slash
137 from '/' to backslash in order to format the UNC properly for
138 ip address parsing and for tree connect (unless the user
139 remembered to put the UNC name in properly). Fortunately we do
140 not have to call this twice (we check for IPv4 addresses
141 first, so it is already converted by the time we
142 try IPv6 addresses */
143 static int canonicalize_unc(char *cp)
147 for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) {
153 cFYI(DBG2, ("change slash to \\ in malformed UNC"));
161 /* Convert string containing dotted ip address to binary form */
162 /* returns 0 if invalid address */
165 cifs_inet_pton(int address_family, char *cp, void *dst)
169 /* calculate length by finding first slash or NULL */
170 if (address_family == AF_INET) {
171 ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL);
173 if (canonicalize_unc(cp))
174 ret = in4_pton(cp, -1, dst, '\\', NULL);
176 } else if (address_family == AF_INET6) {
177 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
179 cFYI(DBG2, ("address conversion returned %d for %s", ret, cp));
185 /*****************************************************************************
186 convert a NT status code to a dos class/code
187 *****************************************************************************/
188 /* NT status -> dos error map */
189 static const struct {
193 } ntstatus_to_dos_map[] = {
195 ERRDOS, ERRgeneral, NT_STATUS_UNSUCCESSFUL}, {
196 ERRDOS, ERRbadfunc, NT_STATUS_NOT_IMPLEMENTED}, {
197 ERRDOS, ERRinvlevel, NT_STATUS_INVALID_INFO_CLASS}, {
198 ERRDOS, 24, NT_STATUS_INFO_LENGTH_MISMATCH}, {
199 ERRHRD, ERRgeneral, NT_STATUS_ACCESS_VIOLATION}, {
200 ERRHRD, ERRgeneral, NT_STATUS_IN_PAGE_ERROR}, {
201 ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA}, {
202 ERRDOS, ERRbadfid, NT_STATUS_INVALID_HANDLE}, {
203 ERRHRD, ERRgeneral, NT_STATUS_BAD_INITIAL_STACK}, {
204 ERRDOS, 193, NT_STATUS_BAD_INITIAL_PC}, {
205 ERRDOS, 87, NT_STATUS_INVALID_CID}, {
206 ERRHRD, ERRgeneral, NT_STATUS_TIMER_NOT_CANCELED}, {
207 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER}, {
208 ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_DEVICE}, {
209 ERRDOS, ERRbadfile, NT_STATUS_NO_SUCH_FILE}, {
210 ERRDOS, ERRbadfunc, NT_STATUS_INVALID_DEVICE_REQUEST}, {
211 ERRDOS, 38, NT_STATUS_END_OF_FILE}, {
212 ERRDOS, 34, NT_STATUS_WRONG_VOLUME}, {
213 ERRDOS, 21, NT_STATUS_NO_MEDIA_IN_DEVICE}, {
214 ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, {
215 ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR},
216 /* { This NT error code was 'sqashed'
217 from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
218 during the session setup } */
220 ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, {
221 ERRDOS, 487, NT_STATUS_CONFLICTING_ADDRESSES}, {
222 ERRDOS, 487, NT_STATUS_NOT_MAPPED_VIEW}, {
223 ERRDOS, 87, NT_STATUS_UNABLE_TO_FREE_VM}, {
224 ERRDOS, 87, NT_STATUS_UNABLE_TO_DELETE_SECTION}, {
225 ERRDOS, 2142, NT_STATUS_INVALID_SYSTEM_SERVICE}, {
226 ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_INSTRUCTION}, {
227 ERRDOS, ERRnoaccess, NT_STATUS_INVALID_LOCK_SEQUENCE}, {
228 ERRDOS, ERRnoaccess, NT_STATUS_INVALID_VIEW_SIZE}, {
229 ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, {
230 ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED},
231 /* { This NT error code was 'sqashed'
232 from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
233 during the session setup } */
235 ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, {
236 ERRDOS, 111, NT_STATUS_BUFFER_TOO_SMALL}, {
237 ERRDOS, ERRbadfid, NT_STATUS_OBJECT_TYPE_MISMATCH}, {
238 ERRHRD, ERRgeneral, NT_STATUS_NONCONTINUABLE_EXCEPTION}, {
239 ERRHRD, ERRgeneral, NT_STATUS_INVALID_DISPOSITION}, {
240 ERRHRD, ERRgeneral, NT_STATUS_UNWIND}, {
241 ERRHRD, ERRgeneral, NT_STATUS_BAD_STACK}, {
242 ERRHRD, ERRgeneral, NT_STATUS_INVALID_UNWIND_TARGET}, {
243 ERRDOS, 158, NT_STATUS_NOT_LOCKED}, {
244 ERRHRD, ERRgeneral, NT_STATUS_PARITY_ERROR}, {
245 ERRDOS, 487, NT_STATUS_UNABLE_TO_DECOMMIT_VM}, {
246 ERRDOS, 487, NT_STATUS_NOT_COMMITTED}, {
247 ERRHRD, ERRgeneral, NT_STATUS_INVALID_PORT_ATTRIBUTES}, {
248 ERRHRD, ERRgeneral, NT_STATUS_PORT_MESSAGE_TOO_LONG}, {
249 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, {
250 ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, {
251 ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, {
252 /* mapping changed since shell does lookup on * expects FileNotFound */
253 ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, {
254 ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, {
255 ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, {
256 ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, {
257 ERRDOS, ERRbadfid, NT_STATUS_PORT_DISCONNECTED}, {
258 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_ALREADY_ATTACHED}, {
259 ERRDOS, 161, NT_STATUS_OBJECT_PATH_INVALID}, {
260 ERRDOS, ERRbadpath, NT_STATUS_OBJECT_PATH_NOT_FOUND}, {
261 ERRDOS, 161, NT_STATUS_OBJECT_PATH_SYNTAX_BAD}, {
262 ERRHRD, ERRgeneral, NT_STATUS_DATA_OVERRUN}, {
263 ERRHRD, ERRgeneral, NT_STATUS_DATA_LATE_ERROR}, {
264 ERRDOS, 23, NT_STATUS_DATA_ERROR}, {
265 ERRDOS, 23, NT_STATUS_CRC_ERROR}, {
266 ERRDOS, ERRnomem, NT_STATUS_SECTION_TOO_BIG}, {
267 ERRDOS, ERRnoaccess, NT_STATUS_PORT_CONNECTION_REFUSED}, {
268 ERRDOS, ERRbadfid, NT_STATUS_INVALID_PORT_HANDLE}, {
269 ERRDOS, ERRbadshare, NT_STATUS_SHARING_VIOLATION}, {
270 ERRHRD, ERRgeneral, NT_STATUS_QUOTA_EXCEEDED}, {
271 ERRDOS, 87, NT_STATUS_INVALID_PAGE_PROTECTION}, {
272 ERRDOS, 288, NT_STATUS_MUTANT_NOT_OWNED}, {
273 ERRDOS, 298, NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED}, {
274 ERRDOS, 87, NT_STATUS_PORT_ALREADY_SET}, {
275 ERRDOS, 87, NT_STATUS_SECTION_NOT_IMAGE}, {
276 ERRDOS, 156, NT_STATUS_SUSPEND_COUNT_EXCEEDED}, {
277 ERRDOS, ERRnoaccess, NT_STATUS_THREAD_IS_TERMINATING}, {
278 ERRDOS, 87, NT_STATUS_BAD_WORKING_SET_LIMIT}, {
279 ERRDOS, 87, NT_STATUS_INCOMPATIBLE_FILE_MAP}, {
280 ERRDOS, 87, NT_STATUS_SECTION_PROTECTION}, {
281 ERRDOS, ERReasnotsupported, NT_STATUS_EAS_NOT_SUPPORTED}, {
282 ERRDOS, 255, NT_STATUS_EA_TOO_LARGE}, {
283 ERRHRD, ERRgeneral, NT_STATUS_NONEXISTENT_EA_ENTRY}, {
284 ERRHRD, ERRgeneral, NT_STATUS_NO_EAS_ON_FILE}, {
285 ERRHRD, ERRgeneral, NT_STATUS_EA_CORRUPT_ERROR}, {
286 ERRDOS, ERRlock, NT_STATUS_FILE_LOCK_CONFLICT}, {
287 ERRDOS, ERRlock, NT_STATUS_LOCK_NOT_GRANTED}, {
288 ERRDOS, ERRbadfile, NT_STATUS_DELETE_PENDING}, {
289 ERRDOS, ERRunsup, NT_STATUS_CTL_FILE_NOT_SUPPORTED}, {
290 ERRHRD, ERRgeneral, NT_STATUS_UNKNOWN_REVISION}, {
291 ERRHRD, ERRgeneral, NT_STATUS_REVISION_MISMATCH}, {
292 ERRHRD, ERRgeneral, NT_STATUS_INVALID_OWNER}, {
293 ERRHRD, ERRgeneral, NT_STATUS_INVALID_PRIMARY_GROUP}, {
294 ERRHRD, ERRgeneral, NT_STATUS_NO_IMPERSONATION_TOKEN}, {
295 ERRHRD, ERRgeneral, NT_STATUS_CANT_DISABLE_MANDATORY}, {
296 ERRDOS, 2215, NT_STATUS_NO_LOGON_SERVERS}, {
297 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_LOGON_SESSION}, {
298 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PRIVILEGE}, {
299 ERRDOS, ERRnoaccess, NT_STATUS_PRIVILEGE_NOT_HELD}, {
300 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, {
301 ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS},
302 /* { This NT error code was 'sqashed'
303 from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
304 during the session setup } */
306 ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { /* could map to 2238 */
307 ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, {
308 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, {
309 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, {
310 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, {
311 ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN},
312 /* { This NT error code was 'sqashed'
313 from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE
314 during the session setup } */
316 ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, {
317 ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_PASSWORD}, {
318 ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, {
319 ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, {
320 ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, {
321 ERRSRV, ERRbadLogonTime, NT_STATUS_INVALID_LOGON_HOURS}, {
322 ERRSRV, ERRbadclient, NT_STATUS_INVALID_WORKSTATION}, {
323 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, {
324 ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_DISABLED}, {
325 ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, {
326 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, {
327 ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, {
328 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SUB_AUTHORITY}, {
329 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACL}, {
330 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SID}, {
331 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SECURITY_DESCR}, {
332 ERRDOS, 127, NT_STATUS_PROCEDURE_NOT_FOUND}, {
333 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_FORMAT}, {
334 ERRHRD, ERRgeneral, NT_STATUS_NO_TOKEN}, {
335 ERRHRD, ERRgeneral, NT_STATUS_BAD_INHERITANCE_ACL}, {
336 ERRDOS, 158, NT_STATUS_RANGE_NOT_LOCKED}, {
337 ERRDOS, 112, NT_STATUS_DISK_FULL}, {
338 ERRHRD, ERRgeneral, NT_STATUS_SERVER_DISABLED}, {
339 ERRHRD, ERRgeneral, NT_STATUS_SERVER_NOT_DISABLED}, {
340 ERRDOS, 68, NT_STATUS_TOO_MANY_GUIDS_REQUESTED}, {
341 ERRDOS, 259, NT_STATUS_GUIDS_EXHAUSTED}, {
342 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ID_AUTHORITY}, {
343 ERRDOS, 259, NT_STATUS_AGENTS_EXHAUSTED}, {
344 ERRDOS, 154, NT_STATUS_INVALID_VOLUME_LABEL}, {
345 ERRDOS, 14, NT_STATUS_SECTION_NOT_EXTENDED}, {
346 ERRDOS, 487, NT_STATUS_NOT_MAPPED_DATA}, {
347 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_DATA_NOT_FOUND}, {
348 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_TYPE_NOT_FOUND}, {
349 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_NAME_NOT_FOUND}, {
350 ERRHRD, ERRgeneral, NT_STATUS_ARRAY_BOUNDS_EXCEEDED}, {
351 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DENORMAL_OPERAND}, {
352 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_DIVIDE_BY_ZERO}, {
353 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INEXACT_RESULT}, {
354 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_INVALID_OPERATION}, {
355 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_OVERFLOW}, {
356 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_STACK_CHECK}, {
357 ERRHRD, ERRgeneral, NT_STATUS_FLOAT_UNDERFLOW}, {
358 ERRHRD, ERRgeneral, NT_STATUS_INTEGER_DIVIDE_BY_ZERO}, {
359 ERRDOS, 534, NT_STATUS_INTEGER_OVERFLOW}, {
360 ERRHRD, ERRgeneral, NT_STATUS_PRIVILEGED_INSTRUCTION}, {
361 ERRDOS, ERRnomem, NT_STATUS_TOO_MANY_PAGING_FILES}, {
362 ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, {
363 ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED},
364 /* { This NT error code was 'sqashed'
365 from NT_STATUS_INSUFFICIENT_RESOURCES to
366 NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */
368 ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, {
369 ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, {
370 ERRDOS, 23, NT_STATUS_DEVICE_DATA_ERROR}, {
371 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_CONNECTED}, {
372 ERRDOS, 21, NT_STATUS_DEVICE_POWER_FAILURE}, {
373 ERRDOS, 487, NT_STATUS_FREE_VM_NOT_AT_BASE}, {
374 ERRDOS, 487, NT_STATUS_MEMORY_NOT_ALLOCATED}, {
375 ERRHRD, ERRgeneral, NT_STATUS_WORKING_SET_QUOTA}, {
376 ERRDOS, 19, NT_STATUS_MEDIA_WRITE_PROTECTED}, {
377 ERRDOS, 21, NT_STATUS_DEVICE_NOT_READY}, {
378 ERRHRD, ERRgeneral, NT_STATUS_INVALID_GROUP_ATTRIBUTES}, {
379 ERRHRD, ERRgeneral, NT_STATUS_BAD_IMPERSONATION_LEVEL}, {
380 ERRHRD, ERRgeneral, NT_STATUS_CANT_OPEN_ANONYMOUS}, {
381 ERRHRD, ERRgeneral, NT_STATUS_BAD_VALIDATION_CLASS}, {
382 ERRHRD, ERRgeneral, NT_STATUS_BAD_TOKEN_TYPE}, {
383 ERRDOS, 87, NT_STATUS_BAD_MASTER_BOOT_RECORD}, {
384 ERRHRD, ERRgeneral, NT_STATUS_INSTRUCTION_MISALIGNMENT}, {
385 ERRDOS, ERRpipebusy, NT_STATUS_INSTANCE_NOT_AVAILABLE}, {
386 ERRDOS, ERRpipebusy, NT_STATUS_PIPE_NOT_AVAILABLE}, {
387 ERRDOS, ERRbadpipe, NT_STATUS_INVALID_PIPE_STATE}, {
388 ERRDOS, ERRpipebusy, NT_STATUS_PIPE_BUSY}, {
389 ERRDOS, ERRbadfunc, NT_STATUS_ILLEGAL_FUNCTION}, {
390 ERRDOS, ERRnotconnected, NT_STATUS_PIPE_DISCONNECTED}, {
391 ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_CLOSING}, {
392 ERRHRD, ERRgeneral, NT_STATUS_PIPE_CONNECTED}, {
393 ERRHRD, ERRgeneral, NT_STATUS_PIPE_LISTENING}, {
394 ERRDOS, ERRbadpipe, NT_STATUS_INVALID_READ_MODE}, {
395 ERRDOS, 121, NT_STATUS_IO_TIMEOUT}, {
396 ERRDOS, 38, NT_STATUS_FILE_FORCED_CLOSED}, {
397 ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STARTED}, {
398 ERRHRD, ERRgeneral, NT_STATUS_PROFILING_NOT_STOPPED}, {
399 ERRHRD, ERRgeneral, NT_STATUS_COULD_NOT_INTERPRET}, {
400 ERRDOS, ERRnoaccess, NT_STATUS_FILE_IS_A_DIRECTORY}, {
401 ERRDOS, ERRunsup, NT_STATUS_NOT_SUPPORTED}, {
402 ERRDOS, 51, NT_STATUS_REMOTE_NOT_LISTENING}, {
403 ERRDOS, 52, NT_STATUS_DUPLICATE_NAME}, {
404 ERRDOS, 53, NT_STATUS_BAD_NETWORK_PATH}, {
405 ERRDOS, 54, NT_STATUS_NETWORK_BUSY}, {
406 ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST}, {
407 ERRDOS, 56, NT_STATUS_TOO_MANY_COMMANDS}, {
408 ERRDOS, 57, NT_STATUS_ADAPTER_HARDWARE_ERROR}, {
409 ERRDOS, 58, NT_STATUS_INVALID_NETWORK_RESPONSE}, {
410 ERRDOS, 59, NT_STATUS_UNEXPECTED_NETWORK_ERROR}, {
411 ERRDOS, 60, NT_STATUS_BAD_REMOTE_ADAPTER}, {
412 ERRDOS, 61, NT_STATUS_PRINT_QUEUE_FULL}, {
413 ERRDOS, 62, NT_STATUS_NO_SPOOL_SPACE}, {
414 ERRDOS, 63, NT_STATUS_PRINT_CANCELLED}, {
415 ERRDOS, 64, NT_STATUS_NETWORK_NAME_DELETED}, {
416 ERRDOS, 65, NT_STATUS_NETWORK_ACCESS_DENIED}, {
417 ERRDOS, 66, NT_STATUS_BAD_DEVICE_TYPE}, {
418 ERRDOS, ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME}, {
419 ERRDOS, 68, NT_STATUS_TOO_MANY_NAMES}, {
420 ERRDOS, 69, NT_STATUS_TOO_MANY_SESSIONS}, {
421 ERRDOS, 70, NT_STATUS_SHARING_PAUSED}, {
422 ERRDOS, 71, NT_STATUS_REQUEST_NOT_ACCEPTED}, {
423 ERRDOS, 72, NT_STATUS_REDIRECTOR_PAUSED}, {
424 ERRDOS, 88, NT_STATUS_NET_WRITE_FAULT}, {
425 ERRHRD, ERRgeneral, NT_STATUS_PROFILING_AT_LIMIT}, {
426 ERRDOS, ERRdiffdevice, NT_STATUS_NOT_SAME_DEVICE}, {
427 ERRDOS, ERRnoaccess, NT_STATUS_FILE_RENAMED}, {
428 ERRDOS, 240, NT_STATUS_VIRTUAL_CIRCUIT_CLOSED}, {
429 ERRHRD, ERRgeneral, NT_STATUS_NO_SECURITY_ON_OBJECT}, {
430 ERRHRD, ERRgeneral, NT_STATUS_CANT_WAIT}, {
431 ERRDOS, ERRpipeclosing, NT_STATUS_PIPE_EMPTY}, {
432 ERRHRD, ERRgeneral, NT_STATUS_CANT_ACCESS_DOMAIN_INFO}, {
433 ERRHRD, ERRgeneral, NT_STATUS_CANT_TERMINATE_SELF}, {
434 ERRHRD, ERRgeneral, NT_STATUS_INVALID_SERVER_STATE}, {
435 ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_STATE}, {
436 ERRHRD, ERRgeneral, NT_STATUS_INVALID_DOMAIN_ROLE}, {
437 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_DOMAIN}, {
438 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_EXISTS}, {
439 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_LIMIT_EXCEEDED}, {
440 ERRDOS, 300, NT_STATUS_OPLOCK_NOT_GRANTED}, {
441 ERRDOS, 301, NT_STATUS_INVALID_OPLOCK_PROTOCOL}, {
442 ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_CORRUPTION}, {
443 ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_ERROR}, {
444 ERRHRD, ERRgeneral, NT_STATUS_GENERIC_NOT_MAPPED}, {
445 ERRHRD, ERRgeneral, NT_STATUS_BAD_DESCRIPTOR_FORMAT}, {
446 ERRHRD, ERRgeneral, NT_STATUS_INVALID_USER_BUFFER}, {
447 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_IO_ERROR}, {
448 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_CREATE_ERR}, {
449 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_MAP_ERROR}, {
450 ERRHRD, ERRgeneral, NT_STATUS_UNEXPECTED_MM_EXTEND_ERR}, {
451 ERRHRD, ERRgeneral, NT_STATUS_NOT_LOGON_PROCESS}, {
452 ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_EXISTS}, {
453 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_1}, {
454 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_2}, {
455 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_3}, {
456 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_4}, {
457 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_5}, {
458 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_6}, {
459 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_7}, {
460 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_8}, {
461 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_9}, {
462 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_10}, {
463 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_11}, {
464 ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_12}, {
465 ERRDOS, ERRbadpath, NT_STATUS_REDIRECTOR_NOT_STARTED}, {
466 ERRHRD, ERRgeneral, NT_STATUS_REDIRECTOR_STARTED}, {
467 ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW}, {
468 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_PACKAGE}, {
469 ERRHRD, ERRgeneral, NT_STATUS_BAD_FUNCTION_TABLE}, {
470 ERRDOS, 203, 0xc0000100}, {
471 ERRDOS, 145, NT_STATUS_DIRECTORY_NOT_EMPTY}, {
472 ERRHRD, ERRgeneral, NT_STATUS_FILE_CORRUPT_ERROR}, {
473 ERRDOS, 267, NT_STATUS_NOT_A_DIRECTORY}, {
474 ERRHRD, ERRgeneral, NT_STATUS_BAD_LOGON_SESSION_STATE}, {
475 ERRHRD, ERRgeneral, NT_STATUS_LOGON_SESSION_COLLISION}, {
476 ERRDOS, 206, NT_STATUS_NAME_TOO_LONG}, {
477 ERRDOS, 2401, NT_STATUS_FILES_OPEN}, {
478 ERRDOS, 2404, NT_STATUS_CONNECTION_IN_USE}, {
479 ERRHRD, ERRgeneral, NT_STATUS_MESSAGE_NOT_FOUND}, {
480 ERRDOS, ERRnoaccess, NT_STATUS_PROCESS_IS_TERMINATING}, {
481 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LOGON_TYPE}, {
482 ERRHRD, ERRgeneral, NT_STATUS_NO_GUID_TRANSLATION}, {
483 ERRHRD, ERRgeneral, NT_STATUS_CANNOT_IMPERSONATE}, {
484 ERRHRD, ERRgeneral, NT_STATUS_IMAGE_ALREADY_LOADED}, {
485 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_PRESENT}, {
486 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_NOT_EXIST}, {
487 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_LID_ALREADY_OWNED}, {
488 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_NOT_LID_OWNER}, {
489 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_COMMAND}, {
490 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_LID}, {
491 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE}, {
492 ERRHRD, ERRgeneral, NT_STATUS_ABIOS_INVALID_SELECTOR}, {
493 ERRHRD, ERRgeneral, NT_STATUS_NO_LDT}, {
494 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_SIZE}, {
495 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_OFFSET}, {
496 ERRHRD, ERRgeneral, NT_STATUS_INVALID_LDT_DESCRIPTOR}, {
497 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NE_FORMAT}, {
498 ERRHRD, ERRgeneral, NT_STATUS_RXACT_INVALID_STATE}, {
499 ERRHRD, ERRgeneral, NT_STATUS_RXACT_COMMIT_FAILURE}, {
500 ERRHRD, ERRgeneral, NT_STATUS_MAPPED_FILE_SIZE_ZERO}, {
501 ERRDOS, ERRnofids, NT_STATUS_TOO_MANY_OPENED_FILES}, {
502 ERRHRD, ERRgeneral, NT_STATUS_CANCELLED}, {
503 ERRDOS, ERRnoaccess, NT_STATUS_CANNOT_DELETE}, {
504 ERRHRD, ERRgeneral, NT_STATUS_INVALID_COMPUTER_NAME}, {
505 ERRDOS, ERRnoaccess, NT_STATUS_FILE_DELETED}, {
506 ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_ACCOUNT}, {
507 ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_GROUP}, {
508 ERRHRD, ERRgeneral, NT_STATUS_SPECIAL_USER}, {
509 ERRHRD, ERRgeneral, NT_STATUS_MEMBERS_PRIMARY_GROUP}, {
510 ERRDOS, ERRbadfid, NT_STATUS_FILE_CLOSED}, {
511 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_THREADS}, {
512 ERRHRD, ERRgeneral, NT_STATUS_THREAD_NOT_IN_PROCESS}, {
513 ERRHRD, ERRgeneral, NT_STATUS_TOKEN_ALREADY_IN_USE}, {
514 ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_QUOTA_EXCEEDED}, {
515 ERRHRD, ERRgeneral, NT_STATUS_COMMITMENT_LIMIT}, {
516 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_LE_FORMAT}, {
517 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_NOT_MZ}, {
518 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_PROTECT}, {
519 ERRDOS, 193, NT_STATUS_INVALID_IMAGE_WIN_16}, {
520 ERRHRD, ERRgeneral, NT_STATUS_LOGON_SERVER_CONFLICT}, {
521 ERRHRD, ERRgeneral, NT_STATUS_TIME_DIFFERENCE_AT_DC}, {
522 ERRHRD, ERRgeneral, NT_STATUS_SYNCHRONIZATION_REQUIRED}, {
523 ERRDOS, 126, NT_STATUS_DLL_NOT_FOUND}, {
524 ERRHRD, ERRgeneral, NT_STATUS_OPEN_FAILED}, {
525 ERRHRD, ERRgeneral, NT_STATUS_IO_PRIVILEGE_FAILED}, {
526 ERRDOS, 182, NT_STATUS_ORDINAL_NOT_FOUND}, {
527 ERRDOS, 127, NT_STATUS_ENTRYPOINT_NOT_FOUND}, {
528 ERRHRD, ERRgeneral, NT_STATUS_CONTROL_C_EXIT}, {
529 ERRDOS, 64, NT_STATUS_LOCAL_DISCONNECT}, {
530 ERRDOS, 64, NT_STATUS_REMOTE_DISCONNECT}, {
531 ERRDOS, 51, NT_STATUS_REMOTE_RESOURCES}, {
532 ERRDOS, 59, NT_STATUS_LINK_FAILED}, {
533 ERRDOS, 59, NT_STATUS_LINK_TIMEOUT}, {
534 ERRDOS, 59, NT_STATUS_INVALID_CONNECTION}, {
535 ERRDOS, 59, NT_STATUS_INVALID_ADDRESS}, {
536 ERRHRD, ERRgeneral, NT_STATUS_DLL_INIT_FAILED}, {
537 ERRHRD, ERRgeneral, NT_STATUS_MISSING_SYSTEMFILE}, {
538 ERRHRD, ERRgeneral, NT_STATUS_UNHANDLED_EXCEPTION}, {
539 ERRHRD, ERRgeneral, NT_STATUS_APP_INIT_FAILURE}, {
540 ERRHRD, ERRgeneral, NT_STATUS_PAGEFILE_CREATE_FAILED}, {
541 ERRHRD, ERRgeneral, NT_STATUS_NO_PAGEFILE}, {
542 ERRDOS, 124, NT_STATUS_INVALID_LEVEL}, {
543 ERRDOS, 86, NT_STATUS_WRONG_PASSWORD_CORE}, {
544 ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_FLOAT_CONTEXT}, {
545 ERRDOS, 109, NT_STATUS_PIPE_BROKEN}, {
546 ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_CORRUPT}, {
547 ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_IO_FAILED}, {
548 ERRHRD, ERRgeneral, NT_STATUS_NO_EVENT_PAIR}, {
549 ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_VOLUME}, {
550 ERRHRD, ERRgeneral, NT_STATUS_SERIAL_NO_DEVICE_INITED}, {
551 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_ALIAS}, {
552 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_ALIAS}, {
553 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_ALIAS}, {
554 ERRHRD, ERRgeneral, NT_STATUS_ALIAS_EXISTS}, {
555 ERRHRD, ERRgeneral, NT_STATUS_LOGON_NOT_GRANTED}, {
556 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SECRETS}, {
557 ERRHRD, ERRgeneral, NT_STATUS_SECRET_TOO_LONG}, {
558 ERRHRD, ERRgeneral, NT_STATUS_INTERNAL_DB_ERROR}, {
559 ERRHRD, ERRgeneral, NT_STATUS_FULLSCREEN_MODE}, {
560 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_CONTEXT_IDS}, {
561 ERRDOS, ERRnoaccess, NT_STATUS_LOGON_TYPE_NOT_GRANTED}, {
562 ERRHRD, ERRgeneral, NT_STATUS_NOT_REGISTRY_FILE}, {
563 ERRHRD, ERRgeneral, NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED}, {
564 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR}, {
565 ERRHRD, ERRgeneral, NT_STATUS_FT_MISSING_MEMBER}, {
566 ERRHRD, ERRgeneral, NT_STATUS_ILL_FORMED_SERVICE_ENTRY}, {
567 ERRHRD, ERRgeneral, NT_STATUS_ILLEGAL_CHARACTER}, {
568 ERRHRD, ERRgeneral, NT_STATUS_UNMAPPABLE_CHARACTER}, {
569 ERRHRD, ERRgeneral, NT_STATUS_UNDEFINED_CHARACTER}, {
570 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_VOLUME}, {
571 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND}, {
572 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_WRONG_CYLINDER}, {
573 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_UNKNOWN_ERROR}, {
574 ERRHRD, ERRgeneral, NT_STATUS_FLOPPY_BAD_REGISTERS}, {
575 ERRHRD, ERRgeneral, NT_STATUS_DISK_RECALIBRATE_FAILED}, {
576 ERRHRD, ERRgeneral, NT_STATUS_DISK_OPERATION_FAILED}, {
577 ERRHRD, ERRgeneral, NT_STATUS_DISK_RESET_FAILED}, {
578 ERRHRD, ERRgeneral, NT_STATUS_SHARED_IRQ_BUSY}, {
579 ERRHRD, ERRgeneral, NT_STATUS_FT_ORPHANING}, {
580 ERRHRD, ERRgeneral, 0xc000016e}, {
581 ERRHRD, ERRgeneral, 0xc000016f}, {
582 ERRHRD, ERRgeneral, 0xc0000170}, {
583 ERRHRD, ERRgeneral, 0xc0000171}, {
584 ERRHRD, ERRgeneral, NT_STATUS_PARTITION_FAILURE}, {
585 ERRHRD, ERRgeneral, NT_STATUS_INVALID_BLOCK_LENGTH}, {
586 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_NOT_PARTITIONED}, {
587 ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_LOCK_MEDIA}, {
588 ERRHRD, ERRgeneral, NT_STATUS_UNABLE_TO_UNLOAD_MEDIA}, {
589 ERRHRD, ERRgeneral, NT_STATUS_EOM_OVERFLOW}, {
590 ERRHRD, ERRgeneral, NT_STATUS_NO_MEDIA}, {
591 ERRHRD, ERRgeneral, 0xc0000179}, {
592 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_MEMBER}, {
593 ERRHRD, ERRgeneral, NT_STATUS_INVALID_MEMBER}, {
594 ERRHRD, ERRgeneral, NT_STATUS_KEY_DELETED}, {
595 ERRHRD, ERRgeneral, NT_STATUS_NO_LOG_SPACE}, {
596 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_SIDS}, {
597 ERRHRD, ERRgeneral, NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED}, {
598 ERRHRD, ERRgeneral, NT_STATUS_KEY_HAS_CHILDREN}, {
599 ERRHRD, ERRgeneral, NT_STATUS_CHILD_MUST_BE_VOLATILE}, {
600 ERRDOS, 87, NT_STATUS_DEVICE_CONFIGURATION_ERROR}, {
601 ERRHRD, ERRgeneral, NT_STATUS_DRIVER_INTERNAL_ERROR}, {
602 ERRDOS, 22, NT_STATUS_INVALID_DEVICE_STATE}, {
603 ERRHRD, ERRgeneral, NT_STATUS_IO_DEVICE_ERROR}, {
604 ERRHRD, ERRgeneral, NT_STATUS_DEVICE_PROTOCOL_ERROR}, {
605 ERRHRD, ERRgeneral, NT_STATUS_BACKUP_CONTROLLER}, {
606 ERRHRD, ERRgeneral, NT_STATUS_LOG_FILE_FULL}, {
607 ERRDOS, 19, NT_STATUS_TOO_LATE}, {
608 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET},
609 /* { This NT error code was 'sqashed'
610 from NT_STATUS_NO_TRUST_SAM_ACCOUNT to
611 NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE during the session setup } */
613 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, {
614 ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, {
615 ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE}, {
616 ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CORRUPT}, {
617 ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_CANT_START}, {
618 ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, {
619 ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, {
620 ERRDOS, ERRnetlogonNotStarted, NT_STATUS_NETLOGON_NOT_STARTED}, {
621 ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_EXPIRED}, {
622 ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, {
623 ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, {
624 ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, {
625 ERRHRD, ERRgeneral, NT_STATUS_EVENTLOG_FILE_CHANGED}, {
626 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}, {
627 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, {
628 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT},
629 /* { This NT error code was 'sqashed'
630 from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE
631 during the session setup } */
633 ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, {
634 ERRHRD, ERRgeneral, NT_STATUS_FS_DRIVER_REQUIRED}, {
635 ERRHRD, ERRgeneral, NT_STATUS_NO_USER_SESSION_KEY}, {
636 ERRDOS, 59, NT_STATUS_USER_SESSION_DELETED}, {
637 ERRHRD, ERRgeneral, NT_STATUS_RESOURCE_LANG_NOT_FOUND}, {
638 ERRDOS, ERRnomem, NT_STATUS_INSUFF_SERVER_RESOURCES}, {
639 ERRHRD, ERRgeneral, NT_STATUS_INVALID_BUFFER_SIZE}, {
640 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_COMPONENT}, {
641 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ADDRESS_WILDCARD}, {
642 ERRDOS, 68, NT_STATUS_TOO_MANY_ADDRESSES}, {
643 ERRDOS, 52, NT_STATUS_ADDRESS_ALREADY_EXISTS}, {
644 ERRDOS, 64, NT_STATUS_ADDRESS_CLOSED}, {
645 ERRDOS, 64, NT_STATUS_CONNECTION_DISCONNECTED}, {
646 ERRDOS, 64, NT_STATUS_CONNECTION_RESET}, {
647 ERRDOS, 68, NT_STATUS_TOO_MANY_NODES}, {
648 ERRDOS, 59, NT_STATUS_TRANSACTION_ABORTED}, {
649 ERRDOS, 59, NT_STATUS_TRANSACTION_TIMED_OUT}, {
650 ERRDOS, 59, NT_STATUS_TRANSACTION_NO_RELEASE}, {
651 ERRDOS, 59, NT_STATUS_TRANSACTION_NO_MATCH}, {
652 ERRDOS, 59, NT_STATUS_TRANSACTION_RESPONDED}, {
653 ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_ID}, {
654 ERRDOS, 59, NT_STATUS_TRANSACTION_INVALID_TYPE}, {
655 ERRDOS, ERRunsup, NT_STATUS_NOT_SERVER_SESSION}, {
656 ERRDOS, ERRunsup, NT_STATUS_NOT_CLIENT_SESSION}, {
657 ERRHRD, ERRgeneral, NT_STATUS_CANNOT_LOAD_REGISTRY_FILE}, {
658 ERRHRD, ERRgeneral, NT_STATUS_DEBUG_ATTACH_FAILED}, {
659 ERRHRD, ERRgeneral, NT_STATUS_SYSTEM_PROCESS_TERMINATED}, {
660 ERRHRD, ERRgeneral, NT_STATUS_DATA_NOT_ACCEPTED}, {
661 ERRHRD, ERRgeneral, NT_STATUS_NO_BROWSER_SERVERS_FOUND}, {
662 ERRHRD, ERRgeneral, NT_STATUS_VDM_HARD_ERROR}, {
663 ERRHRD, ERRgeneral, NT_STATUS_DRIVER_CANCEL_TIMEOUT}, {
664 ERRHRD, ERRgeneral, NT_STATUS_REPLY_MESSAGE_MISMATCH}, {
665 ERRHRD, ERRgeneral, NT_STATUS_MAPPED_ALIGNMENT}, {
666 ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, {
667 ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, {
668 ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, {
669 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_MUST_CHANGE}, {
670 ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, {
671 ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, {
672 ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, {
673 ERRHRD, ERRgeneral, NT_STATUS_STACK_OVERFLOW_READ}, {
674 ERRHRD, ERRgeneral, NT_STATUS_FAIL_CHECK}, {
675 ERRHRD, ERRgeneral, NT_STATUS_DUPLICATE_OBJECTID}, {
676 ERRHRD, ERRgeneral, NT_STATUS_OBJECTID_EXISTS}, {
677 ERRHRD, ERRgeneral, NT_STATUS_CONVERT_TO_LARGE}, {
678 ERRHRD, ERRgeneral, NT_STATUS_RETRY}, {
679 ERRHRD, ERRgeneral, NT_STATUS_FOUND_OUT_OF_SCOPE}, {
680 ERRHRD, ERRgeneral, NT_STATUS_ALLOCATE_BUCKET}, {
681 ERRHRD, ERRgeneral, NT_STATUS_PROPSET_NOT_FOUND}, {
682 ERRHRD, ERRgeneral, NT_STATUS_MARSHALL_OVERFLOW}, {
683 ERRHRD, ERRgeneral, NT_STATUS_INVALID_VARIANT}, {
684 ERRHRD, ERRgeneral, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND}, {
685 ERRDOS, ERRnoaccess, NT_STATUS_ACCOUNT_LOCKED_OUT}, {
686 ERRDOS, ERRbadfid, NT_STATUS_HANDLE_NOT_CLOSABLE}, {
687 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_REFUSED}, {
688 ERRHRD, ERRgeneral, NT_STATUS_GRACEFUL_DISCONNECT}, {
689 ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_ALREADY_ASSOCIATED}, {
690 ERRHRD, ERRgeneral, NT_STATUS_ADDRESS_NOT_ASSOCIATED}, {
691 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_INVALID}, {
692 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ACTIVE}, {
693 ERRHRD, ERRgeneral, NT_STATUS_NETWORK_UNREACHABLE}, {
694 ERRHRD, ERRgeneral, NT_STATUS_HOST_UNREACHABLE}, {
695 ERRHRD, ERRgeneral, NT_STATUS_PROTOCOL_UNREACHABLE}, {
696 ERRHRD, ERRgeneral, NT_STATUS_PORT_UNREACHABLE}, {
697 ERRHRD, ERRgeneral, NT_STATUS_REQUEST_ABORTED}, {
698 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ABORTED}, {
699 ERRHRD, ERRgeneral, NT_STATUS_BAD_COMPRESSION_BUFFER}, {
700 ERRHRD, ERRgeneral, NT_STATUS_USER_MAPPED_FILE}, {
701 ERRHRD, ERRgeneral, NT_STATUS_AUDIT_FAILED}, {
702 ERRHRD, ERRgeneral, NT_STATUS_TIMER_RESOLUTION_NOT_SET}, {
703 ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_COUNT_LIMIT}, {
704 ERRHRD, ERRgeneral, NT_STATUS_LOGIN_TIME_RESTRICTION}, {
705 ERRHRD, ERRgeneral, NT_STATUS_LOGIN_WKSTA_RESTRICTION}, {
706 ERRDOS, 193, NT_STATUS_IMAGE_MP_UP_MISMATCH}, {
707 ERRHRD, ERRgeneral, 0xc000024a}, {
708 ERRHRD, ERRgeneral, 0xc000024b}, {
709 ERRHRD, ERRgeneral, 0xc000024c}, {
710 ERRHRD, ERRgeneral, 0xc000024d}, {
711 ERRHRD, ERRgeneral, 0xc000024e}, {
712 ERRHRD, ERRgeneral, 0xc000024f}, {
713 ERRHRD, ERRgeneral, NT_STATUS_INSUFFICIENT_LOGON_INFO}, {
714 ERRHRD, ERRgeneral, NT_STATUS_BAD_DLL_ENTRYPOINT}, {
715 ERRHRD, ERRgeneral, NT_STATUS_BAD_SERVICE_ENTRYPOINT}, {
716 ERRHRD, ERRgeneral, NT_STATUS_LPC_REPLY_LOST}, {
717 ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT1}, {
718 ERRHRD, ERRgeneral, NT_STATUS_IP_ADDRESS_CONFLICT2}, {
719 ERRHRD, ERRgeneral, NT_STATUS_REGISTRY_QUOTA_LIMIT}, {
720 ERRSRV, 3, NT_STATUS_PATH_NOT_COVERED}, {
721 ERRHRD, ERRgeneral, NT_STATUS_NO_CALLBACK_ACTIVE}, {
722 ERRHRD, ERRgeneral, NT_STATUS_LICENSE_QUOTA_EXCEEDED}, {
723 ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_SHORT}, {
724 ERRHRD, ERRgeneral, NT_STATUS_PWD_TOO_RECENT}, {
725 ERRHRD, ERRgeneral, NT_STATUS_PWD_HISTORY_CONFLICT}, {
726 ERRHRD, ERRgeneral, 0xc000025d}, {
727 ERRHRD, ERRgeneral, NT_STATUS_PLUGPLAY_NO_DEVICE}, {
728 ERRHRD, ERRgeneral, NT_STATUS_UNSUPPORTED_COMPRESSION}, {
729 ERRHRD, ERRgeneral, NT_STATUS_INVALID_HW_PROFILE}, {
730 ERRHRD, ERRgeneral, NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH}, {
731 ERRDOS, 182, NT_STATUS_DRIVER_ORDINAL_NOT_FOUND}, {
732 ERRDOS, 127, NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND}, {
733 ERRDOS, 288, NT_STATUS_RESOURCE_NOT_OWNED}, {
734 ERRDOS, ErrTooManyLinks, NT_STATUS_TOO_MANY_LINKS}, {
735 ERRHRD, ERRgeneral, NT_STATUS_QUOTA_LIST_INCONSISTENT}, {
736 ERRHRD, ERRgeneral, NT_STATUS_FILE_IS_OFFLINE}, {
737 ERRDOS, 21, 0xc000026e}, {
738 ERRDOS, 161, 0xc0000281}, {
739 ERRDOS, ERRnoaccess, 0xc000028a}, {
740 ERRDOS, ERRnoaccess, 0xc000028b}, {
741 ERRHRD, ERRgeneral, 0xc000028c}, {
742 ERRDOS, ERRnoaccess, 0xc000028d}, {
743 ERRDOS, ERRnoaccess, 0xc000028e}, {
744 ERRDOS, ERRnoaccess, 0xc000028f}, {
745 ERRDOS, ERRnoaccess, 0xc0000290}, {
746 ERRDOS, ERRbadfunc, 0xc000029c}, {
747 ERRDOS, ERRinvlevel, 0x007c0001}, };
749 /*****************************************************************************
750 Print an error message from the status code
751 *****************************************************************************/
753 cifs_print_status(__u32 status_code)
757 while (nt_errs[idx].nt_errstr != NULL) {
758 if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) ==
759 (status_code & 0xFFFFFF)) {
760 printk(KERN_NOTICE "Status code returned 0x%08x %s\n",
761 status_code, nt_errs[idx].nt_errstr);
770 ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode)
778 for (i = 0; ntstatus_to_dos_map[i].ntstatus; i++) {
779 if (ntstatus == ntstatus_to_dos_map[i].ntstatus) {
780 *eclass = ntstatus_to_dos_map[i].dos_class;
781 *ecode = ntstatus_to_dos_map[i].dos_code;
790 map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
793 int rc = -EIO; /* if transport error smb error may not be set */
797 /* BB if NT Status codes - map NT BB */
799 /* old style smb error codes */
800 if (smb->Status.CifsError == 0)
803 if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
804 /* translate the newer STATUS codes to old style SMB errors
805 * and then to POSIX errors */
806 __u32 err = le32_to_cpu(smb->Status.CifsError);
807 if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED)))
808 cifs_print_status(err);
809 else if (cifsFYI & CIFS_RC)
810 cifs_print_status(err);
811 ntstatus_to_dos(err, &smberrclass, &smberrcode);
813 smberrclass = smb->Status.DosError.ErrorClass;
814 smberrcode = le16_to_cpu(smb->Status.DosError.Error);
817 /* old style errors */
819 /* DOS class smb error codes - map DOS */
820 if (smberrclass == ERRDOS) {
821 /* 1 byte field no need to byte reverse */
824 sizeof(mapping_table_ERRDOS) /
825 sizeof(struct smb_to_posix_error); i++) {
826 if (mapping_table_ERRDOS[i].smb_err == 0)
828 else if (mapping_table_ERRDOS[i].smb_err ==
830 rc = mapping_table_ERRDOS[i].posix_code;
833 /* else try next error mapping one to see if match */
835 } else if (smberrclass == ERRSRV) {
836 /* server class of error codes */
839 sizeof(mapping_table_ERRSRV) /
840 sizeof(struct smb_to_posix_error); i++) {
841 if (mapping_table_ERRSRV[i].smb_err == 0)
843 else if (mapping_table_ERRSRV[i].smb_err ==
845 rc = mapping_table_ERRSRV[i].posix_code;
848 /* else try next error mapping to see if match */
851 /* else ERRHRD class errors or junk - return EIO */
853 cFYI(1, ("Mapping smb error code %d to POSIX err %d",
856 /* generic corrective action e.g. reconnect SMB session on
857 * ERRbaduid could be added */
863 * calculate the size of the SMB message based on the fixed header
864 * portion, the number of word parameters and the data portion of the message
867 smbCalcSize(struct smb_hdr *ptr)
869 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
870 2 /* size of the bcc field */ + BCC(ptr));
874 smbCalcSize_LE(struct smb_hdr *ptr)
876 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
877 2 /* size of the bcc field */ + le16_to_cpu(BCC_LE(ptr)));
880 /* The following are taken from fs/ntfs/util.c */
882 #define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000)
885 * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units)
886 * into Unix UTC (based 1970-01-01, in seconds).
889 cifs_NTtimeToUnix(u64 ntutc)
892 /* BB what about the timezone? BB */
894 /* Subtract the NTFS time offset, then convert to 1s intervals. */
897 t = ntutc - NTFS_TIME_OFFSET;
898 ts.tv_nsec = do_div(t, 10000000) * 100;
903 /* Convert the Unix UTC into NT UTC. */
905 cifs_UnixTimeToNT(struct timespec t)
907 /* Convert to 100ns intervals and then add the NTFS time offset. */
908 return (u64) t.tv_sec * 10000000 + t.tv_nsec/100 + NTFS_TIME_OFFSET;
911 static int total_days_of_prev_months[] =
912 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
915 __le64 cnvrtDosCifsTm(__u16 date, __u16 time)
917 return cpu_to_le64(cifs_UnixTimeToNT(cnvrtDosUnixTm(date, time)));
920 struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
923 int sec, min, days, month, year;
924 SMB_TIME *st = (SMB_TIME *)&time;
925 SMB_DATE *sd = (SMB_DATE *)&date;
927 cFYI(1, ("date %d time %d", date, time));
929 sec = 2 * st->TwoSeconds;
931 if ((sec > 59) || (min > 59))
932 cERROR(1, ("illegal time min %d sec %d", min, sec));
934 sec += 60 * 60 * st->Hours;
936 cERROR(1, ("illegal hours %d", st->Hours));
939 if ((days > 31) || (month > 12)) {
940 cERROR(1, ("illegal date, month %d day: %d", month, days));
945 days += total_days_of_prev_months[month];
946 days += 3652; /* account for difference in days between 1980 and 1970 */
949 days += (year/4); /* leap year */
950 /* generalized leap year calculation is more complex, ie no leap year
951 for years/100 except for years/400, but since the maximum number for DOS
952 year is 2**7, the last year is 1980+127, which means we need only
953 consider 2 special case years, ie the years 2000 and 2100, and only
954 adjust for the lack of leap year for the year 2100, as 2000 was a
955 leap year (divisable by 400) */
956 if (year >= 120) /* the year 2100 */
957 days = days - 1; /* do not count leap year for the year 2100 */
959 /* adjust for leap year where we are still before leap day */
961 days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);
962 sec += 24 * 60 * 60 * days;
966 /* cFYI(1,("sec after cnvrt dos to unix time %d",sec)); */