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