Move libcli-util error code to top-level.
[samba.git] / libcli / util / errormap.c
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  error mapping functions
4  *  Copyright (C) Andrew Tridgell 2001
5  *  Copyright (C) Andrew Bartlett 2001
6  *  Copyright (C) Tim Potter 2000
7  *  
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 3 of the License, or
11  *  (at your option) any later version.
12  *  
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *  
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #include "includes.h"
23 #include "param/param.h"
24 #include "librpc/ndr/libndr.h"
25
26 /* This map was extracted by the ERRMAPEXTRACT smbtorture command. 
27    The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member 
28    workstation.  The PDC was modified (by using the 'name_to_nt_status'
29    authentication module) to convert the username (in hex) into the
30    corresponding NTSTATUS error return. 
31
32    By opening two nbt sessions to the Win2k workstation, one negotiating
33    DOS and one negotiating NT errors it was possible to extract the
34    error mapping.  (Because the server only supplies NT errors, the 
35    NT4 workstation had to use its own error tables to convert these
36    to dos errors). 
37
38    Some errors show up as 'squashed' because the NT error connection
39    got back a different error to the one it sent, so a mapping could
40    not be determined (a guess has been made in this case, to map the
41    error as squashed).  This is done mainly to prevent users from getting
42    NT_STATUS_WRONG_PASSWORD and NT_STATUS_NO_SUCH_USER errors (they get
43    NT_STATUS_LOGON_FAILURE instead.
44
45    -- abartlet (2002-01-03)
46 */
47
48 /* NT status -> dos error map */
49 static const struct {
50         uint8_t dos_class;
51         uint32_t dos_code;
52         NTSTATUS ntstatus;
53 } ntstatus_to_dos_map[] = {
54         {ERRDOS,        ERRnofiles,     STATUS_NO_MORE_FILES},
55         {ERRDOS,        ERRnofiles,     NT_STATUS_NO_MORE_ENTRIES},
56         {ERRDOS,        ERRgeneral,     NT_STATUS_UNSUCCESSFUL},
57         {ERRDOS,        ERRbadfunc,     NT_STATUS_NOT_IMPLEMENTED},
58         {ERRDOS,        87,     NT_STATUS_INVALID_INFO_CLASS},
59         {ERRDOS,        24,     NT_STATUS_INFO_LENGTH_MISMATCH},
60         {ERRHRD,        ERRgeneral,     NT_STATUS_ACCESS_VIOLATION},
61         {ERRHRD,        ERRgeneral,     NT_STATUS_IN_PAGE_ERROR},
62         {ERRHRD,        ERRgeneral,     NT_STATUS_PAGEFILE_QUOTA},
63         {ERRDOS,        ERRbadfid,      NT_STATUS_INVALID_HANDLE},
64         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_INITIAL_STACK},
65         {ERRDOS,        193,    NT_STATUS_BAD_INITIAL_PC},
66         {ERRDOS,        87,     NT_STATUS_INVALID_CID},
67         {ERRHRD,        ERRgeneral,     NT_STATUS_TIMER_NOT_CANCELED},
68         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER},
69         {ERRDOS,        ERRbadfile,     NT_STATUS_NO_SUCH_DEVICE},
70         {ERRDOS,        ERRbadfile,     NT_STATUS_NO_SUCH_FILE},
71         {ERRDOS,        ERRbadfunc,     NT_STATUS_INVALID_DEVICE_REQUEST},
72         {ERRDOS,        38,     NT_STATUS_END_OF_FILE},
73         {ERRDOS,        34,     NT_STATUS_WRONG_VOLUME},
74         {ERRDOS,        21,     NT_STATUS_NO_MEDIA_IN_DEVICE},
75         {ERRHRD,        ERRgeneral,     NT_STATUS_UNRECOGNIZED_MEDIA},
76         {ERRDOS,        27,     NT_STATUS_NONEXISTENT_SECTOR},
77 /** Session setup succeeded.  This shouldn't happen...*/
78 /** Session setup succeeded.  This shouldn't happen...*/
79 /** NT error on DOS connection! (NT_STATUS_OK) */
80 /*      { This NT error code was 'sqashed'
81          from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK 
82          during the session setup }
83 */
84 #if 0
85         {SUCCESS,       0,      NT_STATUS_OK},
86 #endif
87         {ERRDOS,        ERRnomem,       NT_STATUS_NO_MEMORY},
88         {ERRDOS,        487,    NT_STATUS_CONFLICTING_ADDRESSES},
89         {ERRDOS,        487,    NT_STATUS_NOT_MAPPED_VIEW},
90         {ERRDOS,        87,     NT_STATUS_UNABLE_TO_FREE_VM},
91         {ERRDOS,        87,     NT_STATUS_UNABLE_TO_DELETE_SECTION},
92         {ERRDOS,        2142,   NT_STATUS_INVALID_SYSTEM_SERVICE},
93         {ERRHRD,        ERRgeneral,     NT_STATUS_ILLEGAL_INSTRUCTION},
94         {ERRDOS,        ERRnoaccess,    NT_STATUS_INVALID_LOCK_SEQUENCE},
95         {ERRDOS,        ERRnoaccess,    NT_STATUS_INVALID_VIEW_SIZE},
96         {ERRDOS,        193,    NT_STATUS_INVALID_FILE_FOR_SECTION},
97         {ERRDOS,        ERRnoaccess,    NT_STATUS_ALREADY_COMMITTED},
98 /*      { This NT error code was 'sqashed'
99          from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE 
100          during the session setup }
101 */
102         {ERRDOS,        ERRnoaccess,    NT_STATUS_ACCESS_DENIED},
103         {ERRDOS,        111,    NT_STATUS_BUFFER_TOO_SMALL},
104         {ERRDOS,        ERRbadfid,      NT_STATUS_OBJECT_TYPE_MISMATCH},
105         {ERRHRD,        ERRgeneral,     NT_STATUS_NONCONTINUABLE_EXCEPTION},
106         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_DISPOSITION},
107         {ERRHRD,        ERRgeneral,     NT_STATUS_UNWIND},
108         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_STACK},
109         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_UNWIND_TARGET},
110         {ERRDOS,        158,    NT_STATUS_NOT_LOCKED},
111         {ERRHRD,        ERRgeneral,     NT_STATUS_PARITY_ERROR},
112         {ERRDOS,        487,    NT_STATUS_UNABLE_TO_DECOMMIT_VM},
113         {ERRDOS,        487,    NT_STATUS_NOT_COMMITTED},
114         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_PORT_ATTRIBUTES},
115         {ERRHRD,        ERRgeneral,     NT_STATUS_PORT_MESSAGE_TOO_LONG},
116         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_MIX},
117         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_QUOTA_LOWER},
118         {ERRHRD,        ERRgeneral,     NT_STATUS_DISK_CORRUPT_ERROR},
119         {ERRDOS,        ERRinvalidname, NT_STATUS_OBJECT_NAME_INVALID},
120         {ERRDOS,        ERRbadfile,     NT_STATUS_OBJECT_NAME_NOT_FOUND},
121         {ERRDOS,        ERRfilexists,   NT_STATUS_OBJECT_NAME_COLLISION},
122         {ERRHRD,        ERRgeneral,     NT_STATUS_HANDLE_NOT_WAITABLE},
123         {ERRDOS,        ERRbadfid,      NT_STATUS_PORT_DISCONNECTED},
124         {ERRHRD,        ERRgeneral,     NT_STATUS_DEVICE_ALREADY_ATTACHED},
125         {ERRDOS,        161,    NT_STATUS_OBJECT_PATH_INVALID},
126         {ERRDOS,        ERRbadpath,     NT_STATUS_OBJECT_PATH_NOT_FOUND},
127         {ERRDOS,        161,    NT_STATUS_OBJECT_PATH_SYNTAX_BAD},
128         {ERRHRD,        ERRgeneral,     NT_STATUS_DATA_OVERRUN},
129         {ERRHRD,        ERRgeneral,     NT_STATUS_DATA_LATE_ERROR},
130         {ERRDOS,        23,     NT_STATUS_DATA_ERROR},
131         {ERRDOS,        23,     NT_STATUS_CRC_ERROR},
132         {ERRDOS,        ERRnomem,       NT_STATUS_SECTION_TOO_BIG},
133         {ERRDOS,        ERRnoaccess,    NT_STATUS_PORT_CONNECTION_REFUSED},
134         {ERRDOS,        ERRbadfid,      NT_STATUS_INVALID_PORT_HANDLE},
135         {ERRDOS,        ERRbadshare,    NT_STATUS_SHARING_VIOLATION},
136         {ERRHRD,        ERRgeneral,     NT_STATUS_QUOTA_EXCEEDED},
137         {ERRDOS,        87,     NT_STATUS_INVALID_PAGE_PROTECTION},
138         {ERRDOS,        288,    NT_STATUS_MUTANT_NOT_OWNED},
139         {ERRDOS,        298,    NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED},
140         {ERRDOS,        87,     NT_STATUS_PORT_ALREADY_SET},
141         {ERRDOS,        87,     NT_STATUS_SECTION_NOT_IMAGE},
142         {ERRDOS,        156,    NT_STATUS_SUSPEND_COUNT_EXCEEDED},
143         {ERRDOS,        ERRnoaccess,    NT_STATUS_THREAD_IS_TERMINATING},
144         {ERRDOS,        87,     NT_STATUS_BAD_WORKING_SET_LIMIT},
145         {ERRDOS,        87,     NT_STATUS_INCOMPATIBLE_FILE_MAP},
146         {ERRDOS,        87,     NT_STATUS_SECTION_PROTECTION},
147         {ERRDOS,        282,    NT_STATUS_EAS_NOT_SUPPORTED},
148         {ERRDOS,        255,    NT_STATUS_EA_TOO_LARGE},
149         {ERRHRD,        ERRgeneral,     NT_STATUS_NONEXISTENT_EA_ENTRY},
150         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_EAS_ON_FILE},
151         {ERRHRD,        ERRgeneral,     NT_STATUS_EA_CORRUPT_ERROR},
152         {ERRDOS,        ERRlock,        NT_STATUS_FILE_LOCK_CONFLICT},
153         {ERRDOS,        ERRlock,        NT_STATUS_LOCK_NOT_GRANTED},
154         {ERRDOS,        ERRnoaccess,    NT_STATUS_DELETE_PENDING},
155         {ERRDOS,        ERRunsup,       NT_STATUS_CTL_FILE_NOT_SUPPORTED},
156         {ERRHRD,        ERRgeneral,     NT_STATUS_UNKNOWN_REVISION},
157         {ERRHRD,        ERRgeneral,     NT_STATUS_REVISION_MISMATCH},
158         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_OWNER},
159         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_PRIMARY_GROUP},
160         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_IMPERSONATION_TOKEN},
161         {ERRHRD,        ERRgeneral,     NT_STATUS_CANT_DISABLE_MANDATORY},
162         {ERRDOS,        2215,   NT_STATUS_NO_LOGON_SERVERS},
163         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SUCH_LOGON_SESSION},
164         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SUCH_PRIVILEGE},
165         {ERRDOS,        ERRnoaccess,    NT_STATUS_PRIVILEGE_NOT_HELD},
166         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_ACCOUNT_NAME},
167         {ERRHRD,        ERRgeneral,     NT_STATUS_USER_EXISTS},
168 /*      { This NT error code was 'sqashed'
169          from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE 
170          during the session setup }
171 */
172         {ERRDOS,        ERRnoaccess,    NT_STATUS_NO_SUCH_USER},
173         {ERRHRD,        ERRgeneral,     NT_STATUS_GROUP_EXISTS},
174         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SUCH_GROUP},
175         {ERRHRD,        ERRgeneral,     NT_STATUS_MEMBER_IN_GROUP},
176         {ERRHRD,        ERRgeneral,     NT_STATUS_MEMBER_NOT_IN_GROUP},
177         {ERRHRD,        ERRgeneral,     NT_STATUS_LAST_ADMIN},
178 /*      { This NT error code was 'sqashed'
179          from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE 
180          during the session setup }
181 */
182         {ERRSRV,        ERRbadpw,       NT_STATUS_WRONG_PASSWORD},
183         {ERRHRD,        ERRgeneral,     NT_STATUS_ILL_FORMED_PASSWORD},
184         {ERRHRD,        ERRgeneral,     NT_STATUS_PASSWORD_RESTRICTION},
185         {ERRDOS,        ERRnoaccess,    NT_STATUS_LOGON_FAILURE},
186         {ERRHRD,        ERRgeneral,     NT_STATUS_ACCOUNT_RESTRICTION},
187         {ERRSRV,        2241,   NT_STATUS_INVALID_LOGON_HOURS},
188         {ERRSRV,        2240,   NT_STATUS_INVALID_WORKSTATION},
189         {ERRSRV,        2242,   NT_STATUS_PASSWORD_EXPIRED},
190         {ERRSRV,        2239,   NT_STATUS_ACCOUNT_DISABLED},
191         {ERRHRD,        ERRgeneral,     NT_STATUS_NONE_MAPPED},
192         {ERRHRD,        ERRgeneral,     NT_STATUS_TOO_MANY_LUIDS_REQUESTED},
193         {ERRHRD,        ERRgeneral,     NT_STATUS_LUIDS_EXHAUSTED},
194         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_SUB_AUTHORITY},
195         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_ACL},
196         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_SID},
197         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_SECURITY_DESCR},
198         {ERRDOS,        127,    NT_STATUS_PROCEDURE_NOT_FOUND},
199         {ERRDOS,        193,    NT_STATUS_INVALID_IMAGE_FORMAT},
200         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_TOKEN},
201         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_INHERITANCE_ACL},
202         {ERRDOS,        158,    NT_STATUS_RANGE_NOT_LOCKED},
203         {ERRDOS,        112,    NT_STATUS_DISK_FULL},
204         {ERRHRD,        ERRgeneral,     NT_STATUS_SERVER_DISABLED},
205         {ERRHRD,        ERRgeneral,     NT_STATUS_SERVER_NOT_DISABLED},
206         {ERRDOS,        68,     NT_STATUS_TOO_MANY_GUIDS_REQUESTED},
207         {ERRDOS,        259,    NT_STATUS_GUIDS_EXHAUSTED},
208         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_ID_AUTHORITY},
209         {ERRDOS,        259,    NT_STATUS_AGENTS_EXHAUSTED},
210         {ERRDOS,        154,    NT_STATUS_INVALID_VOLUME_LABEL},
211         {ERRDOS,        ERRres, NT_STATUS_SECTION_NOT_EXTENDED},
212         {ERRDOS,        487,    NT_STATUS_NOT_MAPPED_DATA},
213         {ERRHRD,        ERRgeneral,     NT_STATUS_RESOURCE_DATA_NOT_FOUND},
214         {ERRHRD,        ERRgeneral,     NT_STATUS_RESOURCE_TYPE_NOT_FOUND},
215         {ERRHRD,        ERRgeneral,     NT_STATUS_RESOURCE_NAME_NOT_FOUND},
216         {ERRHRD,        ERRgeneral,     NT_STATUS_ARRAY_BOUNDS_EXCEEDED},
217         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOAT_DENORMAL_OPERAND},
218         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOAT_DIVIDE_BY_ZERO},
219         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOAT_INEXACT_RESULT},
220         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOAT_INVALID_OPERATION},
221         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOAT_OVERFLOW},
222         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOAT_STACK_CHECK},
223         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOAT_UNDERFLOW},
224         {ERRHRD,        ERRgeneral,     NT_STATUS_INTEGER_DIVIDE_BY_ZERO},
225         {ERRDOS,        534,    NT_STATUS_INTEGER_OVERFLOW},
226         {ERRHRD,        ERRgeneral,     NT_STATUS_PRIVILEGED_INSTRUCTION},
227         {ERRDOS,        ERRnomem,       NT_STATUS_TOO_MANY_PAGING_FILES},
228         {ERRHRD,        ERRgeneral,     NT_STATUS_FILE_INVALID},
229         {ERRHRD,        ERRgeneral,     NT_STATUS_ALLOTTED_SPACE_EXCEEDED},
230 /*      { This NT error code was 'sqashed'
231          from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES 
232          during the session setup }
233 */
234         {ERRDOS,        ERRnomem,       NT_STATUS_INSUFFICIENT_RESOURCES},
235         {ERRDOS,        ERRbadpath,     NT_STATUS_DFS_EXIT_PATH_FOUND},
236         {ERRDOS,        23,     NT_STATUS_DEVICE_DATA_ERROR},
237         {ERRHRD,        ERRgeneral,     NT_STATUS_DEVICE_NOT_CONNECTED},
238         {ERRDOS,        21,     NT_STATUS_DEVICE_POWER_FAILURE},
239         {ERRDOS,        487,    NT_STATUS_FREE_VM_NOT_AT_BASE},
240         {ERRDOS,        487,    NT_STATUS_MEMORY_NOT_ALLOCATED},
241         {ERRHRD,        ERRgeneral,     NT_STATUS_WORKING_SET_QUOTA},
242         {ERRDOS,        19,     NT_STATUS_MEDIA_WRITE_PROTECTED},
243         {ERRDOS,        21,     NT_STATUS_DEVICE_NOT_READY},
244         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_GROUP_ATTRIBUTES},
245         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_IMPERSONATION_LEVEL},
246         {ERRHRD,        ERRgeneral,     NT_STATUS_CANT_OPEN_ANONYMOUS},
247         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_VALIDATION_CLASS},
248         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_TOKEN_TYPE},
249         {ERRDOS,        87,     NT_STATUS_BAD_MASTER_BOOT_RECORD},
250         {ERRHRD,        ERRgeneral,     NT_STATUS_INSTRUCTION_MISALIGNMENT},
251         {ERRDOS,        ERRpipebusy,    NT_STATUS_INSTANCE_NOT_AVAILABLE},
252         {ERRDOS,        ERRpipebusy,    NT_STATUS_PIPE_NOT_AVAILABLE},
253         {ERRDOS,        ERRbadpipe,     NT_STATUS_INVALID_PIPE_STATE},
254         {ERRDOS,        ERRpipebusy,    NT_STATUS_PIPE_BUSY},
255         {ERRDOS,        ERRbadfunc,     NT_STATUS_ILLEGAL_FUNCTION},
256         {ERRDOS,        ERRnotconnected,        NT_STATUS_PIPE_DISCONNECTED},
257         {ERRDOS,        ERRpipeclosing, NT_STATUS_PIPE_CLOSING},
258         {ERRHRD,        ERRgeneral,     NT_STATUS_PIPE_CONNECTED},
259         {ERRHRD,        ERRgeneral,     NT_STATUS_PIPE_LISTENING},
260         {ERRDOS,        ERRbadpipe,     NT_STATUS_INVALID_READ_MODE},
261         {ERRDOS,        121,    NT_STATUS_IO_TIMEOUT},
262         {ERRDOS,        38,     NT_STATUS_FILE_FORCED_CLOSED},
263         {ERRHRD,        ERRgeneral,     NT_STATUS_PROFILING_NOT_STARTED},
264         {ERRHRD,        ERRgeneral,     NT_STATUS_PROFILING_NOT_STOPPED},
265         {ERRHRD,        ERRgeneral,     NT_STATUS_COULD_NOT_INTERPRET},
266         {ERRDOS,        ERRnoaccess,    NT_STATUS_FILE_IS_A_DIRECTORY},
267         {ERRDOS,        ERRunsup,       NT_STATUS_NOT_SUPPORTED},
268         {ERRDOS,        51,     NT_STATUS_REMOTE_NOT_LISTENING},
269         {ERRDOS,        52,     NT_STATUS_DUPLICATE_NAME},
270         {ERRDOS,        53,     NT_STATUS_BAD_NETWORK_PATH},
271         {ERRDOS,        54,     NT_STATUS_NETWORK_BUSY},
272         {ERRDOS,        55,     NT_STATUS_DEVICE_DOES_NOT_EXIST},
273         {ERRDOS,        56,     NT_STATUS_TOO_MANY_COMMANDS},
274         {ERRDOS,        57,     NT_STATUS_ADAPTER_HARDWARE_ERROR},
275         {ERRDOS,        58,     NT_STATUS_INVALID_NETWORK_RESPONSE},
276         {ERRDOS,        59,     NT_STATUS_UNEXPECTED_NETWORK_ERROR},
277         {ERRDOS,        60,     NT_STATUS_BAD_REMOTE_ADAPTER},
278         {ERRDOS,        61,     NT_STATUS_PRINT_QUEUE_FULL},
279         {ERRDOS,        62,     NT_STATUS_NO_SPOOL_SPACE},
280         {ERRDOS,        63,     NT_STATUS_PRINT_CANCELLED},
281         {ERRDOS,        64,     NT_STATUS_NETWORK_NAME_DELETED},
282         {ERRDOS,        65,     NT_STATUS_NETWORK_ACCESS_DENIED},
283         {ERRDOS,        66,     NT_STATUS_BAD_DEVICE_TYPE},
284         {ERRDOS,        ERRnosuchshare, NT_STATUS_BAD_NETWORK_NAME},
285         {ERRDOS,        68,     NT_STATUS_TOO_MANY_NAMES},
286         {ERRDOS,        69,     NT_STATUS_TOO_MANY_SESSIONS},
287         {ERRDOS,        70,     NT_STATUS_SHARING_PAUSED},
288         {ERRDOS,        71,     NT_STATUS_REQUEST_NOT_ACCEPTED},
289         {ERRDOS,        72,     NT_STATUS_REDIRECTOR_PAUSED},
290         {ERRDOS,        88,     NT_STATUS_NET_WRITE_FAULT},
291         {ERRHRD,        ERRgeneral,     NT_STATUS_PROFILING_AT_LIMIT},
292         {ERRDOS,        ERRdiffdevice,  NT_STATUS_NOT_SAME_DEVICE},
293         {ERRDOS,        ERRnoaccess,    NT_STATUS_FILE_RENAMED},
294         {ERRDOS,        240,    NT_STATUS_VIRTUAL_CIRCUIT_CLOSED},
295         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SECURITY_ON_OBJECT},
296         {ERRHRD,        ERRgeneral,     NT_STATUS_CANT_WAIT},
297         {ERRDOS,        ERRpipeclosing, NT_STATUS_PIPE_EMPTY},
298         {ERRHRD,        ERRgeneral,     NT_STATUS_CANT_ACCESS_DOMAIN_INFO},
299         {ERRHRD,        ERRgeneral,     NT_STATUS_CANT_TERMINATE_SELF},
300         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_SERVER_STATE},
301         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_DOMAIN_STATE},
302         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_DOMAIN_ROLE},
303         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SUCH_DOMAIN},
304         {ERRHRD,        ERRgeneral,     NT_STATUS_DOMAIN_EXISTS},
305         {ERRHRD,        ERRgeneral,     NT_STATUS_DOMAIN_LIMIT_EXCEEDED},
306         {ERRDOS,        300,    NT_STATUS_OPLOCK_NOT_GRANTED},
307         {ERRDOS,        301,    NT_STATUS_INVALID_OPLOCK_PROTOCOL},
308         {ERRHRD,        ERRgeneral,     NT_STATUS_INTERNAL_DB_CORRUPTION},
309         {ERRHRD,        ERRgeneral,     NT_STATUS_INTERNAL_ERROR},
310         {ERRHRD,        ERRgeneral,     NT_STATUS_GENERIC_NOT_MAPPED},
311         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_DESCRIPTOR_FORMAT},
312         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_USER_BUFFER},
313         {ERRHRD,        ERRgeneral,     NT_STATUS_UNEXPECTED_IO_ERROR},
314         {ERRHRD,        ERRgeneral,     NT_STATUS_UNEXPECTED_MM_CREATE_ERR},
315         {ERRHRD,        ERRgeneral,     NT_STATUS_UNEXPECTED_MM_MAP_ERROR},
316         {ERRHRD,        ERRgeneral,     NT_STATUS_UNEXPECTED_MM_EXTEND_ERR},
317         {ERRHRD,        ERRgeneral,     NT_STATUS_NOT_LOGON_PROCESS},
318         {ERRHRD,        ERRgeneral,     NT_STATUS_LOGON_SESSION_EXISTS},
319         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_1},
320         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_2},
321         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_3},
322         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_4},
323         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_5},
324         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_6},
325         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_7},
326         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_8},
327         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_9},
328         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_10},
329         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_11},
330         {ERRDOS,        87,     NT_STATUS_INVALID_PARAMETER_12},
331         {ERRDOS,        ERRbadpath,     NT_STATUS_REDIRECTOR_NOT_STARTED},
332         {ERRHRD,        ERRgeneral,     NT_STATUS_REDIRECTOR_STARTED},
333         {ERRHRD,        ERRgeneral,     NT_STATUS_STACK_OVERFLOW},
334         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SUCH_PACKAGE},
335         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_FUNCTION_TABLE},
336         {ERRDOS,        203,    NT_STATUS(0xc0000100)},
337         {ERRDOS,        145,    NT_STATUS_DIRECTORY_NOT_EMPTY},
338         {ERRHRD,        ERRgeneral,     NT_STATUS_FILE_CORRUPT_ERROR},
339         {ERRDOS,        267,    NT_STATUS_NOT_A_DIRECTORY},
340         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_LOGON_SESSION_STATE},
341         {ERRHRD,        ERRgeneral,     NT_STATUS_LOGON_SESSION_COLLISION},
342         {ERRDOS,        206,    NT_STATUS_NAME_TOO_LONG},
343         {ERRDOS,        2401,   NT_STATUS_FILES_OPEN},
344         {ERRDOS,        2404,   NT_STATUS_CONNECTION_IN_USE},
345         {ERRHRD,        ERRgeneral,     NT_STATUS_MESSAGE_NOT_FOUND},
346         {ERRDOS,        ERRnoaccess,    NT_STATUS_PROCESS_IS_TERMINATING},
347         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_LOGON_TYPE},
348         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_GUID_TRANSLATION},
349         {ERRHRD,        ERRgeneral,     NT_STATUS_CANNOT_IMPERSONATE},
350         {ERRHRD,        ERRgeneral,     NT_STATUS_IMAGE_ALREADY_LOADED},
351         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_NOT_PRESENT},
352         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_LID_NOT_EXIST},
353         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_LID_ALREADY_OWNED},
354         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_NOT_LID_OWNER},
355         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_INVALID_COMMAND},
356         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_INVALID_LID},
357         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE},
358         {ERRHRD,        ERRgeneral,     NT_STATUS_ABIOS_INVALID_SELECTOR},
359         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_LDT},
360         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_LDT_SIZE},
361         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_LDT_OFFSET},
362         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_LDT_DESCRIPTOR},
363         {ERRDOS,        193,    NT_STATUS_INVALID_IMAGE_NE_FORMAT},
364         {ERRHRD,        ERRgeneral,     NT_STATUS_RXACT_INVALID_STATE},
365         {ERRHRD,        ERRgeneral,     NT_STATUS_RXACT_COMMIT_FAILURE},
366         {ERRHRD,        ERRgeneral,     NT_STATUS_MAPPED_FILE_SIZE_ZERO},
367         {ERRDOS,        ERRnofids,      NT_STATUS_TOO_MANY_OPENED_FILES},
368         {ERRHRD,        ERRgeneral,     NT_STATUS_CANCELLED},
369         {ERRDOS,        ERRnoaccess,    NT_STATUS_CANNOT_DELETE},
370         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_COMPUTER_NAME},
371         {ERRDOS,        ERRnoaccess,    NT_STATUS_FILE_DELETED},
372         {ERRHRD,        ERRgeneral,     NT_STATUS_SPECIAL_ACCOUNT},
373         {ERRHRD,        ERRgeneral,     NT_STATUS_SPECIAL_GROUP},
374         {ERRHRD,        ERRgeneral,     NT_STATUS_SPECIAL_USER},
375         {ERRHRD,        ERRgeneral,     NT_STATUS_MEMBERS_PRIMARY_GROUP},
376         {ERRDOS,        ERRbadfid,      NT_STATUS_FILE_CLOSED},
377         {ERRHRD,        ERRgeneral,     NT_STATUS_TOO_MANY_THREADS},
378         {ERRHRD,        ERRgeneral,     NT_STATUS_THREAD_NOT_IN_PROCESS},
379         {ERRHRD,        ERRgeneral,     NT_STATUS_TOKEN_ALREADY_IN_USE},
380         {ERRHRD,        ERRgeneral,     NT_STATUS_PAGEFILE_QUOTA_EXCEEDED},
381         {ERRHRD,        ERRgeneral,     NT_STATUS_COMMITMENT_LIMIT},
382         {ERRDOS,        193,    NT_STATUS_INVALID_IMAGE_LE_FORMAT},
383         {ERRDOS,        193,    NT_STATUS_INVALID_IMAGE_NOT_MZ},
384         {ERRDOS,        193,    NT_STATUS_INVALID_IMAGE_PROTECT},
385         {ERRDOS,        193,    NT_STATUS_INVALID_IMAGE_WIN_16},
386         {ERRHRD,        ERRgeneral,     NT_STATUS_LOGON_SERVER_CONFLICT},
387         {ERRHRD,        ERRgeneral,     NT_STATUS_TIME_DIFFERENCE_AT_DC},
388         {ERRHRD,        ERRgeneral,     NT_STATUS_SYNCHRONIZATION_REQUIRED},
389         {ERRDOS,        126,    NT_STATUS_DLL_NOT_FOUND},
390         {ERRHRD,        ERRgeneral,     NT_STATUS_OPEN_FAILED},
391         {ERRHRD,        ERRgeneral,     NT_STATUS_IO_PRIVILEGE_FAILED},
392         {ERRDOS,        182,    NT_STATUS_ORDINAL_NOT_FOUND},
393         {ERRDOS,        127,    NT_STATUS_ENTRYPOINT_NOT_FOUND},
394         {ERRHRD,        ERRgeneral,     NT_STATUS_CONTROL_C_EXIT},
395         {ERRDOS,        64,     NT_STATUS_LOCAL_DISCONNECT},
396         {ERRDOS,        64,     NT_STATUS_REMOTE_DISCONNECT},
397         {ERRDOS,        51,     NT_STATUS_REMOTE_RESOURCES},
398         {ERRDOS,        59,     NT_STATUS_LINK_FAILED},
399         {ERRDOS,        59,     NT_STATUS_LINK_TIMEOUT},
400         {ERRDOS,        59,     NT_STATUS_INVALID_CONNECTION},
401         {ERRDOS,        59,     NT_STATUS_INVALID_ADDRESS},
402         {ERRHRD,        ERRgeneral,     NT_STATUS_DLL_INIT_FAILED},
403         {ERRHRD,        ERRgeneral,     NT_STATUS_MISSING_SYSTEMFILE},
404         {ERRHRD,        ERRgeneral,     NT_STATUS_UNHANDLED_EXCEPTION},
405         {ERRHRD,        ERRgeneral,     NT_STATUS_APP_INIT_FAILURE},
406         {ERRHRD,        ERRgeneral,     NT_STATUS_PAGEFILE_CREATE_FAILED},
407         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_PAGEFILE},
408         {ERRDOS,        124,    NT_STATUS_INVALID_LEVEL},
409         {ERRDOS,        86,     NT_STATUS_WRONG_PASSWORD_CORE},
410         {ERRHRD,        ERRgeneral,     NT_STATUS_ILLEGAL_FLOAT_CONTEXT},
411         {ERRDOS,        109,    NT_STATUS_PIPE_BROKEN},
412         {ERRHRD,        ERRgeneral,     NT_STATUS_REGISTRY_CORRUPT},
413         {ERRHRD,        ERRgeneral,     NT_STATUS_REGISTRY_IO_FAILED},
414         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_EVENT_PAIR},
415         {ERRHRD,        ERRgeneral,     NT_STATUS_UNRECOGNIZED_VOLUME},
416         {ERRHRD,        ERRgeneral,     NT_STATUS_SERIAL_NO_DEVICE_INITED},
417         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SUCH_ALIAS},
418         {ERRHRD,        ERRgeneral,     NT_STATUS_MEMBER_NOT_IN_ALIAS},
419         {ERRHRD,        ERRgeneral,     NT_STATUS_MEMBER_IN_ALIAS},
420         {ERRHRD,        ERRgeneral,     NT_STATUS_ALIAS_EXISTS},
421         {ERRHRD,        ERRgeneral,     NT_STATUS_LOGON_NOT_GRANTED},
422         {ERRHRD,        ERRgeneral,     NT_STATUS_TOO_MANY_SECRETS},
423         {ERRHRD,        ERRgeneral,     NT_STATUS_SECRET_TOO_LONG},
424         {ERRHRD,        ERRgeneral,     NT_STATUS_INTERNAL_DB_ERROR},
425         {ERRHRD,        ERRgeneral,     NT_STATUS_FULLSCREEN_MODE},
426         {ERRHRD,        ERRgeneral,     NT_STATUS_TOO_MANY_CONTEXT_IDS},
427         {ERRDOS,        ERRnoaccess,    NT_STATUS_LOGON_TYPE_NOT_GRANTED},
428         {ERRHRD,        ERRgeneral,     NT_STATUS_NOT_REGISTRY_FILE},
429         {ERRHRD,        ERRgeneral,     NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED},
430         {ERRHRD,        ERRgeneral,     NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR},
431         {ERRHRD,        ERRgeneral,     NT_STATUS_FT_MISSING_MEMBER},
432         {ERRHRD,        ERRgeneral,     NT_STATUS_ILL_FORMED_SERVICE_ENTRY},
433         {ERRHRD,        ERRgeneral,     NT_STATUS_ILLEGAL_CHARACTER},
434         {ERRHRD,        ERRgeneral,     NT_STATUS_UNMAPPABLE_CHARACTER},
435         {ERRHRD,        ERRgeneral,     NT_STATUS_UNDEFINED_CHARACTER},
436         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOPPY_VOLUME},
437         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND},
438         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOPPY_WRONG_CYLINDER},
439         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOPPY_UNKNOWN_ERROR},
440         {ERRHRD,        ERRgeneral,     NT_STATUS_FLOPPY_BAD_REGISTERS},
441         {ERRHRD,        ERRgeneral,     NT_STATUS_DISK_RECALIBRATE_FAILED},
442         {ERRHRD,        ERRgeneral,     NT_STATUS_DISK_OPERATION_FAILED},
443         {ERRHRD,        ERRgeneral,     NT_STATUS_DISK_RESET_FAILED},
444         {ERRHRD,        ERRgeneral,     NT_STATUS_SHARED_IRQ_BUSY},
445         {ERRHRD,        ERRgeneral,     NT_STATUS_FT_ORPHANING},
446         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000016e)},
447         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000016f)},
448         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc0000170)},
449         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc0000171)},
450         {ERRHRD,        ERRgeneral,     NT_STATUS_PARTITION_FAILURE},
451         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_BLOCK_LENGTH},
452         {ERRHRD,        ERRgeneral,     NT_STATUS_DEVICE_NOT_PARTITIONED},
453         {ERRHRD,        ERRgeneral,     NT_STATUS_UNABLE_TO_LOCK_MEDIA},
454         {ERRHRD,        ERRgeneral,     NT_STATUS_UNABLE_TO_UNLOAD_MEDIA},
455         {ERRHRD,        ERRgeneral,     NT_STATUS_EOM_OVERFLOW},
456         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_MEDIA},
457         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc0000179)},
458         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_SUCH_MEMBER},
459         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_MEMBER},
460         {ERRHRD,        ERRgeneral,     NT_STATUS_KEY_DELETED},
461         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_LOG_SPACE},
462         {ERRHRD,        ERRgeneral,     NT_STATUS_TOO_MANY_SIDS},
463         {ERRHRD,        ERRgeneral,     NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED},
464         {ERRHRD,        ERRgeneral,     NT_STATUS_KEY_HAS_CHILDREN},
465         {ERRHRD,        ERRgeneral,     NT_STATUS_CHILD_MUST_BE_VOLATILE},
466         {ERRDOS,        87,     NT_STATUS_DEVICE_CONFIGURATION_ERROR},
467         {ERRHRD,        ERRgeneral,     NT_STATUS_DRIVER_INTERNAL_ERROR},
468         {ERRDOS,        22,     NT_STATUS_INVALID_DEVICE_STATE},
469         {ERRHRD,        ERRgeneral,     NT_STATUS_IO_DEVICE_ERROR},
470         {ERRHRD,        ERRgeneral,     NT_STATUS_DEVICE_PROTOCOL_ERROR},
471         {ERRHRD,        ERRgeneral,     NT_STATUS_BACKUP_CONTROLLER},
472         {ERRHRD,        ERRgeneral,     NT_STATUS_LOG_FILE_FULL},
473         {ERRDOS,        19,     NT_STATUS_TOO_LATE},
474         {ERRDOS,        ERRnoaccess,    NT_STATUS_NO_TRUST_LSA_SECRET},
475 /*      { This NT error code was 'sqashed'
476          from NT_STATUS_NO_TRUST_SAM_ACCOUNT to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE 
477          during the session setup }
478 */
479         {ERRDOS,        ERRnoaccess,    NT_STATUS_NO_TRUST_SAM_ACCOUNT},
480         {ERRDOS,        ERRnoaccess,    NT_STATUS_TRUSTED_DOMAIN_FAILURE},
481         {ERRDOS,        ERRnoaccess,    NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE},
482         {ERRHRD,        ERRgeneral,     NT_STATUS_EVENTLOG_FILE_CORRUPT},
483         {ERRHRD,        ERRgeneral,     NT_STATUS_EVENTLOG_CANT_START},
484         {ERRDOS,        ERRnoaccess,    NT_STATUS_TRUST_FAILURE},
485         {ERRHRD,        ERRgeneral,     NT_STATUS_MUTANT_LIMIT_EXCEEDED},
486         {ERRDOS,        ERRinvgroup,    NT_STATUS_NETLOGON_NOT_STARTED},
487         {ERRSRV,        2239,   NT_STATUS_ACCOUNT_EXPIRED},
488         {ERRHRD,        ERRgeneral,     NT_STATUS_POSSIBLE_DEADLOCK},
489         {ERRHRD,        ERRgeneral,     NT_STATUS_NETWORK_CREDENTIAL_CONFLICT},
490         {ERRHRD,        ERRgeneral,     NT_STATUS_REMOTE_SESSION_LIMIT},
491         {ERRHRD,        ERRgeneral,     NT_STATUS_EVENTLOG_FILE_CHANGED},
492         {ERRDOS,        ERRnoaccess,    NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT},
493         {ERRDOS,        ERRnoaccess,    NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT},
494         {ERRDOS,        ERRnoaccess,    NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT},
495 /*      { This NT error code was 'sqashed'
496          from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE 
497          during the session setup }
498 */
499         {ERRDOS,        ERRnoaccess,    NT_STATUS_DOMAIN_TRUST_INCONSISTENT},
500         {ERRHRD,        ERRgeneral,     NT_STATUS_FS_DRIVER_REQUIRED},
501         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_USER_SESSION_KEY},
502         {ERRDOS,        59,     NT_STATUS_USER_SESSION_DELETED},
503         {ERRHRD,        ERRgeneral,     NT_STATUS_RESOURCE_LANG_NOT_FOUND},
504         {ERRDOS,        ERRnomem,       NT_STATUS_INSUFF_SERVER_RESOURCES},
505         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_BUFFER_SIZE},
506         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_ADDRESS_COMPONENT},
507         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_ADDRESS_WILDCARD},
508         {ERRDOS,        68,     NT_STATUS_TOO_MANY_ADDRESSES},
509         {ERRDOS,        52,     NT_STATUS_ADDRESS_ALREADY_EXISTS},
510         {ERRDOS,        64,     NT_STATUS_ADDRESS_CLOSED},
511         {ERRDOS,        64,     NT_STATUS_CONNECTION_DISCONNECTED},
512         {ERRDOS,        64,     NT_STATUS_CONNECTION_RESET},
513         {ERRDOS,        68,     NT_STATUS_TOO_MANY_NODES},
514         {ERRDOS,        59,     NT_STATUS_TRANSACTION_ABORTED},
515         {ERRDOS,        59,     NT_STATUS_TRANSACTION_TIMED_OUT},
516         {ERRDOS,        59,     NT_STATUS_TRANSACTION_NO_RELEASE},
517         {ERRDOS,        59,     NT_STATUS_TRANSACTION_NO_MATCH},
518         {ERRDOS,        59,     NT_STATUS_TRANSACTION_RESPONDED},
519         {ERRDOS,        59,     NT_STATUS_TRANSACTION_INVALID_ID},
520         {ERRDOS,        59,     NT_STATUS_TRANSACTION_INVALID_TYPE},
521         {ERRDOS,        ERRunsup,       NT_STATUS_NOT_SERVER_SESSION},
522         {ERRDOS,        ERRunsup,       NT_STATUS_NOT_CLIENT_SESSION},
523         {ERRHRD,        ERRgeneral,     NT_STATUS_CANNOT_LOAD_REGISTRY_FILE},
524         {ERRHRD,        ERRgeneral,     NT_STATUS_DEBUG_ATTACH_FAILED},
525         {ERRHRD,        ERRgeneral,     NT_STATUS_SYSTEM_PROCESS_TERMINATED},
526         {ERRHRD,        ERRgeneral,     NT_STATUS_DATA_NOT_ACCEPTED},
527         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_BROWSER_SERVERS_FOUND},
528         {ERRHRD,        ERRgeneral,     NT_STATUS_VDM_HARD_ERROR},
529         {ERRHRD,        ERRgeneral,     NT_STATUS_DRIVER_CANCEL_TIMEOUT},
530         {ERRHRD,        ERRgeneral,     NT_STATUS_REPLY_MESSAGE_MISMATCH},
531         {ERRHRD,        ERRgeneral,     NT_STATUS_MAPPED_ALIGNMENT},
532         {ERRDOS,        193,    NT_STATUS_IMAGE_CHECKSUM_MISMATCH},
533         {ERRHRD,        ERRgeneral,     NT_STATUS_LOST_WRITEBEHIND_DATA},
534         {ERRHRD,        ERRgeneral,     NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID},
535         {ERRSRV,        2242,   NT_STATUS_PASSWORD_MUST_CHANGE},
536         {ERRHRD,        ERRgeneral,     NT_STATUS_NOT_FOUND},
537         {ERRHRD,        ERRgeneral,     NT_STATUS_NOT_TINY_STREAM},
538         {ERRHRD,        ERRgeneral,     NT_STATUS_RECOVERY_FAILURE},
539         {ERRHRD,        ERRgeneral,     NT_STATUS_STACK_OVERFLOW_READ},
540         {ERRHRD,        ERRgeneral,     NT_STATUS_FAIL_CHECK},
541         {ERRHRD,        ERRgeneral,     NT_STATUS_DUPLICATE_OBJECTID},
542         {ERRHRD,        ERRgeneral,     NT_STATUS_OBJECTID_EXISTS},
543         {ERRHRD,        ERRgeneral,     NT_STATUS_CONVERT_TO_LARGE},
544         {ERRHRD,        ERRgeneral,     NT_STATUS_RETRY},
545         {ERRHRD,        ERRgeneral,     NT_STATUS_FOUND_OUT_OF_SCOPE},
546         {ERRHRD,        ERRgeneral,     NT_STATUS_ALLOCATE_BUCKET},
547         {ERRHRD,        ERRgeneral,     NT_STATUS_PROPSET_NOT_FOUND},
548         {ERRHRD,        ERRgeneral,     NT_STATUS_MARSHALL_OVERFLOW},
549         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_VARIANT},
550         {ERRHRD,        ERRgeneral,     NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND},
551         {ERRDOS,        ERRnoaccess,    NT_STATUS_ACCOUNT_LOCKED_OUT},
552         {ERRDOS,        ERRbadfid,      NT_STATUS_HANDLE_NOT_CLOSABLE},
553         {ERRHRD,        ERRgeneral,     NT_STATUS_CONNECTION_REFUSED},
554         {ERRHRD,        ERRgeneral,     NT_STATUS_GRACEFUL_DISCONNECT},
555         {ERRHRD,        ERRgeneral,     NT_STATUS_ADDRESS_ALREADY_ASSOCIATED},
556         {ERRHRD,        ERRgeneral,     NT_STATUS_ADDRESS_NOT_ASSOCIATED},
557         {ERRHRD,        ERRgeneral,     NT_STATUS_CONNECTION_INVALID},
558         {ERRHRD,        ERRgeneral,     NT_STATUS_CONNECTION_ACTIVE},
559         {ERRHRD,        ERRgeneral,     NT_STATUS_NETWORK_UNREACHABLE},
560         {ERRHRD,        ERRgeneral,     NT_STATUS_HOST_UNREACHABLE},
561         {ERRHRD,        ERRgeneral,     NT_STATUS_PROTOCOL_UNREACHABLE},
562         {ERRHRD,        ERRgeneral,     NT_STATUS_PORT_UNREACHABLE},
563         {ERRHRD,        ERRgeneral,     NT_STATUS_REQUEST_ABORTED},
564         {ERRHRD,        ERRgeneral,     NT_STATUS_CONNECTION_ABORTED},
565         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_COMPRESSION_BUFFER},
566         {ERRHRD,        ERRgeneral,     NT_STATUS_USER_MAPPED_FILE},
567         {ERRHRD,        ERRgeneral,     NT_STATUS_AUDIT_FAILED},
568         {ERRHRD,        ERRgeneral,     NT_STATUS_TIMER_RESOLUTION_NOT_SET},
569         {ERRHRD,        ERRgeneral,     NT_STATUS_CONNECTION_COUNT_LIMIT},
570         {ERRHRD,        ERRgeneral,     NT_STATUS_LOGIN_TIME_RESTRICTION},
571         {ERRHRD,        ERRgeneral,     NT_STATUS_LOGIN_WKSTA_RESTRICTION},
572         {ERRDOS,        193,    NT_STATUS_IMAGE_MP_UP_MISMATCH},
573         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000024a)},
574         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000024b)},
575         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000024c)},
576         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000024d)},
577         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000024e)},
578         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000024f)},
579         {ERRHRD,        ERRgeneral,     NT_STATUS_INSUFFICIENT_LOGON_INFO},
580         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_DLL_ENTRYPOINT},
581         {ERRHRD,        ERRgeneral,     NT_STATUS_BAD_SERVICE_ENTRYPOINT},
582         {ERRHRD,        ERRgeneral,     NT_STATUS_LPC_REPLY_LOST},
583         {ERRHRD,        ERRgeneral,     NT_STATUS_IP_ADDRESS_CONFLICT1},
584         {ERRHRD,        ERRgeneral,     NT_STATUS_IP_ADDRESS_CONFLICT2},
585         {ERRHRD,        ERRgeneral,     NT_STATUS_REGISTRY_QUOTA_LIMIT},
586         {ERRSRV,        ERRbadtype,     NT_STATUS_PATH_NOT_COVERED},
587         {ERRHRD,        ERRgeneral,     NT_STATUS_NO_CALLBACK_ACTIVE},
588         {ERRHRD,        ERRgeneral,     NT_STATUS_LICENSE_QUOTA_EXCEEDED},
589         {ERRHRD,        ERRgeneral,     NT_STATUS_PWD_TOO_SHORT},
590         {ERRHRD,        ERRgeneral,     NT_STATUS_PWD_TOO_RECENT},
591         {ERRHRD,        ERRgeneral,     NT_STATUS_PWD_HISTORY_CONFLICT},
592         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000025d)},
593         {ERRHRD,        ERRgeneral,     NT_STATUS_PLUGPLAY_NO_DEVICE},
594         {ERRHRD,        ERRgeneral,     NT_STATUS_UNSUPPORTED_COMPRESSION},
595         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_HW_PROFILE},
596         {ERRHRD,        ERRgeneral,     NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH},
597         {ERRDOS,        182,    NT_STATUS_DRIVER_ORDINAL_NOT_FOUND},
598         {ERRDOS,        127,    NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND},
599         {ERRDOS,        288,    NT_STATUS_RESOURCE_NOT_OWNED},
600         {ERRHRD,        ERRgeneral,     NT_STATUS_TOO_MANY_LINKS},
601         {ERRHRD,        ERRgeneral,     NT_STATUS_QUOTA_LIST_INCONSISTENT},
602         {ERRHRD,        ERRgeneral,     NT_STATUS_FILE_IS_OFFLINE},
603         {ERRDOS,        21,     NT_STATUS(0xc000026e)},
604         {ERRDOS,        161,    NT_STATUS(0xc0000281)},
605         {ERRDOS,        ERRnoaccess,    NT_STATUS(0xc000028a)},
606         {ERRDOS,        ERRnoaccess,    NT_STATUS(0xc000028b)},
607         {ERRHRD,        ERRgeneral,     NT_STATUS(0xc000028c)},
608         {ERRDOS,        ERRnoaccess,    NT_STATUS(0xc000028d)},
609         {ERRDOS,        ERRnoaccess,    NT_STATUS(0xc000028e)},
610         {ERRDOS,        ERRnoaccess,    NT_STATUS(0xc000028f)},
611         {ERRDOS,        ERRnoaccess,    NT_STATUS(0xc0000290)},
612         {ERRDOS,        ERRbadfunc,     NT_STATUS(0xc000029c)},
613 };
614
615
616 /* errmap NTSTATUS->Win32 */
617 static const struct {
618         NTSTATUS ntstatus;
619         WERROR werror;
620 } ntstatus_to_werror_map[] = {
621         /*
622          * we add this manualy here, so that W_ERROR(0x5)
623          * gets mapped to NTSTATUS_ACCESS_DENIED
624          */
625         {NT_STATUS_ACCESS_DENIED, WERR_ACCESS_DENIED},
626         {NT_STATUS(0x103), W_ERROR(0x3e5)},
627         {NT_STATUS(0x105), W_ERROR(0xea)},
628         {NT_STATUS(0x106), W_ERROR(0x514)},
629         {NT_STATUS(0x107), W_ERROR(0x515)},
630         {NT_STATUS(0x10c), W_ERROR(0x3fe)},
631         {NT_STATUS(0x10d), W_ERROR(0x516)},
632         {NT_STATUS(0x121), W_ERROR(0x2009)},
633         {NT_STATUS(0xc0000001), W_ERROR(0x1f)},
634         {NT_STATUS(0xc0000002), W_ERROR(0x1)},
635         {NT_STATUS(0xc0000003), W_ERROR(0x57)},
636         {NT_STATUS(0xc0000004), W_ERROR(0x18)},
637         {NT_STATUS(0xc0000005), W_ERROR(0x3e6)},
638         {NT_STATUS(0xc0000006), W_ERROR(0x3e7)},
639         {NT_STATUS(0xc0000007), W_ERROR(0x5ae)},
640         {NT_STATUS(0xc0000008), W_ERROR(0x6)},
641         {NT_STATUS(0xc0000009), W_ERROR(0x3e9)},
642         {NT_STATUS(0xc000000a), W_ERROR(0xc1)},
643         {NT_STATUS(0xc000000b), W_ERROR(0x57)},
644         {NT_STATUS(0xc000000d), W_ERROR(0x57)},
645         {NT_STATUS(0xc000000e), W_ERROR(0x2)},
646         {NT_STATUS(0xc000000f), W_ERROR(0x2)},
647         {NT_STATUS(0xc0000010), W_ERROR(0x1)},
648         {NT_STATUS(0xc0000011), W_ERROR(0x26)},
649         {NT_STATUS(0xc0000012), W_ERROR(0x22)},
650         {NT_STATUS(0xc0000013), W_ERROR(0x15)},
651         {NT_STATUS(0xc0000014), W_ERROR(0x6f9)},
652         {NT_STATUS(0xc0000015), W_ERROR(0x1b)},
653         {NT_STATUS(0xc0000016), W_ERROR(0xea)},
654         {NT_STATUS(0xc0000017), W_ERROR(0x8)},
655         {NT_STATUS(0xc0000018), W_ERROR(0x1e7)},
656         {NT_STATUS(0xc0000019), W_ERROR(0x1e7)},
657         {NT_STATUS(0xc000001a), W_ERROR(0x57)},
658         {NT_STATUS(0xc000001b), W_ERROR(0x57)},
659         {NT_STATUS(0xc000001c), W_ERROR(0x1)},
660         {NT_STATUS(0xc000001d), W_ERROR(0xc000001d)},
661         {NT_STATUS(0xc000001e), W_ERROR(0x5)},
662         {NT_STATUS(0xc000001f), W_ERROR(0x5)},
663         {NT_STATUS(0xc0000020), W_ERROR(0xc1)},
664         {NT_STATUS(0xc0000021), W_ERROR(0x5)},
665         {NT_STATUS(0xc0000022), W_ERROR(0x5)},
666         {NT_STATUS(0xc0000023), W_ERROR(0x7a)},
667         {NT_STATUS(0xc0000024), W_ERROR(0x6)},
668         {NT_STATUS(0xc0000025), W_ERROR(0xc0000025)},
669         {NT_STATUS(0xc0000026), W_ERROR(0xc0000026)},
670         {NT_STATUS(0xc000002a), W_ERROR(0x9e)},
671         {NT_STATUS(0xc000002b), W_ERROR(0xc000002b)},
672         {NT_STATUS(0xc000002c), W_ERROR(0x1e7)},
673         {NT_STATUS(0xc000002d), W_ERROR(0x1e7)},
674         {NT_STATUS(0xc0000030), W_ERROR(0x57)},
675         {NT_STATUS(0xc0000032), W_ERROR(0x571)},
676         {NT_STATUS(0xc0000033), W_ERROR(0x7b)},
677         {NT_STATUS(0xc0000034), W_ERROR(0x2)},
678         {NT_STATUS(0xc0000035), W_ERROR(0xb7)},
679         {NT_STATUS(0xc0000037), W_ERROR(0x6)},
680         {NT_STATUS(0xc0000039), W_ERROR(0xa1)},
681         {NT_STATUS(0xc000003a), W_ERROR(0x3)},
682         {NT_STATUS(0xc000003b), W_ERROR(0xa1)},
683         {NT_STATUS(0xc000003c), W_ERROR(0x45d)},
684         {NT_STATUS(0xc000003d), W_ERROR(0x45d)},
685         {NT_STATUS(0xc000003e), W_ERROR(0x17)},
686         {NT_STATUS(0xc000003f), W_ERROR(0x17)},
687         {NT_STATUS(0xc0000040), W_ERROR(0x8)},
688         {NT_STATUS(0xc0000041), W_ERROR(0x5)},
689         {NT_STATUS(0xc0000042), W_ERROR(0x6)},
690         {NT_STATUS(0xc0000043), W_ERROR(0x20)},
691         {NT_STATUS(0xc0000044), W_ERROR(0x718)},
692         {NT_STATUS(0xc0000045), W_ERROR(0x57)},
693         {NT_STATUS(0xc0000046), W_ERROR(0x120)},
694         {NT_STATUS(0xc0000047), W_ERROR(0x12a)},
695         {NT_STATUS(0xc0000048), W_ERROR(0x57)},
696         {NT_STATUS(0xc0000049), W_ERROR(0x57)},
697         {NT_STATUS(0xc000004a), W_ERROR(0x9c)},
698         {NT_STATUS(0xc000004b), W_ERROR(0x5)},
699         {NT_STATUS(0xc000004c), W_ERROR(0x57)},
700         {NT_STATUS(0xc000004d), W_ERROR(0x57)},
701         {NT_STATUS(0xc000004e), W_ERROR(0x57)},
702         {NT_STATUS(0xc000004f), W_ERROR(0x11a)},
703         {NT_STATUS(0xc0000050), W_ERROR(0xff)},
704         {NT_STATUS(0xc0000051), W_ERROR(0x570)},
705         {NT_STATUS(0xc0000052), W_ERROR(0x570)},
706         {NT_STATUS(0xc0000053), W_ERROR(0x570)},
707         {NT_STATUS(0xc0000054), W_ERROR(0x21)},
708         {NT_STATUS(0xc0000055), W_ERROR(0x21)},
709         {NT_STATUS(0xc0000056), W_ERROR(0x5)},
710         {NT_STATUS(0xc0000057), W_ERROR(0x32)},
711         {NT_STATUS(0xc0000058), W_ERROR(0x519)},
712         {NT_STATUS(0xc0000059), W_ERROR(0x51a)},
713         {NT_STATUS(0xc000005a), W_ERROR(0x51b)},
714         {NT_STATUS(0xc000005b), W_ERROR(0x51c)},
715         {NT_STATUS(0xc000005c), W_ERROR(0x51d)},
716         {NT_STATUS(0xc000005d), W_ERROR(0x51e)},
717         {NT_STATUS(0xc000005e), W_ERROR(0x51f)},
718         {NT_STATUS(0xc000005f), W_ERROR(0x520)},
719         {NT_STATUS(0xc0000060), W_ERROR(0x521)},
720         {NT_STATUS(0xc0000061), W_ERROR(0x522)},
721         {NT_STATUS(0xc0000062), W_ERROR(0x523)},
722         {NT_STATUS(0xc0000063), W_ERROR(0x524)},
723         {NT_STATUS(0xc0000064), W_ERROR(0x525)},
724         {NT_STATUS(0xc0000065), W_ERROR(0x526)},
725         {NT_STATUS(0xc0000066), W_ERROR(0x527)},
726         {NT_STATUS(0xc0000067), W_ERROR(0x528)},
727         {NT_STATUS(0xc0000068), W_ERROR(0x529)},
728         {NT_STATUS(0xc0000069), W_ERROR(0x52a)},
729         {NT_STATUS(0xc000006a), W_ERROR(0x56)},
730         {NT_STATUS(0xc000006b), W_ERROR(0x52c)},
731         {NT_STATUS(0xc000006c), W_ERROR(0x52d)},
732         {NT_STATUS(0xc000006d), W_ERROR(0x52e)},
733         {NT_STATUS(0xc000006e), W_ERROR(0x52f)},
734         {NT_STATUS(0xc000006f), W_ERROR(0x530)},
735         {NT_STATUS(0xc0000070), W_ERROR(0x531)},
736         {NT_STATUS(0xc0000071), W_ERROR(0x532)},
737         {NT_STATUS(0xc0000072), W_ERROR(0x533)},
738         {NT_STATUS(0xc0000073), W_ERROR(0x534)},
739         {NT_STATUS(0xc0000074), W_ERROR(0x535)},
740         {NT_STATUS(0xc0000075), W_ERROR(0x536)},
741         {NT_STATUS(0xc0000076), W_ERROR(0x537)},
742         {NT_STATUS(0xc0000077), W_ERROR(0x538)},
743         {NT_STATUS(0xc0000078), W_ERROR(0x539)},
744         {NT_STATUS(0xc0000079), W_ERROR(0x53a)},
745         {NT_STATUS(0xc000007a), W_ERROR(0x7f)},
746         {NT_STATUS(0xc000007b), W_ERROR(0xc1)},
747         {NT_STATUS(0xc000007c), W_ERROR(0x3f0)},
748         {NT_STATUS(0xc000007d), W_ERROR(0x53c)},
749         {NT_STATUS(0xc000007e), W_ERROR(0x9e)},
750         {NT_STATUS(0xc000007f), W_ERROR(0x70)},
751         {NT_STATUS(0xc0000080), W_ERROR(0x53d)},
752         {NT_STATUS(0xc0000081), W_ERROR(0x53e)},
753         {NT_STATUS(0xc0000082), W_ERROR(0x44)},
754         {NT_STATUS(0xc0000083), W_ERROR(0x103)},
755         {NT_STATUS(0xc0000084), W_ERROR(0x53f)},
756         {NT_STATUS(0xc0000085), W_ERROR(0x103)},
757         {NT_STATUS(0xc0000086), W_ERROR(0x9a)},
758         {NT_STATUS(0xc0000087), W_ERROR(0xe)},
759         {NT_STATUS(0xc0000088), W_ERROR(0x1e7)},
760         {NT_STATUS(0xc0000089), W_ERROR(0x714)},
761         {NT_STATUS(0xc000008a), W_ERROR(0x715)},
762         {NT_STATUS(0xc000008b), W_ERROR(0x716)},
763         {NT_STATUS(0xc000008c), W_ERROR(0xc000008c)},
764         {NT_STATUS(0xc000008d), W_ERROR(0xc000008d)},
765         {NT_STATUS(0xc000008e), W_ERROR(0xc000008e)},
766         {NT_STATUS(0xc000008f), W_ERROR(0xc000008f)},
767         {NT_STATUS(0xc0000090), W_ERROR(0xc0000090)},
768         {NT_STATUS(0xc0000091), W_ERROR(0xc0000091)},
769         {NT_STATUS(0xc0000092), W_ERROR(0xc0000092)},
770         {NT_STATUS(0xc0000093), W_ERROR(0xc0000093)},
771         {NT_STATUS(0xc0000094), W_ERROR(0xc0000094)},
772         {NT_STATUS(0xc0000095), W_ERROR(0x216)},
773         {NT_STATUS(0xc0000096), W_ERROR(0xc0000096)},
774         {NT_STATUS(0xc0000097), W_ERROR(0x8)},
775         {NT_STATUS(0xc0000098), W_ERROR(0x3ee)},
776         {NT_STATUS(0xc0000099), W_ERROR(0x540)},
777         {NT_STATUS(0xc000009a), W_ERROR(0x5aa)},
778         {NT_STATUS(0xc000009b), W_ERROR(0x3)},
779         {NT_STATUS(0xc000009c), W_ERROR(0x17)},
780         {NT_STATUS(0xc000009d), W_ERROR(0x48f)},
781         {NT_STATUS(0xc000009e), W_ERROR(0x15)},
782         {NT_STATUS(0xc000009f), W_ERROR(0x1e7)},
783         {NT_STATUS(0xc00000a0), W_ERROR(0x1e7)},
784         {NT_STATUS(0xc00000a1), W_ERROR(0x5ad)},
785         {NT_STATUS(0xc00000a2), W_ERROR(0x13)},
786         {NT_STATUS(0xc00000a3), W_ERROR(0x15)},
787         {NT_STATUS(0xc00000a4), W_ERROR(0x541)},
788         {NT_STATUS(0xc00000a5), W_ERROR(0x542)},
789         {NT_STATUS(0xc00000a6), W_ERROR(0x543)},
790         {NT_STATUS(0xc00000a7), W_ERROR(0x544)},
791         {NT_STATUS(0xc00000a8), W_ERROR(0x545)},
792         {NT_STATUS(0xc00000a9), W_ERROR(0x57)},
793         {NT_STATUS(0xc00000ab), W_ERROR(0xe7)},
794         {NT_STATUS(0xc00000ac), W_ERROR(0xe7)},
795         {NT_STATUS(0xc00000ad), W_ERROR(0xe6)},
796         {NT_STATUS(0xc00000ae), W_ERROR(0xe7)},
797         {NT_STATUS(0xc00000af), W_ERROR(0x1)},
798         {NT_STATUS(0xc00000b0), W_ERROR(0xe9)},
799         {NT_STATUS(0xc00000b1), W_ERROR(0xe8)},
800         {NT_STATUS(0xc00000b2), W_ERROR(0x217)},
801         {NT_STATUS(0xc00000b3), W_ERROR(0x218)},
802         {NT_STATUS(0xc00000b4), W_ERROR(0xe6)},
803         {NT_STATUS(0xc00000b5), W_ERROR(0x79)},
804         {NT_STATUS(0xc00000b6), W_ERROR(0x26)},
805         {NT_STATUS(0xc00000ba), W_ERROR(0x5)},
806         {NT_STATUS(0xc00000bb), W_ERROR(0x32)},
807         {NT_STATUS(0xc00000bc), W_ERROR(0x33)},
808         {NT_STATUS(0xc00000bd), W_ERROR(0x34)},
809         {NT_STATUS(0xc00000be), W_ERROR(0x35)},
810         {NT_STATUS(0xc00000bf), W_ERROR(0x36)},
811         {NT_STATUS(0xc00000c0), W_ERROR(0x37)},
812         {NT_STATUS(0xc00000c1), W_ERROR(0x38)},
813         {NT_STATUS(0xc00000c2), W_ERROR(0x39)},
814         {NT_STATUS(0xc00000c3), W_ERROR(0x3a)},
815         {NT_STATUS(0xc00000c4), W_ERROR(0x3b)},
816         {NT_STATUS(0xc00000c5), W_ERROR(0x3c)},
817         {NT_STATUS(0xc00000c6), W_ERROR(0x3d)},
818         {NT_STATUS(0xc00000c7), W_ERROR(0x3e)},
819         {NT_STATUS(0xc00000c8), W_ERROR(0x3f)},
820         {NT_STATUS(0xc00000c9), W_ERROR(0x40)},
821         {NT_STATUS(0xc00000ca), W_ERROR(0x41)},
822         {NT_STATUS(0xc00000cb), W_ERROR(0x42)},
823         {NT_STATUS(0xc00000cc), W_ERROR(0x43)},
824         {NT_STATUS(0xc00000cd), W_ERROR(0x44)},
825         {NT_STATUS(0xc00000ce), W_ERROR(0x45)},
826         {NT_STATUS(0xc00000cf), W_ERROR(0x46)},
827         {NT_STATUS(0xc00000d0), W_ERROR(0x47)},
828         {NT_STATUS(0xc00000d1), W_ERROR(0x48)},
829         {NT_STATUS(0xc00000d2), W_ERROR(0x58)},
830         {NT_STATUS(0xc00000d4), W_ERROR(0x11)},
831         {NT_STATUS(0xc00000d5), W_ERROR(0x5)},
832         {NT_STATUS(0xc00000d6), W_ERROR(0xf0)},
833         {NT_STATUS(0xc00000d7), W_ERROR(0x546)},
834         {NT_STATUS(0xc00000d9), W_ERROR(0xe8)},
835         {NT_STATUS(0xc00000da), W_ERROR(0x547)},
836         {NT_STATUS(0xc00000dc), W_ERROR(0x548)},
837         {NT_STATUS(0xc00000dd), W_ERROR(0x549)},
838         {NT_STATUS(0xc00000de), W_ERROR(0x54a)},
839         {NT_STATUS(0xc00000df), W_ERROR(0x54b)},
840         {NT_STATUS(0xc00000e0), W_ERROR(0x54c)},
841         {NT_STATUS(0xc00000e1), W_ERROR(0x54d)},
842         {NT_STATUS(0xc00000e2), W_ERROR(0x12c)},
843         {NT_STATUS(0xc00000e3), W_ERROR(0x12d)},
844         {NT_STATUS(0xc00000e4), W_ERROR(0x54e)},
845         {NT_STATUS(0xc00000e5), W_ERROR(0x54f)},
846         {NT_STATUS(0xc00000e6), W_ERROR(0x550)},
847         {NT_STATUS(0xc00000e7), W_ERROR(0x551)},
848         {NT_STATUS(0xc00000e8), W_ERROR(0x6f8)},
849         {NT_STATUS(0xc00000ed), W_ERROR(0x552)},
850         {NT_STATUS(0xc00000ee), W_ERROR(0x553)},
851         {NT_STATUS(0xc00000ef), W_ERROR(0x57)},
852         {NT_STATUS(0xc00000f0), W_ERROR(0x57)},
853         {NT_STATUS(0xc00000f1), W_ERROR(0x57)},
854         {NT_STATUS(0xc00000f2), W_ERROR(0x57)},
855         {NT_STATUS(0xc00000f3), W_ERROR(0x57)},
856         {NT_STATUS(0xc00000f4), W_ERROR(0x57)},
857         {NT_STATUS(0xc00000f5), W_ERROR(0x57)},
858         {NT_STATUS(0xc00000f6), W_ERROR(0x57)},
859         {NT_STATUS(0xc00000f7), W_ERROR(0x57)},
860         {NT_STATUS(0xc00000f8), W_ERROR(0x57)},
861         {NT_STATUS(0xc00000f9), W_ERROR(0x57)},
862         {NT_STATUS(0xc00000fa), W_ERROR(0x57)},
863         {NT_STATUS(0xc00000fb), W_ERROR(0x3)},
864         {NT_STATUS(0xc00000fd), W_ERROR(0x3e9)},
865         {NT_STATUS(0xc00000fe), W_ERROR(0x554)},
866         {NT_STATUS(0xc0000100), W_ERROR(0xcb)},
867         {NT_STATUS(0xc0000101), W_ERROR(0x91)},
868         {NT_STATUS(0xc0000102), W_ERROR(0x570)},
869         {NT_STATUS(0xc0000103), W_ERROR(0x10b)},
870         {NT_STATUS(0xc0000104), W_ERROR(0x555)},
871         {NT_STATUS(0xc0000105), W_ERROR(0x556)},
872         {NT_STATUS(0xc0000106), W_ERROR(0xce)},
873         {NT_STATUS(0xc0000107), W_ERROR(0x961)},
874         {NT_STATUS(0xc0000108), W_ERROR(0x964)},
875         {NT_STATUS(0xc000010a), W_ERROR(0x5)},
876         {NT_STATUS(0xc000010b), W_ERROR(0x557)},
877         {NT_STATUS(0xc000010d), W_ERROR(0x558)},
878         {NT_STATUS(0xc000010e), W_ERROR(0x420)},
879         {NT_STATUS(0xc0000117), W_ERROR(0x5a4)},
880         {NT_STATUS(0xc000011b), W_ERROR(0xc1)},
881         {NT_STATUS(0xc000011c), W_ERROR(0x559)},
882         {NT_STATUS(0xc000011d), W_ERROR(0x55a)},
883         {NT_STATUS(0xc000011e), W_ERROR(0x3ee)},
884         {NT_STATUS(0xc000011f), W_ERROR(0x4)},
885         {NT_STATUS(0xc0000120), W_ERROR(0x3e3)},
886         {NT_STATUS(0xc0000121), W_ERROR(0x5)},
887         {NT_STATUS(0xc0000122), W_ERROR(0x4ba)},
888         {NT_STATUS(0xc0000123), W_ERROR(0x5)},
889         {NT_STATUS(0xc0000124), W_ERROR(0x55b)},
890         {NT_STATUS(0xc0000125), W_ERROR(0x55c)},
891         {NT_STATUS(0xc0000126), W_ERROR(0x55d)},
892         {NT_STATUS(0xc0000127), W_ERROR(0x55e)},
893         {NT_STATUS(0xc0000128), W_ERROR(0x6)},
894         {NT_STATUS(0xc000012b), W_ERROR(0x55f)},
895         {NT_STATUS(0xc000012d), W_ERROR(0x5af)},
896         {NT_STATUS(0xc000012e), W_ERROR(0xc1)},
897         {NT_STATUS(0xc000012f), W_ERROR(0xc1)},
898         {NT_STATUS(0xc0000130), W_ERROR(0xc1)},
899         {NT_STATUS(0xc0000131), W_ERROR(0xc1)},
900         {NT_STATUS(0xc0000133), W_ERROR(0x576)},
901         {NT_STATUS(0xc0000135), W_ERROR(0x7e)},
902         {NT_STATUS(0xc0000138), W_ERROR(0xb6)},
903         {NT_STATUS(0xc0000139), W_ERROR(0x7f)},
904         {NT_STATUS(0xc000013b), W_ERROR(0x40)},
905         {NT_STATUS(0xc000013c), W_ERROR(0x40)},
906         {NT_STATUS(0xc000013d), W_ERROR(0x33)},
907         {NT_STATUS(0xc000013e), W_ERROR(0x3b)},
908         {NT_STATUS(0xc000013f), W_ERROR(0x3b)},
909         {NT_STATUS(0xc0000140), W_ERROR(0x3b)},
910         {NT_STATUS(0xc0000141), W_ERROR(0x3b)},
911         {NT_STATUS(0xc0000142), W_ERROR(0x45a)},
912         {NT_STATUS(0xc0000148), W_ERROR(0x7c)},
913         {NT_STATUS(0xc0000149), W_ERROR(0x56)},
914         {NT_STATUS(0xc000014b), W_ERROR(0x6d)},
915         {NT_STATUS(0xc000014c), W_ERROR(0x3f1)},
916         {NT_STATUS(0xc000014d), W_ERROR(0x3f8)},
917         {NT_STATUS(0xc000014f), W_ERROR(0x3ed)},
918         {NT_STATUS(0xc0000150), W_ERROR(0x45e)},
919         {NT_STATUS(0xc0000151), W_ERROR(0x560)},
920         {NT_STATUS(0xc0000152), W_ERROR(0x561)},
921         {NT_STATUS(0xc0000153), W_ERROR(0x562)},
922         {NT_STATUS(0xc0000154), W_ERROR(0x563)},
923         {NT_STATUS(0xc0000155), W_ERROR(0x564)},
924         {NT_STATUS(0xc0000156), W_ERROR(0x565)},
925         {NT_STATUS(0xc0000157), W_ERROR(0x566)},
926         {NT_STATUS(0xc0000158), W_ERROR(0x567)},
927         {NT_STATUS(0xc0000159), W_ERROR(0x3ef)},
928         {NT_STATUS(0xc000015a), W_ERROR(0x568)},
929         {NT_STATUS(0xc000015b), W_ERROR(0x569)},
930         {NT_STATUS(0xc000015c), W_ERROR(0x3f9)},
931         {NT_STATUS(0xc000015d), W_ERROR(0x56a)},
932         {NT_STATUS(0xc000015f), W_ERROR(0x45d)},
933         {NT_STATUS(0xc0000162), W_ERROR(0x459)},
934         {NT_STATUS(0xc0000165), W_ERROR(0x462)},
935         {NT_STATUS(0xc0000166), W_ERROR(0x463)},
936         {NT_STATUS(0xc0000167), W_ERROR(0x464)},
937         {NT_STATUS(0xc0000168), W_ERROR(0x465)},
938         {NT_STATUS(0xc0000169), W_ERROR(0x466)},
939         {NT_STATUS(0xc000016a), W_ERROR(0x467)},
940         {NT_STATUS(0xc000016b), W_ERROR(0x468)},
941         {NT_STATUS(0xc000016c), W_ERROR(0x45f)},
942         {NT_STATUS(0xc000016d), W_ERROR(0x45d)},
943         {NT_STATUS(0xc0000172), W_ERROR(0x451)},
944         {NT_STATUS(0xc0000173), W_ERROR(0x452)},
945         {NT_STATUS(0xc0000174), W_ERROR(0x453)},
946         {NT_STATUS(0xc0000175), W_ERROR(0x454)},
947         {NT_STATUS(0xc0000176), W_ERROR(0x455)},
948         {NT_STATUS(0xc0000177), W_ERROR(0x469)},
949         {NT_STATUS(0xc0000178), W_ERROR(0x458)},
950         {NT_STATUS(0xc000017a), W_ERROR(0x56b)},
951         {NT_STATUS(0xc000017b), W_ERROR(0x56c)},
952         {NT_STATUS(0xc000017c), W_ERROR(0x3fa)},
953         {NT_STATUS(0xc000017d), W_ERROR(0x3fb)},
954         {NT_STATUS(0xc000017e), W_ERROR(0x56d)},
955         {NT_STATUS(0xc000017f), W_ERROR(0x56e)},
956         {NT_STATUS(0xc0000180), W_ERROR(0x3fc)},
957         {NT_STATUS(0xc0000181), W_ERROR(0x3fd)},
958         {NT_STATUS(0xc0000182), W_ERROR(0x57)},
959         {NT_STATUS(0xc0000183), W_ERROR(0x45d)},
960         {NT_STATUS(0xc0000184), W_ERROR(0x16)},
961         {NT_STATUS(0xc0000185), W_ERROR(0x45d)},
962         {NT_STATUS(0xc0000186), W_ERROR(0x45d)},
963         {NT_STATUS(0xc0000188), W_ERROR(0x5de)},
964         {NT_STATUS(0xc0000189), W_ERROR(0x13)},
965         {NT_STATUS(0xc000018a), W_ERROR(0x6fa)},
966         {NT_STATUS(0xc000018b), W_ERROR(0x6fb)},
967         {NT_STATUS(0xc000018c), W_ERROR(0x6fc)},
968         {NT_STATUS(0xc000018d), W_ERROR(0x6fd)},
969         {NT_STATUS(0xc000018e), W_ERROR(0x5dc)},
970         {NT_STATUS(0xc000018f), W_ERROR(0x5dd)},
971         {NT_STATUS(0xc0000190), W_ERROR(0x6fe)},
972         {NT_STATUS(0xc0000192), W_ERROR(0x700)},
973         {NT_STATUS(0xc0000193), W_ERROR(0x701)},
974         {NT_STATUS(0xc0000194), W_ERROR(0x46b)},
975         {NT_STATUS(0xc0000195), W_ERROR(0x4c3)},
976         {NT_STATUS(0xc0000196), W_ERROR(0x4c4)},
977         {NT_STATUS(0xc0000197), W_ERROR(0x5df)},
978         {NT_STATUS(0xc0000198), W_ERROR(0x70f)},
979         {NT_STATUS(0xc0000199), W_ERROR(0x710)},
980         {NT_STATUS(0xc000019a), W_ERROR(0x711)},
981         {NT_STATUS(0xc000019b), W_ERROR(0x712)},
982         {NT_STATUS(0xc0000202), W_ERROR(0x572)},
983         {NT_STATUS(0xc0000203), W_ERROR(0x3b)},
984         {NT_STATUS(0xc0000204), W_ERROR(0x717)},
985         {NT_STATUS(0xc0000205), W_ERROR(0x46a)},
986         {NT_STATUS(0xc0000206), W_ERROR(0x6f8)},
987         {NT_STATUS(0xc0000207), W_ERROR(0x4be)},
988         {NT_STATUS(0xc0000208), W_ERROR(0x4be)},
989         {NT_STATUS(0xc0000209), W_ERROR(0x44)},
990         {NT_STATUS(0xc000020a), W_ERROR(0x34)},
991         {NT_STATUS(0xc000020b), W_ERROR(0x40)},
992         {NT_STATUS(0xc000020c), W_ERROR(0x40)},
993         {NT_STATUS(0xc000020d), W_ERROR(0x40)},
994         {NT_STATUS(0xc000020e), W_ERROR(0x44)},
995         {NT_STATUS(0xc000020f), W_ERROR(0x3b)},
996         {NT_STATUS(0xc0000210), W_ERROR(0x3b)},
997         {NT_STATUS(0xc0000211), W_ERROR(0x3b)},
998         {NT_STATUS(0xc0000212), W_ERROR(0x3b)},
999         {NT_STATUS(0xc0000213), W_ERROR(0x3b)},
1000         {NT_STATUS(0xc0000214), W_ERROR(0x3b)},
1001         {NT_STATUS(0xc0000215), W_ERROR(0x3b)},
1002         {NT_STATUS(0xc0000216), W_ERROR(0x32)},
1003         {NT_STATUS(0xc0000217), W_ERROR(0x32)},
1004         {NT_STATUS(0xc000021c), W_ERROR(0x17e6)},
1005         {NT_STATUS(0xc0000220), W_ERROR(0x46c)},
1006         {NT_STATUS(0xc0000221), W_ERROR(0xc1)},
1007         {NT_STATUS(0xc0000224), W_ERROR(0x773)},
1008         {NT_STATUS(0xc0000225), W_ERROR(0x490)},
1009         {NT_STATUS(0xc000022a), W_ERROR(0xc000022a)},
1010         {NT_STATUS(0xc000022b), W_ERROR(0xc000022b)},
1011         {NT_STATUS(0xc000022d), W_ERROR(0x4d5)},
1012         {NT_STATUS(0xc0000230), W_ERROR(0x492)},
1013         {NT_STATUS(0xc0000233), W_ERROR(0x774)},
1014         {NT_STATUS(0xc0000234), W_ERROR(0x775)},
1015         {NT_STATUS(0xc0000235), W_ERROR(0x6)},
1016         {NT_STATUS(0xc0000236), W_ERROR(0x4c9)},
1017         {NT_STATUS(0xc0000237), W_ERROR(0x4ca)},
1018         {NT_STATUS(0xc0000238), W_ERROR(0x4cb)},
1019         {NT_STATUS(0xc0000239), W_ERROR(0x4cc)},
1020         {NT_STATUS(0xc000023a), W_ERROR(0x4cd)},
1021         {NT_STATUS(0xc000023b), W_ERROR(0x4ce)},
1022         {NT_STATUS(0xc000023c), W_ERROR(0x4cf)},
1023         {NT_STATUS(0xc000023d), W_ERROR(0x4d0)},
1024         {NT_STATUS(0xc000023e), W_ERROR(0x4d1)},
1025         {NT_STATUS(0xc000023f), W_ERROR(0x4d2)},
1026         {NT_STATUS(0xc0000240), W_ERROR(0x4d3)},
1027         {NT_STATUS(0xc0000241), W_ERROR(0x4d4)},
1028         {NT_STATUS(0xc0000243), W_ERROR(0x4c8)},
1029         {NT_STATUS(0xc0000246), W_ERROR(0x4d6)},
1030         {NT_STATUS(0xc0000247), W_ERROR(0x4d7)},
1031         {NT_STATUS(0xc0000248), W_ERROR(0x4d8)},
1032         {NT_STATUS(0xc0000249), W_ERROR(0xc1)},
1033         {NT_STATUS(0xc0000253), W_ERROR(0x54f)},
1034         {NT_STATUS(0xc0000257), W_ERROR(0x4d0)},
1035         {NT_STATUS(0xc0000259), W_ERROR(0x573)},
1036         {NT_STATUS(0xc000025e), W_ERROR(0x422)},
1037         {NT_STATUS(0xc0000262), W_ERROR(0xb6)},
1038         {NT_STATUS(0xc0000263), W_ERROR(0x7f)},
1039         {NT_STATUS(0xc0000264), W_ERROR(0x120)},
1040         {NT_STATUS(0xc0000265), W_ERROR(0x476)},
1041         {NT_STATUS(0xc0000267), W_ERROR(0x10fe)},
1042         {NT_STATUS(0xc000026c), W_ERROR(0x7d1)},
1043         {NT_STATUS(0xc000026d), W_ERROR(0x4b1)},
1044         {NT_STATUS(0xc000026e), W_ERROR(0x15)},
1045         {NT_STATUS(0xc0000272), W_ERROR(0x491)},
1046         {NT_STATUS(0xc0000275), W_ERROR(0x1126)},
1047         {NT_STATUS(0xc0000276), W_ERROR(0x1129)},
1048         {NT_STATUS(0xc0000277), W_ERROR(0x112a)},
1049         {NT_STATUS(0xc0000278), W_ERROR(0x1128)},
1050         {NT_STATUS(0xc0000279), W_ERROR(0x780)},
1051         {NT_STATUS(0xc0000280), W_ERROR(0x781)},
1052         {NT_STATUS(0xc0000281), W_ERROR(0xa1)},
1053         {NT_STATUS(0xc0000283), W_ERROR(0x488)},
1054         {NT_STATUS(0xc0000284), W_ERROR(0x489)},
1055         {NT_STATUS(0xc0000285), W_ERROR(0x48a)},
1056         {NT_STATUS(0xc0000286), W_ERROR(0x48b)},
1057         {NT_STATUS(0xc0000287), W_ERROR(0x48c)},
1058         {NT_STATUS(0xc000028a), W_ERROR(0x5)},
1059         {NT_STATUS(0xc000028b), W_ERROR(0x5)},
1060         {NT_STATUS(0xc000028d), W_ERROR(0x5)},
1061         {NT_STATUS(0xc000028e), W_ERROR(0x5)},
1062         {NT_STATUS(0xc000028f), W_ERROR(0x5)},
1063         {NT_STATUS(0xc0000290), W_ERROR(0x5)},
1064         {NT_STATUS(0xc0000291), W_ERROR(0x1777)},
1065         {NT_STATUS(0xc0000292), W_ERROR(0x1778)},
1066         {NT_STATUS(0xc0000293), W_ERROR(0x1772)},
1067         {NT_STATUS(0xc0000295), W_ERROR(0x1068)},
1068         {NT_STATUS(0xc0000296), W_ERROR(0x1069)},
1069         {NT_STATUS(0xc0000297), W_ERROR(0x106a)},
1070         {NT_STATUS(0xc0000298), W_ERROR(0x106b)},
1071         {NT_STATUS(0xc0000299), W_ERROR(0x201a)},
1072         {NT_STATUS(0xc000029a), W_ERROR(0x201b)},
1073         {NT_STATUS(0xc000029b), W_ERROR(0x201c)},
1074         {NT_STATUS(0xc000029c), W_ERROR(0x1)},
1075         {NT_STATUS(0xc000029d), W_ERROR(0x10ff)},
1076         {NT_STATUS(0xc000029e), W_ERROR(0x1100)},
1077         {NT_STATUS(0xc000029f), W_ERROR(0x494)},
1078         {NT_STATUS(0xc00002a1), W_ERROR(0x200a)},
1079         {NT_STATUS(0xc00002a2), W_ERROR(0x200b)},
1080         {NT_STATUS(0xc00002a3), W_ERROR(0x200c)},
1081         {NT_STATUS(0xc00002a4), W_ERROR(0x200d)},
1082         {NT_STATUS(0xc00002a5), W_ERROR(0x200e)},
1083         {NT_STATUS(0xc00002a6), W_ERROR(0x200f)},
1084         {NT_STATUS(0xc00002a7), W_ERROR(0x2010)},
1085         {NT_STATUS(0xc00002a8), W_ERROR(0x2011)},
1086         {NT_STATUS(0xc00002a9), W_ERROR(0x2012)},
1087         {NT_STATUS(0xc00002aa), W_ERROR(0x2013)},
1088         {NT_STATUS(0xc00002ab), W_ERROR(0x2014)},
1089         {NT_STATUS(0xc00002ac), W_ERROR(0x2015)},
1090         {NT_STATUS(0xc00002ad), W_ERROR(0x2016)},
1091         {NT_STATUS(0xc00002ae), W_ERROR(0x2017)},
1092         {NT_STATUS(0xc00002af), W_ERROR(0x2018)},
1093         {NT_STATUS(0xc00002b0), W_ERROR(0x2019)},
1094         {NT_STATUS(0xc00002b1), W_ERROR(0x211e)},
1095         {NT_STATUS(0xc00002b2), W_ERROR(0x1127)},
1096         {NT_STATUS(0xc00002b6), W_ERROR(0x651)},
1097         {NT_STATUS(0xc00002b7), W_ERROR(0x49a)},
1098         {NT_STATUS(0xc00002b8), W_ERROR(0x49b)},
1099         {NT_STATUS(0xc00002c1), W_ERROR(0x2024)},
1100         {NT_STATUS(0xc00002c3), W_ERROR(0x575)},
1101         {NT_STATUS(0xc00002c5), W_ERROR(0x3e6)},
1102         {NT_STATUS(0xc00002c6), W_ERROR(0x1075)},
1103         {NT_STATUS(0xc00002c7), W_ERROR(0x1076)},
1104         {NT_STATUS(0xc00002ca), W_ERROR(0x10e8)},
1105         {NT_STATUS(0xc00002cb), W_ERROR(0x2138)},
1106         {NT_STATUS(0xc00002cc), W_ERROR(0x4e3)},
1107         {NT_STATUS(0xc00002cd), W_ERROR(0x2139)},
1108         {NT_STATUS(0xc00002cf), W_ERROR(0x49d)},
1109         {NT_STATUS(0xc00002d0), W_ERROR(0x213a)},
1110         {NT_STATUS(0xc00002d4), W_ERROR(0x2141)},
1111         {NT_STATUS(0xc00002d5), W_ERROR(0x2142)},
1112         {NT_STATUS(0xc00002d6), W_ERROR(0x2143)},
1113         {NT_STATUS(0xc00002d7), W_ERROR(0x2144)},
1114         {NT_STATUS(0xc00002d8), W_ERROR(0x2145)},
1115         {NT_STATUS(0xc00002d9), W_ERROR(0x2146)},
1116         {NT_STATUS(0xc00002da), W_ERROR(0x2147)},
1117         {NT_STATUS(0xc00002db), W_ERROR(0x2148)},
1118         {NT_STATUS(0xc00002dc), W_ERROR(0x2149)},
1119         {NT_STATUS(0xc00002dd), W_ERROR(0x32)},
1120         {NT_STATUS(0xc00002df), W_ERROR(0x2151)},
1121         {NT_STATUS(0xc00002e0), W_ERROR(0x2152)},
1122         {NT_STATUS(0xc00002e1), W_ERROR(0x2153)},
1123         {NT_STATUS(0xc00002e2), W_ERROR(0x2154)},
1124         {NT_STATUS(0xc00002e3), W_ERROR(0x215d)},
1125         {NT_STATUS(0xc00002e4), W_ERROR(0x2163)},
1126         {NT_STATUS(0xc00002e5), W_ERROR(0x2164)},
1127         {NT_STATUS(0xc00002e6), W_ERROR(0x2165)},
1128         {NT_STATUS(0xc00002e7), W_ERROR(0x216d)},
1129         {NT_STATUS(0xc00002fe), W_ERROR(0x45b)},
1130         {NT_STATUS(0xc00002ff), W_ERROR(0x4e7)},
1131         {NT_STATUS(0xc0000300), W_ERROR(0x4e6)},
1132         {NT_STATUS(0x80000001), W_ERROR(0x80000001)},
1133         {NT_STATUS(0x80000002), W_ERROR(0x3e6)},
1134         {NT_STATUS(0x80000003), W_ERROR(0x80000003)},
1135         {NT_STATUS(0x80000004), W_ERROR(0x80000004)},
1136         {NT_STATUS(0x80000005), W_ERROR(0xea)},
1137         {NT_STATUS(0x80000006), W_ERROR(0x12)},
1138         {NT_STATUS(0x8000000b), W_ERROR(0x56f)},
1139         {NT_STATUS(0x8000000d), W_ERROR(0x12b)},
1140         {NT_STATUS(0x8000000e), W_ERROR(0x1c)},
1141         {NT_STATUS(0x8000000f), W_ERROR(0x15)},
1142         {NT_STATUS(0x80000010), W_ERROR(0x15)},
1143         {NT_STATUS(0x80000011), W_ERROR(0xaa)},
1144         {NT_STATUS(0x80000012), W_ERROR(0x103)},
1145         {NT_STATUS(0x80000013), W_ERROR(0xfe)},
1146         {NT_STATUS(0x80000014), W_ERROR(0xff)},
1147         {NT_STATUS(0x80000015), W_ERROR(0xff)},
1148         {NT_STATUS(0x80000016), W_ERROR(0x456)},
1149         {NT_STATUS(0x8000001a), W_ERROR(0x103)},
1150         {NT_STATUS(0x8000001b), W_ERROR(0x44d)},
1151         {NT_STATUS(0x8000001c), W_ERROR(0x456)},
1152         {NT_STATUS(0x8000001d), W_ERROR(0x457)},
1153         {NT_STATUS(0x8000001e), W_ERROR(0x44c)},
1154         {NT_STATUS(0x8000001f), W_ERROR(0x44e)},
1155         {NT_STATUS(0x80000021), W_ERROR(0x44f)},
1156         {NT_STATUS(0x80000022), W_ERROR(0x450)},
1157         {NT_STATUS(0x80000025), W_ERROR(0x962)},
1158         {NT_STATUS(0x80000288), W_ERROR(0x48d)},
1159         {NT_STATUS(0x80000289), W_ERROR(0x48e)},
1160         {NT_STATUS_OK, WERR_OK}};
1161
1162
1163 /*
1164   check if a DOS encoded NTSTATUS code maps to the given NTSTATUS code
1165 */
1166 bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2)
1167 {
1168         /* when we negotiate nt status support, we don't want to consider
1169            the mapping of dos codes, as we want to catch the cases where
1170            a forced dos code is needed
1171         */
1172         if (lp_nt_status_support(global_loadparm)) {
1173                 return NT_STATUS_V(status1) == NT_STATUS_V(status2);
1174         }
1175
1176         /* otherwise check if the mapping comes out right. Note that it is important
1177            that we do the mapping only from ntstatus -> dos and not from dos -> ntstatus,
1178            as that is the mapping that servers must do */
1179         if (!NT_STATUS_IS_DOS(status1) && NT_STATUS_IS_DOS(status2)) {
1180                 uint8_t eclass;
1181                 uint32_t ecode;
1182                 ntstatus_to_dos(status1, &eclass, &ecode);
1183                 return eclass == NT_STATUS_DOS_CLASS(status2) &&
1184                         ecode == NT_STATUS_DOS_CODE(status2);
1185         }
1186         if (NT_STATUS_IS_DOS(status1) && !NT_STATUS_IS_DOS(status2)) {
1187                 uint8_t eclass;
1188                 uint32_t ecode;
1189                 ntstatus_to_dos(status2, &eclass, &ecode);
1190                 return eclass == NT_STATUS_DOS_CLASS(status1) &&
1191                         ecode == NT_STATUS_DOS_CODE(status1);
1192         }
1193         return NT_STATUS_V(status1) == NT_STATUS_V(status2);
1194 }
1195
1196 /*****************************************************************************
1197 convert a NT status code to a dos class/code
1198  *****************************************************************************/
1199 void ntstatus_to_dos(NTSTATUS ntstatus, uint8_t *eclass, uint32_t *ecode)
1200 {
1201         int i;
1202         if (NT_STATUS_IS_OK(ntstatus)) {
1203                 *eclass = 0;
1204                 *ecode = 0;
1205                 return;
1206         }
1207         if (NT_STATUS_IS_DOS(ntstatus)) {
1208                 *eclass = NT_STATUS_DOS_CLASS(ntstatus);
1209                 *ecode  = NT_STATUS_DOS_CODE(ntstatus);
1210                 return;
1211         }
1212         for (i=0; NT_STATUS_V(ntstatus_to_dos_map[i].ntstatus); i++) {
1213                 if (NT_STATUS_V(ntstatus) == 
1214                     NT_STATUS_V(ntstatus_to_dos_map[i].ntstatus)) {
1215                         *eclass = ntstatus_to_dos_map[i].dos_class;
1216                         *ecode = ntstatus_to_dos_map[i].dos_code;
1217                         return;
1218                 }
1219         }
1220         *eclass = ERRHRD;
1221         *ecode = ERRgeneral;
1222 }
1223
1224
1225 /*****************************************************************************
1226 convert a WERROR to a NT status32 code
1227  *****************************************************************************/
1228 NTSTATUS werror_to_ntstatus(WERROR error)
1229 {
1230         int i;
1231         if (W_ERROR_IS_OK(error)) return NT_STATUS_OK;
1232         for (i=0; NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus); i++) {
1233                 if (W_ERROR_V(error) == 
1234                     W_ERROR_V(ntstatus_to_werror_map[i].werror)) {
1235                         return ntstatus_to_werror_map[i].ntstatus;
1236                 }
1237         }
1238
1239         /* just guess ... */
1240         return NT_STATUS(W_ERROR_V(error) | 0xc0000000);
1241 }
1242
1243 /*****************************************************************************
1244 convert a NTSTATUS to a WERROR
1245  *****************************************************************************/
1246 WERROR ntstatus_to_werror(NTSTATUS error)
1247 {
1248         int i;
1249         if (NT_STATUS_IS_OK(error)) return WERR_OK;
1250         for (i=0; NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus); i++) {
1251                 if (NT_STATUS_V(error) == 
1252                     NT_STATUS_V(ntstatus_to_werror_map[i].ntstatus)) {
1253                         return ntstatus_to_werror_map[i].werror;
1254                 }
1255         }
1256
1257         /* a lame guess */
1258         return W_ERROR(NT_STATUS_V(error) & 0xffff);
1259 }
1260
1261 /* Mapping between Unix, DOS and NT error numbers */
1262
1263 struct unix_error_map {
1264         int unix_error;
1265         NTSTATUS nt_error;
1266 };
1267
1268 const struct unix_error_map unix_nt_errmap[] = {
1269         { EAGAIN,       STATUS_MORE_ENTRIES },
1270         { EINTR,        STATUS_MORE_ENTRIES },
1271         { ENOBUFS,      STATUS_MORE_ENTRIES },
1272 #ifdef EWOULDBLOCK
1273         { EWOULDBLOCK,  STATUS_MORE_ENTRIES },
1274 #endif
1275         { EINPROGRESS,  NT_STATUS_MORE_PROCESSING_REQUIRED },
1276         { EPERM,        NT_STATUS_ACCESS_DENIED },
1277         { EACCES,       NT_STATUS_ACCESS_DENIED },
1278         { ENOENT,       NT_STATUS_OBJECT_NAME_NOT_FOUND },
1279         { ENOTDIR,      NT_STATUS_NOT_A_DIRECTORY },
1280         { EIO,          NT_STATUS_IO_DEVICE_ERROR },
1281         { EBADF,        NT_STATUS_INVALID_HANDLE },
1282         { EINVAL,       NT_STATUS_INVALID_PARAMETER },
1283         { EEXIST,       NT_STATUS_OBJECT_NAME_COLLISION},
1284         { ENFILE,       NT_STATUS_TOO_MANY_OPENED_FILES },
1285         { EMFILE,       NT_STATUS_TOO_MANY_OPENED_FILES },
1286         { ENOSPC,       NT_STATUS_DISK_FULL },
1287         { EISDIR,       NT_STATUS_FILE_IS_A_DIRECTORY },
1288         { ENOTSOCK,     NT_STATUS_INVALID_HANDLE },
1289         { EFAULT,       NT_STATUS_INVALID_PARAMETER },
1290         { EMSGSIZE,     NT_STATUS_INVALID_BUFFER_SIZE },
1291         { ENOMEM,       NT_STATUS_NO_MEMORY },
1292         { EPIPE,        NT_STATUS_CONNECTION_DISCONNECTED },
1293         { ECONNREFUSED, NT_STATUS_CONNECTION_REFUSED },
1294 #ifdef ECONNRESET
1295         { ECONNRESET,   NT_STATUS_CONNECTION_RESET },
1296 #endif
1297         { EBUSY,        NT_STATUS_SHARING_VIOLATION },
1298 #ifdef ENOTSUP
1299         { ENOTSUP,      NT_STATUS_NOT_SUPPORTED},
1300 #endif
1301 #ifdef EOPNOTSUPP
1302         { EOPNOTSUPP,   NT_STATUS_NOT_SUPPORTED},
1303 #endif
1304 #ifdef EHOSTUNREACH
1305         { EHOSTUNREACH, NT_STATUS_HOST_UNREACHABLE },
1306 #endif
1307 #ifdef ENETUNREACH
1308         { ENETUNREACH,  NT_STATUS_NETWORK_UNREACHABLE },
1309 #endif
1310 #ifdef ETIMEDOUT
1311         { ETIMEDOUT,    NT_STATUS_IO_TIMEOUT },
1312 #endif
1313 #ifdef EADDRINUSE
1314         { EADDRINUSE,   NT_STATUS_ADDRESS_ALREADY_ASSOCIATED },
1315 #endif
1316 #ifdef ENOATTR
1317         { ENOATTR,      NT_STATUS_NOT_FOUND },
1318 #endif
1319 #ifdef ENODATA
1320         { ENODATA,      NT_STATUS_NOT_FOUND },
1321 #endif
1322 #ifdef EDQUOT
1323         { EDQUOT,       NT_STATUS_QUOTA_EXCEEDED },
1324 #endif
1325 #ifdef ENOTEMPTY
1326         { ENOTEMPTY,    NT_STATUS_DIRECTORY_NOT_EMPTY },
1327 #endif
1328 #ifdef EXDEV
1329         { EXDEV,        NT_STATUS_NOT_SAME_DEVICE },
1330 #endif
1331 #ifdef EROFS
1332         { EROFS,        NT_STATUS_MEDIA_WRITE_PROTECTED },
1333 #endif
1334 #ifdef ENAMETOOLONG
1335         { ENAMETOOLONG, NT_STATUS_NAME_TOO_LONG },
1336 #endif
1337 #ifdef EFBIG
1338         { EFBIG,        NT_STATUS_DISK_FULL },
1339 #endif
1340 #ifdef EADDRNOTAVAIL
1341         { EADDRNOTAVAIL,NT_STATUS_ADDRESS_NOT_ASSOCIATED },
1342 #endif
1343 #ifdef ESOCKTNOSUPPORT
1344         { ESOCKTNOSUPPORT,NT_STATUS_INVALID_PARAMETER_MIX },
1345 #endif
1346 #ifdef EAFNOSUPPORT
1347         { EAFNOSUPPORT, NT_STATUS_INVALID_PARAMETER_MIX },
1348 #endif
1349 #ifdef ENOPROTOOPT
1350         { ENOPROTOOPT,  NT_STATUS_INVALID_PARAMETER_MIX },
1351 #endif
1352 #ifdef ENODEV
1353         { ENODEV,       NT_STATUS_NO_SUCH_DEVICE },
1354 #endif
1355 #ifdef ENOSYS
1356         { ENOSYS,       NT_STATUS_INVALID_SYSTEM_SERVICE },
1357 #endif
1358         { 0, NT_STATUS_UNSUCCESSFUL }
1359 };
1360
1361
1362 /*********************************************************************
1363  Map an NT error code from a Unix error code.
1364 *********************************************************************/
1365 NTSTATUS map_nt_error_from_unix(int unix_error)
1366 {
1367         int i;
1368
1369         /* Look through list */
1370         for (i=0;i<ARRAY_SIZE(unix_nt_errmap);i++) {
1371                 if (unix_nt_errmap[i].unix_error == unix_error) {
1372                         return unix_nt_errmap[i].nt_error;
1373                 }
1374         }
1375
1376         /* Default return */
1377         return NT_STATUS_UNSUCCESSFUL;
1378 }
1379
1380 NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
1381 {
1382         switch (ndr_err) {
1383         case NDR_ERR_SUCCESS:
1384                 return NT_STATUS_OK;
1385         case NDR_ERR_BUFSIZE:
1386                 return NT_STATUS_BUFFER_TOO_SMALL;
1387         case NDR_ERR_TOKEN:
1388                 return NT_STATUS_INTERNAL_ERROR;
1389         case NDR_ERR_ALLOC:
1390                 return NT_STATUS_NO_MEMORY;
1391         case NDR_ERR_ARRAY_SIZE:
1392                 return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
1393         case NDR_ERR_INVALID_POINTER:
1394                 return NT_STATUS_INVALID_PARAMETER_MIX;
1395         case NDR_ERR_UNREAD_BYTES:
1396                 return NT_STATUS_PORT_MESSAGE_TOO_LONG;
1397         default:
1398                 break;
1399         }
1400
1401         /* we should map all error codes to different status codes */
1402         return NT_STATUS_INVALID_PARAMETER;
1403 }