1 | /* $Id: RTErrConvertFromWin32.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Convert win32 error codes to iprt status codes.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 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 |
|
---|
225 |
|
---|
226 | /*
|
---|
227 | * Winsocket errors are mostly BSD errno.h wrappers.
|
---|
228 | * This is copied from RTErrConvertFromErrno() and checked against winsock.h.
|
---|
229 | * Please, keep things in sync!
|
---|
230 | */
|
---|
231 | #ifdef WSAEPERM
|
---|
232 | case WSAEPERM: return VERR_ACCESS_DENIED; /* 1 */
|
---|
233 | #endif
|
---|
234 | #ifdef WSAENOENT
|
---|
235 | case WSAENOENT: return VERR_FILE_NOT_FOUND;
|
---|
236 | #endif
|
---|
237 | #ifdef WSAESRCH
|
---|
238 | case WSAESRCH: return VERR_PROCESS_NOT_FOUND;
|
---|
239 | #endif
|
---|
240 | case WSAEINTR: return VERR_INTERRUPTED;
|
---|
241 | #ifdef WSAEIO
|
---|
242 | case WSAEIO: return VERR_DEV_IO_ERROR;
|
---|
243 | #endif
|
---|
244 | #ifdef WSAE2BIG
|
---|
245 | case WSAE2BIG: return VERR_TOO_MUCH_DATA;
|
---|
246 | #endif
|
---|
247 | #ifdef WSAENOEXEC
|
---|
248 | case WSAENOEXEC: return VERR_BAD_EXE_FORMAT;
|
---|
249 | #endif
|
---|
250 | case WSAEBADF: return VERR_INVALID_HANDLE;
|
---|
251 | #ifdef WSAECHILD
|
---|
252 | case WSAECHILD: return VERR_PROCESS_NOT_FOUND; //... /* 10 */
|
---|
253 | #endif
|
---|
254 | case WSAEWOULDBLOCK: return VERR_TRY_AGAIN; /* EAGAIN */
|
---|
255 | #ifdef WSAENOMEM
|
---|
256 | case WSAENOMEM: return VERR_NO_MEMORY;
|
---|
257 | #endif
|
---|
258 | case WSAEACCES: return VERR_ACCESS_DENIED;
|
---|
259 | case WSAEFAULT: return VERR_INVALID_POINTER;
|
---|
260 | //case WSAENOTBLK: return VERR_;
|
---|
261 | #ifdef WSAEBUSY
|
---|
262 | case WSAEBUSY: return VERR_DEV_IO_ERROR;
|
---|
263 | #endif
|
---|
264 | #ifdef WSAEEXIST
|
---|
265 | case WSAEEXIST: return VERR_ALREADY_EXISTS;
|
---|
266 | #endif
|
---|
267 | //case WSAEXDEV:
|
---|
268 | #ifdef WSAENODEV
|
---|
269 | case WSAENODEV: return VERR_NOT_SUPPORTED;
|
---|
270 | #endif
|
---|
271 | #ifdef WSAENOTDIR
|
---|
272 | case WSAENOTDIR: return VERR_PATH_NOT_FOUND; /* 20 */
|
---|
273 | #endif
|
---|
274 | #ifdef WSAEISDIR
|
---|
275 | case WSAEISDIR: return VERR_FILE_NOT_FOUND;
|
---|
276 | #endif
|
---|
277 | case WSAEINVAL: return VERR_INVALID_PARAMETER;
|
---|
278 | #ifdef WSAENFILE
|
---|
279 | case WSAENFILE: return VERR_TOO_MANY_OPEN_FILES;
|
---|
280 | #endif
|
---|
281 | case WSAEMFILE: return VERR_TOO_MANY_OPEN_FILES;
|
---|
282 | #ifdef WSAENOTTY
|
---|
283 | case WSAENOTTY: return VERR_INVALID_FUNCTION;
|
---|
284 | #endif
|
---|
285 | #ifdef WSAETXTBSY
|
---|
286 | case WSAETXTBSY: return VERR_SHARING_VIOLATION;
|
---|
287 | #endif
|
---|
288 | //case WSAEFBIG:
|
---|
289 | #ifdef WSAENOSPC
|
---|
290 | case WSAENOSPC: return VERR_DISK_FULL;
|
---|
291 | #endif
|
---|
292 | #ifdef WSAESPIPE
|
---|
293 | case WSAESPIPE: return VERR_SEEK_ON_DEVICE;
|
---|
294 | #endif
|
---|
295 | #ifdef WSAEROFS
|
---|
296 | case WSAEROFS: return VERR_WRITE_PROTECT; /* 30 */
|
---|
297 | #endif
|
---|
298 | //case WSAEMLINK:
|
---|
299 | #ifdef WSAEPIPE
|
---|
300 | case WSAEPIPE: return VERR_BROKEN_PIPE;
|
---|
301 | #endif
|
---|
302 | #ifdef WSAEDOM
|
---|
303 | case WSAEDOM: return VERR_INVALID_PARAMETER;
|
---|
304 | #endif
|
---|
305 | #ifdef WSAERANGE
|
---|
306 | case WSAERANGE: return VERR_INVALID_PARAMETER;
|
---|
307 | #endif
|
---|
308 | #ifdef WSAEDEADLK
|
---|
309 | case WSAEDEADLK: return VERR_DEADLOCK;
|
---|
310 | #endif
|
---|
311 | case WSAENAMETOOLONG: return VERR_FILENAME_TOO_LONG;
|
---|
312 | #ifdef WSAENOLCK
|
---|
313 | case WSAENOLCK: return VERR_FILE_LOCK_FAILED;
|
---|
314 | #endif
|
---|
315 | #ifdef WSAENOSYS
|
---|
316 | case WSAENOSYS: return VERR_NOT_SUPPORTED;
|
---|
317 | #endif
|
---|
318 | case WSAENOTEMPTY: return VERR_CANT_DELETE_DIRECTORY;
|
---|
319 | case WSAELOOP: return VERR_TOO_MANY_SYMLINKS; /* 40 */
|
---|
320 | //case WSAENOMSG 42 /* No message of desired type */
|
---|
321 | //case WSAEIDRM 43 /* Identifier removed */
|
---|
322 | //case WSAECHRNG 44 /* Channel number out of range */
|
---|
323 | //case WSAEL2NSYNC 45 /* Level 2 not synchronized */
|
---|
324 | //case WSAEL3HLT 46 /* Level 3 halted */
|
---|
325 | //case WSAEL3RST 47 /* Level 3 reset */
|
---|
326 | //case WSAELNRNG 48 /* Link number out of range */
|
---|
327 | //case WSAEUNATCH 49 /* Protocol driver not attached */
|
---|
328 | //case WSAENOCSI 50 /* No CSI structure available */
|
---|
329 | //case WSAEL2HLT 51 /* Level 2 halted */
|
---|
330 | //case WSAEBADE 52 /* Invalid exchange */
|
---|
331 | //case WSAEBADR 53 /* Invalid request descriptor */
|
---|
332 | //case WSAEXFULL 54 /* Exchange full */
|
---|
333 | //case WSAENOANO 55 /* No anode */
|
---|
334 | //case WSAEBADRQC 56 /* Invalid request code */
|
---|
335 | //case WSAEBADSLT 57 /* Invalid slot */
|
---|
336 | //case 58:
|
---|
337 | //case WSAEBFONT 59 /* Bad font file format */
|
---|
338 | //case WSAENOSTR 60 /* Device not a stream */
|
---|
339 | #ifdef WSAENODATA
|
---|
340 | case WSAENODATA: return VERR_NO_DATA;
|
---|
341 | #endif
|
---|
342 | //case WSAETIME 62 /* Timer expired */
|
---|
343 | //case WSAENOSR 63 /* Out of streams resources */
|
---|
344 | #ifdef WSAENONET
|
---|
345 | case WSAENONET: return VERR_NET_NO_NETWORK;
|
---|
346 | #endif
|
---|
347 | //case WSAENOPKG 65 /* Package not installed */
|
---|
348 | //case WSAEREMOTE 66 /* Object is remote */
|
---|
349 | //case WSAENOLINK 67 /* Link has been severed */
|
---|
350 | //case WSAEADV 68 /* Advertise error */
|
---|
351 | //case WSAESRMNT 69 /* Srmount error */
|
---|
352 | //case WSAECOMM 70 /* Communication error on send */
|
---|
353 | //case WSAEPROTO 71 /* Protocol error */
|
---|
354 | //case WSAEMULTIHOP 72 /* Multihop attempted */
|
---|
355 | //case WSAEDOTDOT 73 /* RFS specific error */
|
---|
356 | //case WSAEBADMSG 74 /* Not a data message */
|
---|
357 | #ifdef WSAEOVERFLOW
|
---|
358 | case WSAEOVERFLOW: return VERR_TOO_MUCH_DATA;
|
---|
359 | #endif
|
---|
360 | #ifdef WSAENOTUNIQ
|
---|
361 | case WSAENOTUNIQ: return VERR_NET_NOT_UNIQUE_NAME;
|
---|
362 | #endif
|
---|
363 | #ifdef WSAEBADFD
|
---|
364 | case WSAEBADFD: return VERR_INVALID_HANDLE;
|
---|
365 | #endif
|
---|
366 | //case WSAEREMCHG 78 /* Remote address changed */
|
---|
367 | //case WSAELIBACC 79 /* Can not access a needed shared library */
|
---|
368 | //case WSAELIBBAD 80 /* Accessing a corrupted shared library */
|
---|
369 | //case WSAELIBSCN 81 /* .lib section in a.out corrupted */
|
---|
370 | //case WSAELIBMAX 82 /* Attempting to link in too many shared libraries */
|
---|
371 | //case WSAELIBEXEC 83 /* Cannot exec a shared library directly */
|
---|
372 | #ifdef WSAEILSEQ
|
---|
373 | case WSAEILSEQ: return VERR_NO_TRANSLATION;
|
---|
374 | #endif
|
---|
375 | #ifdef WSAERESTART
|
---|
376 | case WSAERESTART: return VERR_INTERRUPTED;
|
---|
377 | #endif
|
---|
378 | //case WSAESTRPIPE 86 /* Streams pipe error */
|
---|
379 | //case WSAEUSERS 87 /* Too many users */
|
---|
380 | case WSAENOTSOCK: return VERR_NET_NOT_SOCKET;
|
---|
381 | case WSAEDESTADDRREQ: return VERR_NET_DEST_ADDRESS_REQUIRED;
|
---|
382 | case WSAEMSGSIZE: return VERR_NET_MSG_SIZE;
|
---|
383 | case WSAEPROTOTYPE: return VERR_NET_PROTOCOL_TYPE;
|
---|
384 | case WSAENOPROTOOPT: return VERR_NET_PROTOCOL_NOT_AVAILABLE;
|
---|
385 | case WSAEPROTONOSUPPORT: return VERR_NET_PROTOCOL_NOT_SUPPORTED;
|
---|
386 | case WSAESOCKTNOSUPPORT: return VERR_NET_SOCKET_TYPE_NOT_SUPPORTED;
|
---|
387 | case WSAEOPNOTSUPP: return VERR_NET_OPERATION_NOT_SUPPORTED;
|
---|
388 | case WSAEPFNOSUPPORT: return VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED;
|
---|
389 | case WSAEAFNOSUPPORT: return VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED;
|
---|
390 | case WSAEADDRINUSE: return VERR_NET_ADDRESS_IN_USE;
|
---|
391 | case WSAEADDRNOTAVAIL: return VERR_NET_ADDRESS_NOT_AVAILABLE;
|
---|
392 | case WSAENETDOWN: return VERR_NET_DOWN;
|
---|
393 | case WSAENETUNREACH: return VERR_NET_UNREACHABLE;
|
---|
394 | case WSAENETRESET: return VERR_NET_CONNECTION_RESET;
|
---|
395 | case WSAECONNABORTED: return VERR_NET_CONNECTION_ABORTED;
|
---|
396 | case WSAECONNRESET: return VERR_NET_CONNECTION_RESET_BY_PEER;
|
---|
397 | case WSAENOBUFS: return VERR_NET_NO_BUFFER_SPACE;
|
---|
398 | case WSAEISCONN: return VERR_NET_ALREADY_CONNECTED;
|
---|
399 | case WSAENOTCONN: return VERR_NET_NOT_CONNECTED;
|
---|
400 | case WSAESHUTDOWN: return VERR_NET_SHUTDOWN;
|
---|
401 | case WSAETOOMANYREFS: return VERR_NET_TOO_MANY_REFERENCES;
|
---|
402 | case WSAETIMEDOUT: return VERR_TIMEOUT;
|
---|
403 | case WSAECONNREFUSED: return VERR_NET_CONNECTION_REFUSED;
|
---|
404 | case WSAEHOSTDOWN: return VERR_NET_HOST_DOWN;
|
---|
405 | case WSAEHOSTUNREACH: return VERR_NET_HOST_UNREACHABLE;
|
---|
406 | case WSAEALREADY: return VERR_NET_ALREADY_IN_PROGRESS;
|
---|
407 | case WSAEINPROGRESS: return VERR_NET_IN_PROGRESS;
|
---|
408 | case WSAEPROVIDERFAILEDINIT: return VERR_NET_INIT_FAILED;
|
---|
409 |
|
---|
410 | //case WSAESTALE 116 /* Stale NFS file handle */
|
---|
411 | //case WSAEUCLEAN 117 /* Structure needs cleaning */
|
---|
412 | //case WSAENOTNAM 118 /* Not a XENIX named type file */
|
---|
413 | //case WSAENAVAIL 119 /* No XENIX semaphores available */
|
---|
414 | //case WSAEISNAM 120 /* Is a named type file */
|
---|
415 | //case WSAEREMOTEIO 121 /* Remote I/O error */
|
---|
416 | case WSAEDQUOT: return VERR_DISK_FULL;
|
---|
417 | #ifdef WSAENOMEDIUM
|
---|
418 | case WSAENOMEDIUM: return VERR_MEDIA_NOT_PRESENT;
|
---|
419 | #endif
|
---|
420 | #ifdef WSAEMEDIUMTYPE
|
---|
421 | case WSAEMEDIUMTYPE: return VERR_MEDIA_NOT_RECOGNIZED;
|
---|
422 | #endif
|
---|
423 | case WSAEPROCLIM: return VERR_MAX_PROCS_REACHED;
|
---|
424 |
|
---|
425 | //case WSAEDISCON: (WSABASEERR+101)
|
---|
426 | //case WSASYSNOTREADY (WSABASEERR+91)
|
---|
427 | //case WSAVERNOTSUPPORTED (WSABASEERR+92)
|
---|
428 | //case WSANOTINITIALISED (WSABASEERR+93)
|
---|
429 |
|
---|
430 | #ifdef WSAHOST_NOT_FOUND
|
---|
431 | case WSAHOST_NOT_FOUND: return VERR_NET_HOST_NOT_FOUND;
|
---|
432 | #endif
|
---|
433 | #ifdef WSATRY_AGAIN
|
---|
434 | case WSATRY_AGAIN: return VERR_TRY_AGAIN;
|
---|
435 | #endif
|
---|
436 | #ifndef WSANO_RECOVERY
|
---|
437 | case WSANO_RECOVERY: return VERR_IO_GEN_FAILURE;
|
---|
438 | #endif
|
---|
439 | #ifdef WSANO_DATA
|
---|
440 | case WSANO_DATA: return VERR_NET_ADDRESS_NOT_AVAILABLE;
|
---|
441 | #endif
|
---|
442 |
|
---|
443 | case 1272 /*STATUS_SMB_GUEST_LOGON_BLOCKED*/: return VERR_AUTHENTICATION_FAILURE;
|
---|
444 |
|
---|
445 |
|
---|
446 | #ifndef ERROR_NOT_A_REPARSE_POINT
|
---|
447 | # define ERROR_NOT_A_REPARSE_POINT 0x1126
|
---|
448 | #endif
|
---|
449 | case ERROR_NOT_A_REPARSE_POINT: return VERR_NOT_SYMLINK;
|
---|
450 |
|
---|
451 | case NTE_BAD_ALGID: return VERR_CR_PKIX_UNKNOWN_DIGEST_TYPE;
|
---|
452 |
|
---|
453 | case ERROR_SERVICE_DOES_NOT_EXIST: return VERR_NOT_FOUND;
|
---|
454 |
|
---|
455 | #ifndef STATUS_ELEVATION_REQUIRED
|
---|
456 | # define STATUS_ELEVATION_REQUIRED 0xc000042c
|
---|
457 | #endif
|
---|
458 | case STATUS_ELEVATION_REQUIRED: return VERR_PRIVILEGE_NOT_HELD;
|
---|
459 | }
|
---|
460 |
|
---|
461 | /* unknown error. */
|
---|
462 | #if !defined(IN_SUP_HARDENED_R3) \
|
---|
463 | && !defined(IPRT_NO_CRT) /* Please, don't drag log.cpp into the no-CRT images! */
|
---|
464 | AssertLogRelMsgFailed(("Unhandled error %u\n", uNativeCode));
|
---|
465 | #else
|
---|
466 | /* hardened main has no LogRel */
|
---|
467 | AssertMsgFailed(("Unhandled error %u\n", uNativeCode));
|
---|
468 | #endif
|
---|
469 | return VERR_UNRESOLVED_ERROR;
|
---|
470 | }
|
---|
471 |
|
---|