1 | /* $Id: RTErrConvertFromWin32.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Convert win32 error codes to iprt status codes.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | /*********************************************************************************************************************************
|
---|
29 | * Header Files *
|
---|
30 | *********************************************************************************************************************************/
|
---|
31 | #include <iprt/win/windows.h>
|
---|
32 |
|
---|
33 | #include <iprt/err.h>
|
---|
34 | #include <iprt/log.h>
|
---|
35 | #include <iprt/assert.h>
|
---|
36 |
|
---|
37 |
|
---|
38 | RTR3DECL(int) RTErrConvertFromWin32(unsigned uNativeCode)
|
---|
39 | {
|
---|
40 | /* very fast check for no error. */
|
---|
41 | if (uNativeCode == ERROR_SUCCESS)
|
---|
42 | return(VINF_SUCCESS);
|
---|
43 |
|
---|
44 | /* process error codes. */
|
---|
45 | switch (uNativeCode)
|
---|
46 | {
|
---|
47 | case ERROR_INVALID_FUNCTION: return VERR_INVALID_FUNCTION;
|
---|
48 | case ERROR_FILE_NOT_FOUND: return VERR_FILE_NOT_FOUND;
|
---|
49 | case ERROR_PATH_NOT_FOUND: return VERR_PATH_NOT_FOUND;
|
---|
50 | case ERROR_TOO_MANY_OPEN_FILES: return VERR_TOO_MANY_OPEN_FILES;
|
---|
51 | case ERROR_ACCESS_DENIED: return VERR_ACCESS_DENIED;
|
---|
52 | case ERROR_NOACCESS: return VERR_INVALID_POINTER; /* (STATUS_ACCESS_VIOLATION, STATUS_DATATYPE_MISALIGNMENT, STATUS_DATATYPE_MISALIGNMENT_ERROR) */
|
---|
53 |
|
---|
54 | case ERROR_INVALID_HANDLE:
|
---|
55 | case ERROR_DIRECT_ACCESS_HANDLE: return VERR_INVALID_HANDLE;
|
---|
56 |
|
---|
57 | case ERROR_NO_SYSTEM_RESOURCES: /** @todo better translation */
|
---|
58 | case ERROR_NOT_ENOUGH_MEMORY:
|
---|
59 | case ERROR_OUTOFMEMORY: return VERR_NO_MEMORY;
|
---|
60 |
|
---|
61 | case ERROR_INVALID_DRIVE: return VERR_INVALID_DRIVE;
|
---|
62 | case ERROR_CURRENT_DIRECTORY: return VERR_CANT_DELETE_DIRECTORY;
|
---|
63 | case ERROR_NOT_SAME_DEVICE: return VERR_NOT_SAME_DEVICE;
|
---|
64 | case ERROR_NO_MORE_FILES: return VERR_NO_MORE_FILES;
|
---|
65 | case ERROR_WRITE_PROTECT: return VERR_WRITE_PROTECT;
|
---|
66 | case ERROR_BAD_UNIT: return VERR_IO_BAD_UNIT;
|
---|
67 | case ERROR_NOT_READY: return VERR_IO_NOT_READY;
|
---|
68 | case ERROR_BAD_COMMAND: return VERR_IO_BAD_COMMAND;
|
---|
69 | case ERROR_CRC: return VERR_IO_CRC;
|
---|
70 | case ERROR_BAD_LENGTH: return VERR_IO_BAD_LENGTH;
|
---|
71 | case ERROR_SEEK: return VERR_SEEK;
|
---|
72 | case ERROR_NOT_DOS_DISK: return VERR_DISK_INVALID_FORMAT;
|
---|
73 | case ERROR_SECTOR_NOT_FOUND: return VERR_IO_SECTOR_NOT_FOUND;
|
---|
74 | case ERROR_WRITE_FAULT: return VERR_WRITE_ERROR;
|
---|
75 | case ERROR_READ_FAULT: return VERR_READ_ERROR;
|
---|
76 | case ERROR_GEN_FAILURE: return VERR_IO_GEN_FAILURE;
|
---|
77 | case ERROR_SHARING_VIOLATION: return VERR_SHARING_VIOLATION;
|
---|
78 | case ERROR_LOCK_VIOLATION: return VERR_FILE_LOCK_VIOLATION;
|
---|
79 | case ERROR_HANDLE_EOF: return VERR_EOF;
|
---|
80 | case ERROR_NOT_LOCKED: return VERR_FILE_NOT_LOCKED;
|
---|
81 | case ERROR_DIR_NOT_EMPTY: return VERR_DIR_NOT_EMPTY;
|
---|
82 |
|
---|
83 | case ERROR_HANDLE_DISK_FULL:
|
---|
84 | case ERROR_DISK_FULL: return VERR_DISK_FULL;
|
---|
85 |
|
---|
86 | case ERROR_NOT_SUPPORTED: return VERR_NOT_SUPPORTED;
|
---|
87 |
|
---|
88 | case ERROR_INVALID_PARAMETER:
|
---|
89 | case ERROR_BAD_ARGUMENTS:
|
---|
90 | case ERROR_INVALID_FLAGS: return VERR_INVALID_PARAMETER;
|
---|
91 |
|
---|
92 | case ERROR_REM_NOT_LIST: return VERR_NET_IO_ERROR;
|
---|
93 |
|
---|
94 | case ERROR_BAD_NETPATH:
|
---|
95 | case ERROR_NETNAME_DELETED: return VERR_NET_HOST_NOT_FOUND;
|
---|
96 |
|
---|
97 | case ERROR_BAD_NET_NAME:
|
---|
98 | case ERROR_DEV_NOT_EXIST: return VERR_NET_PATH_NOT_FOUND;
|
---|
99 |
|
---|
100 | case ERROR_NETWORK_BUSY:
|
---|
101 | case ERROR_TOO_MANY_CMDS:
|
---|
102 | case ERROR_TOO_MANY_NAMES:
|
---|
103 | case ERROR_TOO_MANY_SESS:
|
---|
104 | case ERROR_OUT_OF_STRUCTURES: return VERR_NET_OUT_OF_RESOURCES;
|
---|
105 |
|
---|
106 | case ERROR_PRINTQ_FULL:
|
---|
107 | case ERROR_NO_SPOOL_SPACE:
|
---|
108 | case ERROR_PRINT_CANCELLED: return VERR_NET_PRINT_ERROR;
|
---|
109 |
|
---|
110 | case ERROR_DUP_NAME:
|
---|
111 | case ERROR_ADAP_HDW_ERR:
|
---|
112 | case ERROR_BAD_NET_RESP:
|
---|
113 | case ERROR_UNEXP_NET_ERR:
|
---|
114 | case ERROR_BAD_REM_ADAP:
|
---|
115 | case ERROR_NETWORK_ACCESS_DENIED:
|
---|
116 | case ERROR_BAD_DEV_TYPE:
|
---|
117 | case ERROR_SHARING_PAUSED:
|
---|
118 | case ERROR_REQ_NOT_ACCEP:
|
---|
119 | case ERROR_REDIR_PAUSED:
|
---|
120 | case ERROR_ALREADY_ASSIGNED:
|
---|
121 | case ERROR_INVALID_PASSWORD:
|
---|
122 | case ERROR_NET_WRITE_FAULT: return VERR_NET_IO_ERROR;
|
---|
123 |
|
---|
124 | case ERROR_FILE_EXISTS:
|
---|
125 | case ERROR_ALREADY_EXISTS: return VERR_ALREADY_EXISTS;
|
---|
126 |
|
---|
127 | case ERROR_CANNOT_MAKE: return VERR_CANT_CREATE;
|
---|
128 | case ERROR_NO_PROC_SLOTS: return VERR_MAX_PROCS_REACHED;
|
---|
129 | case ERROR_TOO_MANY_SEMAPHORES: return VERR_TOO_MANY_SEMAPHORES;
|
---|
130 | case ERROR_EXCL_SEM_ALREADY_OWNED: return VERR_EXCL_SEM_ALREADY_OWNED;
|
---|
131 | case ERROR_SEM_IS_SET: return VERR_SEM_IS_SET;
|
---|
132 | case ERROR_TOO_MANY_SEM_REQUESTS: return VERR_TOO_MANY_SEM_REQUESTS;
|
---|
133 | case ERROR_SEM_OWNER_DIED: return VERR_SEM_OWNER_DIED;
|
---|
134 | case ERROR_DRIVE_LOCKED: return VERR_DRIVE_LOCKED;
|
---|
135 | case ERROR_BROKEN_PIPE: return VERR_BROKEN_PIPE;
|
---|
136 | case ERROR_OPEN_FAILED: return VERR_OPEN_FAILED;
|
---|
137 |
|
---|
138 | case ERROR_BUFFER_OVERFLOW:
|
---|
139 | case ERROR_INSUFFICIENT_BUFFER: return VERR_BUFFER_OVERFLOW;
|
---|
140 |
|
---|
141 | case ERROR_NO_MORE_SEARCH_HANDLES: return VERR_NO_MORE_SEARCH_HANDLES;
|
---|
142 |
|
---|
143 | case ERROR_SEM_TIMEOUT:
|
---|
144 | case WAIT_TIMEOUT:
|
---|
145 | case ERROR_SERVICE_REQUEST_TIMEOUT:
|
---|
146 | case ERROR_COUNTER_TIMEOUT:
|
---|
147 | case ERROR_TIMEOUT: return VERR_TIMEOUT;
|
---|
148 |
|
---|
149 | case ERROR_INVALID_NAME:
|
---|
150 | case ERROR_BAD_DEVICE:
|
---|
151 | case ERROR_BAD_PATHNAME: return VERR_INVALID_NAME;
|
---|
152 |
|
---|
153 | case ERROR_NEGATIVE_SEEK: return VERR_NEGATIVE_SEEK;
|
---|
154 | case ERROR_SEEK_ON_DEVICE: return VERR_SEEK_ON_DEVICE;
|
---|
155 |
|
---|
156 | case ERROR_SIGNAL_REFUSED:
|
---|
157 | case ERROR_NO_SIGNAL_SENT: return VERR_SIGNAL_REFUSED;
|
---|
158 |
|
---|
159 | case ERROR_SIGNAL_PENDING: return VERR_SIGNAL_PENDING;
|
---|
160 | case ERROR_MAX_THRDS_REACHED: return VERR_MAX_THRDS_REACHED;
|
---|
161 | case ERROR_LOCK_FAILED: return VERR_FILE_LOCK_FAILED;
|
---|
162 | case ERROR_SEM_NOT_FOUND: return VERR_SEM_NOT_FOUND;
|
---|
163 | case ERROR_FILENAME_EXCED_RANGE: return VERR_FILENAME_TOO_LONG;
|
---|
164 | case ERROR_INVALID_SIGNAL_NUMBER: return VERR_SIGNAL_INVALID;
|
---|
165 |
|
---|
166 | case ERROR_BAD_PIPE: return VERR_BAD_PIPE;
|
---|
167 | case ERROR_PIPE_BUSY: return VERR_PIPE_BUSY;
|
---|
168 | case ERROR_NO_DATA: return VERR_NO_DATA;
|
---|
169 | case ERROR_PIPE_NOT_CONNECTED: return VERR_PIPE_NOT_CONNECTED;
|
---|
170 | case ERROR_MORE_DATA: return VERR_MORE_DATA;
|
---|
171 | case ERROR_NOT_OWNER: return VERR_NOT_OWNER;
|
---|
172 | case ERROR_TOO_MANY_POSTS: return VERR_TOO_MANY_POSTS;
|
---|
173 |
|
---|
174 | case ERROR_PIPE_CONNECTED:
|
---|
175 | case ERROR_PIPE_LISTENING: return VERR_PIPE_IO_ERROR;
|
---|
176 |
|
---|
177 | case ERROR_OPERATION_ABORTED: return VERR_INTERRUPTED;
|
---|
178 | case ERROR_NO_UNICODE_TRANSLATION: return VERR_NO_TRANSLATION;
|
---|
179 |
|
---|
180 | case RPC_S_INVALID_STRING_UUID: return VERR_INVALID_UUID_FORMAT;
|
---|
181 |
|
---|
182 | case ERROR_PROC_NOT_FOUND: return VERR_SYMBOL_NOT_FOUND;
|
---|
183 | case ERROR_MOD_NOT_FOUND: return VERR_MODULE_NOT_FOUND;
|
---|
184 |
|
---|
185 | case ERROR_INVALID_EXE_SIGNATURE: return VERR_INVALID_EXE_SIGNATURE;
|
---|
186 | case ERROR_BAD_EXE_FORMAT: return VERR_BAD_EXE_FORMAT;
|
---|
187 | case ERROR_FILE_CORRUPT: return VERR_BAD_EXE_FORMAT;
|
---|
188 | case ERROR_RESOURCE_DATA_NOT_FOUND: return VERR_NO_DATA; /// @todo fix ERROR_RESOURCE_DATA_NOT_FOUND translation
|
---|
189 | case ERROR_INVALID_ADDRESS: return VERR_INVALID_POINTER; /// @todo fix ERROR_INVALID_ADDRESS translation - dbghelp returns it on some line number queries.
|
---|
190 |
|
---|
191 | case ERROR_CANCELLED: return VERR_CANCELLED;
|
---|
192 | case ERROR_USER_MAPPED_FILE: return VERR_SHARING_VIOLATION;
|
---|
193 | case ERROR_DIRECTORY: return VERR_NOT_A_DIRECTORY;
|
---|
194 |
|
---|
195 | case ERROR_TRUSTED_RELATIONSHIP_FAILURE:
|
---|
196 | case ERROR_TRUSTED_DOMAIN_FAILURE:
|
---|
197 | return VERR_AUTHENTICATION_FAILURE;
|
---|
198 | case ERROR_LOGON_FAILURE: return VERR_AUTHENTICATION_FAILURE;
|
---|
199 | case ERROR_PRIVILEGE_NOT_HELD: return VERR_PRIVILEGE_NOT_HELD;
|
---|
200 |
|
---|
201 | case ERROR_PASSWORD_EXPIRED:
|
---|
202 | case ERROR_ACCOUNT_RESTRICTION:
|
---|
203 | case ERROR_PASSWORD_RESTRICTION:
|
---|
204 | case ERROR_ACCOUNT_DISABLED: return VERR_ACCOUNT_RESTRICTED;
|
---|
205 |
|
---|
206 | case ERROR_INVALID_IMAGE_HASH: return VERR_LDR_IMAGE_HASH;
|
---|
207 | case ERROR_UNRECOGNIZED_VOLUME: return VERR_MEDIA_NOT_RECOGNIZED;
|
---|
208 | case ERROR_ELEVATION_REQUIRED: return VERR_PROC_ELEVATION_REQUIRED;
|
---|
209 |
|
---|
210 |
|
---|
211 | /*
|
---|
212 | * Winsocket errors are mostly BSD errno.h wrappers.
|
---|
213 | * This is copied from RTErrConvertFromErrno() and checked against winsock.h.
|
---|
214 | * Please, keep things in sync!
|
---|
215 | */
|
---|
216 | #ifdef WSAEPERM
|
---|
217 | case WSAEPERM: return VERR_ACCESS_DENIED; /* 1 */
|
---|
218 | #endif
|
---|
219 | #ifdef WSAENOENT
|
---|
220 | case WSAENOENT: return VERR_FILE_NOT_FOUND;
|
---|
221 | #endif
|
---|
222 | #ifdef WSAESRCH
|
---|
223 | case WSAESRCH: return VERR_PROCESS_NOT_FOUND;
|
---|
224 | #endif
|
---|
225 | case WSAEINTR: return VERR_INTERRUPTED;
|
---|
226 | #ifdef WSAEIO
|
---|
227 | case WSAEIO: return VERR_DEV_IO_ERROR;
|
---|
228 | #endif
|
---|
229 | #ifdef WSAE2BIG
|
---|
230 | case WSAE2BIG: return VERR_TOO_MUCH_DATA;
|
---|
231 | #endif
|
---|
232 | #ifdef WSAENOEXEC
|
---|
233 | case WSAENOEXEC: return VERR_BAD_EXE_FORMAT;
|
---|
234 | #endif
|
---|
235 | case WSAEBADF: return VERR_INVALID_HANDLE;
|
---|
236 | #ifdef WSAECHILD
|
---|
237 | case WSAECHILD: return VERR_PROCESS_NOT_FOUND; //... /* 10 */
|
---|
238 | #endif
|
---|
239 | case WSAEWOULDBLOCK: return VERR_TRY_AGAIN; /* EAGAIN */
|
---|
240 | #ifdef WSAENOMEM
|
---|
241 | case WSAENOMEM: return VERR_NO_MEMORY;
|
---|
242 | #endif
|
---|
243 | case WSAEACCES: return VERR_ACCESS_DENIED;
|
---|
244 | case WSAEFAULT: return VERR_INVALID_POINTER;
|
---|
245 | //case WSAENOTBLK: return VERR_;
|
---|
246 | #ifdef WSAEBUSY
|
---|
247 | case WSAEBUSY: return VERR_DEV_IO_ERROR;
|
---|
248 | #endif
|
---|
249 | #ifdef WSAEEXIST
|
---|
250 | case WSAEEXIST: return VERR_ALREADY_EXISTS;
|
---|
251 | #endif
|
---|
252 | //case WSAEXDEV:
|
---|
253 | #ifdef WSAENODEV
|
---|
254 | case WSAENODEV: return VERR_NOT_SUPPORTED;
|
---|
255 | #endif
|
---|
256 | #ifdef WSAENOTDIR
|
---|
257 | case WSAENOTDIR: return VERR_PATH_NOT_FOUND; /* 20 */
|
---|
258 | #endif
|
---|
259 | #ifdef WSAEISDIR
|
---|
260 | case WSAEISDIR: return VERR_FILE_NOT_FOUND;
|
---|
261 | #endif
|
---|
262 | case WSAEINVAL: return VERR_INVALID_PARAMETER;
|
---|
263 | #ifdef WSAENFILE
|
---|
264 | case WSAENFILE: return VERR_TOO_MANY_OPEN_FILES;
|
---|
265 | #endif
|
---|
266 | case WSAEMFILE: return VERR_TOO_MANY_OPEN_FILES;
|
---|
267 | #ifdef WSAENOTTY
|
---|
268 | case WSAENOTTY: return VERR_INVALID_FUNCTION;
|
---|
269 | #endif
|
---|
270 | #ifdef WSAETXTBSY
|
---|
271 | case WSAETXTBSY: return VERR_SHARING_VIOLATION;
|
---|
272 | #endif
|
---|
273 | //case WSAEFBIG:
|
---|
274 | #ifdef WSAENOSPC
|
---|
275 | case WSAENOSPC: return VERR_DISK_FULL;
|
---|
276 | #endif
|
---|
277 | #ifdef WSAESPIPE
|
---|
278 | case WSAESPIPE: return VERR_SEEK_ON_DEVICE;
|
---|
279 | #endif
|
---|
280 | #ifdef WSAEROFS
|
---|
281 | case WSAEROFS: return VERR_WRITE_PROTECT; /* 30 */
|
---|
282 | #endif
|
---|
283 | //case WSAEMLINK:
|
---|
284 | #ifdef WSAEPIPE
|
---|
285 | case WSAEPIPE: return VERR_BROKEN_PIPE;
|
---|
286 | #endif
|
---|
287 | #ifdef WSAEDOM
|
---|
288 | case WSAEDOM: return VERR_INVALID_PARAMETER;
|
---|
289 | #endif
|
---|
290 | #ifdef WSAERANGE
|
---|
291 | case WSAERANGE: return VERR_INVALID_PARAMETER;
|
---|
292 | #endif
|
---|
293 | #ifdef WSAEDEADLK
|
---|
294 | case WSAEDEADLK: return VERR_DEADLOCK;
|
---|
295 | #endif
|
---|
296 | case WSAENAMETOOLONG: return VERR_FILENAME_TOO_LONG;
|
---|
297 | #ifdef WSAENOLCK
|
---|
298 | case WSAENOLCK: return VERR_FILE_LOCK_FAILED;
|
---|
299 | #endif
|
---|
300 | #ifdef WSAENOSYS
|
---|
301 | case WSAENOSYS: return VERR_NOT_SUPPORTED;
|
---|
302 | #endif
|
---|
303 | case WSAENOTEMPTY: return VERR_CANT_DELETE_DIRECTORY;
|
---|
304 | case WSAELOOP: return VERR_TOO_MANY_SYMLINKS; /* 40 */
|
---|
305 | //case WSAENOMSG 42 /* No message of desired type */
|
---|
306 | //case WSAEIDRM 43 /* Identifier removed */
|
---|
307 | //case WSAECHRNG 44 /* Channel number out of range */
|
---|
308 | //case WSAEL2NSYNC 45 /* Level 2 not synchronized */
|
---|
309 | //case WSAEL3HLT 46 /* Level 3 halted */
|
---|
310 | //case WSAEL3RST 47 /* Level 3 reset */
|
---|
311 | //case WSAELNRNG 48 /* Link number out of range */
|
---|
312 | //case WSAEUNATCH 49 /* Protocol driver not attached */
|
---|
313 | //case WSAENOCSI 50 /* No CSI structure available */
|
---|
314 | //case WSAEL2HLT 51 /* Level 2 halted */
|
---|
315 | //case WSAEBADE 52 /* Invalid exchange */
|
---|
316 | //case WSAEBADR 53 /* Invalid request descriptor */
|
---|
317 | //case WSAEXFULL 54 /* Exchange full */
|
---|
318 | //case WSAENOANO 55 /* No anode */
|
---|
319 | //case WSAEBADRQC 56 /* Invalid request code */
|
---|
320 | //case WSAEBADSLT 57 /* Invalid slot */
|
---|
321 | //case 58:
|
---|
322 | //case WSAEBFONT 59 /* Bad font file format */
|
---|
323 | //case WSAENOSTR 60 /* Device not a stream */
|
---|
324 | #ifdef WSAENODATA
|
---|
325 | case WSAENODATA: return VERR_NO_DATA;
|
---|
326 | #endif
|
---|
327 | //case WSAETIME 62 /* Timer expired */
|
---|
328 | //case WSAENOSR 63 /* Out of streams resources */
|
---|
329 | #ifdef WSAENONET
|
---|
330 | case WSAENONET: return VERR_NET_NO_NETWORK;
|
---|
331 | #endif
|
---|
332 | //case WSAENOPKG 65 /* Package not installed */
|
---|
333 | //case WSAEREMOTE 66 /* Object is remote */
|
---|
334 | //case WSAENOLINK 67 /* Link has been severed */
|
---|
335 | //case WSAEADV 68 /* Advertise error */
|
---|
336 | //case WSAESRMNT 69 /* Srmount error */
|
---|
337 | //case WSAECOMM 70 /* Communication error on send */
|
---|
338 | //case WSAEPROTO 71 /* Protocol error */
|
---|
339 | //case WSAEMULTIHOP 72 /* Multihop attempted */
|
---|
340 | //case WSAEDOTDOT 73 /* RFS specific error */
|
---|
341 | //case WSAEBADMSG 74 /* Not a data message */
|
---|
342 | #ifdef WSAEOVERFLOW
|
---|
343 | case WSAEOVERFLOW: return VERR_TOO_MUCH_DATA;
|
---|
344 | #endif
|
---|
345 | #ifdef WSAENOTUNIQ
|
---|
346 | case WSAENOTUNIQ: return VERR_NET_NOT_UNIQUE_NAME;
|
---|
347 | #endif
|
---|
348 | #ifdef WSAEBADFD
|
---|
349 | case WSAEBADFD: return VERR_INVALID_HANDLE;
|
---|
350 | #endif
|
---|
351 | //case WSAEREMCHG 78 /* Remote address changed */
|
---|
352 | //case WSAELIBACC 79 /* Can not access a needed shared library */
|
---|
353 | //case WSAELIBBAD 80 /* Accessing a corrupted shared library */
|
---|
354 | //case WSAELIBSCN 81 /* .lib section in a.out corrupted */
|
---|
355 | //case WSAELIBMAX 82 /* Attempting to link in too many shared libraries */
|
---|
356 | //case WSAELIBEXEC 83 /* Cannot exec a shared library directly */
|
---|
357 | #ifdef WSAEILSEQ
|
---|
358 | case WSAEILSEQ: return VERR_NO_TRANSLATION;
|
---|
359 | #endif
|
---|
360 | #ifdef WSAERESTART
|
---|
361 | case WSAERESTART: return VERR_INTERRUPTED;
|
---|
362 | #endif
|
---|
363 | //case WSAESTRPIPE 86 /* Streams pipe error */
|
---|
364 | //case WSAEUSERS 87 /* Too many users */
|
---|
365 | case WSAENOTSOCK: return VERR_NET_NOT_SOCKET;
|
---|
366 | case WSAEDESTADDRREQ: return VERR_NET_DEST_ADDRESS_REQUIRED;
|
---|
367 | case WSAEMSGSIZE: return VERR_NET_MSG_SIZE;
|
---|
368 | case WSAEPROTOTYPE: return VERR_NET_PROTOCOL_TYPE;
|
---|
369 | case WSAENOPROTOOPT: return VERR_NET_PROTOCOL_NOT_AVAILABLE;
|
---|
370 | case WSAEPROTONOSUPPORT: return VERR_NET_PROTOCOL_NOT_SUPPORTED;
|
---|
371 | case WSAESOCKTNOSUPPORT: return VERR_NET_SOCKET_TYPE_NOT_SUPPORTED;
|
---|
372 | case WSAEOPNOTSUPP: return VERR_NET_OPERATION_NOT_SUPPORTED;
|
---|
373 | case WSAEPFNOSUPPORT: return VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED;
|
---|
374 | case WSAEAFNOSUPPORT: return VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED;
|
---|
375 | case WSAEADDRINUSE: return VERR_NET_ADDRESS_IN_USE;
|
---|
376 | case WSAEADDRNOTAVAIL: return VERR_NET_ADDRESS_NOT_AVAILABLE;
|
---|
377 | case WSAENETDOWN: return VERR_NET_DOWN;
|
---|
378 | case WSAENETUNREACH: return VERR_NET_UNREACHABLE;
|
---|
379 | case WSAENETRESET: return VERR_NET_CONNECTION_RESET;
|
---|
380 | case WSAECONNABORTED: return VERR_NET_CONNECTION_ABORTED;
|
---|
381 | case WSAECONNRESET: return VERR_NET_CONNECTION_RESET_BY_PEER;
|
---|
382 | case WSAENOBUFS: return VERR_NET_NO_BUFFER_SPACE;
|
---|
383 | case WSAEISCONN: return VERR_NET_ALREADY_CONNECTED;
|
---|
384 | case WSAENOTCONN: return VERR_NET_NOT_CONNECTED;
|
---|
385 | case WSAESHUTDOWN: return VERR_NET_SHUTDOWN;
|
---|
386 | case WSAETOOMANYREFS: return VERR_NET_TOO_MANY_REFERENCES;
|
---|
387 | case WSAETIMEDOUT: return VERR_TIMEOUT;
|
---|
388 | case WSAECONNREFUSED: return VERR_NET_CONNECTION_REFUSED;
|
---|
389 | case WSAEHOSTDOWN: return VERR_NET_HOST_DOWN;
|
---|
390 | case WSAEHOSTUNREACH: return VERR_NET_HOST_UNREACHABLE;
|
---|
391 | case WSAEALREADY: return VERR_NET_ALREADY_IN_PROGRESS;
|
---|
392 | case WSAEINPROGRESS: return VERR_NET_IN_PROGRESS;
|
---|
393 | case WSAEPROVIDERFAILEDINIT: return VERR_NET_INIT_FAILED;
|
---|
394 |
|
---|
395 | //case WSAESTALE 116 /* Stale NFS file handle */
|
---|
396 | //case WSAEUCLEAN 117 /* Structure needs cleaning */
|
---|
397 | //case WSAENOTNAM 118 /* Not a XENIX named type file */
|
---|
398 | //case WSAENAVAIL 119 /* No XENIX semaphores available */
|
---|
399 | //case WSAEISNAM 120 /* Is a named type file */
|
---|
400 | //case WSAEREMOTEIO 121 /* Remote I/O error */
|
---|
401 | case WSAEDQUOT: return VERR_DISK_FULL;
|
---|
402 | #ifdef WSAENOMEDIUM
|
---|
403 | case WSAENOMEDIUM: return VERR_MEDIA_NOT_PRESENT;
|
---|
404 | #endif
|
---|
405 | #ifdef WSAEMEDIUMTYPE
|
---|
406 | case WSAEMEDIUMTYPE: return VERR_MEDIA_NOT_RECOGNIZED;
|
---|
407 | #endif
|
---|
408 | case WSAEPROCLIM: return VERR_MAX_PROCS_REACHED;
|
---|
409 |
|
---|
410 | //case WSAEDISCON: (WSABASEERR+101)
|
---|
411 | //case WSASYSNOTREADY (WSABASEERR+91)
|
---|
412 | //case WSAVERNOTSUPPORTED (WSABASEERR+92)
|
---|
413 | //case WSANOTINITIALISED (WSABASEERR+93)
|
---|
414 |
|
---|
415 | #ifdef WSAHOST_NOT_FOUND
|
---|
416 | case WSAHOST_NOT_FOUND: return VERR_NET_HOST_NOT_FOUND;
|
---|
417 | #endif
|
---|
418 | #ifdef WSATRY_AGAIN
|
---|
419 | case WSATRY_AGAIN: return VERR_TRY_AGAIN;
|
---|
420 | #endif
|
---|
421 | #ifndef WSANO_RECOVERY
|
---|
422 | case WSANO_RECOVERY: return VERR_IO_GEN_FAILURE;
|
---|
423 | #endif
|
---|
424 | #ifdef WSANO_DATA
|
---|
425 | case WSANO_DATA: return VERR_NET_ADDRESS_NOT_AVAILABLE;
|
---|
426 | #endif
|
---|
427 |
|
---|
428 | case 1272 /*STATUS_SMB_GUEST_LOGON_BLOCKED*/: return VERR_AUTHENTICATION_FAILURE;
|
---|
429 |
|
---|
430 |
|
---|
431 | #ifndef ERROR_NOT_A_REPARSE_POINT
|
---|
432 | # define ERROR_NOT_A_REPARSE_POINT 0x1126
|
---|
433 | #endif
|
---|
434 | case ERROR_NOT_A_REPARSE_POINT: return VERR_NOT_SYMLINK;
|
---|
435 |
|
---|
436 | case NTE_BAD_ALGID: return VERR_CR_PKIX_UNKNOWN_DIGEST_TYPE;
|
---|
437 |
|
---|
438 | case ERROR_SERVICE_DOES_NOT_EXIST: return VERR_NOT_FOUND;
|
---|
439 |
|
---|
440 | #ifndef STATUS_ELEVATION_REQUIRED
|
---|
441 | # define STATUS_ELEVATION_REQUIRED 0xc000042c
|
---|
442 | #endif
|
---|
443 | case STATUS_ELEVATION_REQUIRED: return VERR_PRIVILEGE_NOT_HELD;
|
---|
444 | }
|
---|
445 |
|
---|
446 | /* unknown error. */
|
---|
447 | #ifndef IN_SUP_HARDENED_R3
|
---|
448 | AssertLogRelMsgFailed(("Unhandled error %u\n", uNativeCode));
|
---|
449 | #else
|
---|
450 | /* hardened main has no LogRel */
|
---|
451 | AssertMsgFailed(("Unhandled error %u\n", uNativeCode));
|
---|
452 | #endif
|
---|
453 | return VERR_UNRESOLVED_ERROR;
|
---|
454 | }
|
---|
455 |
|
---|