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