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