1 | /* $Id: RTErrConvertFromOS2.cpp 1 1970-01-01 00:00:00Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * InnoTek Portable Runtime - Convert OS/2 error codes to iprt status codes.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*******************************************************************************
|
---|
23 | * Header Files *
|
---|
24 | *******************************************************************************/
|
---|
25 | #define INCL_ERRORS
|
---|
26 | #define INCL_DOSERRORS
|
---|
27 | #include <os2.h>
|
---|
28 | #undef RT_MAX
|
---|
29 |
|
---|
30 | #include <iprt/err.h>
|
---|
31 | #include <iprt/assert.h>
|
---|
32 | #include <iprt/err.h>
|
---|
33 |
|
---|
34 |
|
---|
35 | RTDECL(int) RTErrConvertFromOS2(unsigned uNativeCode)
|
---|
36 | {
|
---|
37 | /* very fast check for no error. */
|
---|
38 | if (uNativeCode == NO_ERROR)
|
---|
39 | return VINF_SUCCESS;
|
---|
40 |
|
---|
41 | switch (uNativeCode)
|
---|
42 | {
|
---|
43 | case ERROR_INVALID_FUNCTION: return VERR_INVALID_FUNCTION;
|
---|
44 | case ERROR_FILE_NOT_FOUND: return VERR_FILE_NOT_FOUND;
|
---|
45 | case ERROR_PATH_NOT_FOUND: return VERR_PATH_NOT_FOUND;
|
---|
46 | case ERROR_TOO_MANY_OPEN_FILES: return VERR_TOO_MANY_OPEN_FILES;
|
---|
47 | case ERROR_ACCESS_DENIED: return VERR_ACCESS_DENIED;
|
---|
48 |
|
---|
49 | case ERROR_INVALID_HANDLE:
|
---|
50 | case ERROR_DIRECT_ACCESS_HANDLE: return VERR_INVALID_HANDLE;
|
---|
51 |
|
---|
52 | case ERROR_NOT_ENOUGH_MEMORY: return VERR_NO_MEMORY;
|
---|
53 |
|
---|
54 | case ERROR_INVALID_DRIVE: return VERR_INVALID_DRIVE;
|
---|
55 | case ERROR_CURRENT_DIRECTORY: return VERR_CANT_DELETE_DIRECTORY;
|
---|
56 | case ERROR_NOT_SAME_DEVICE: return VERR_NOT_SAME_DEVICE;
|
---|
57 | case ERROR_NO_MORE_FILES: return VERR_NO_MORE_FILES;
|
---|
58 | case ERROR_WRITE_PROTECT: return VERR_WRITE_PROTECT;
|
---|
59 | case ERROR_BAD_UNIT: return VERR_IO_BAD_UNIT;
|
---|
60 | case ERROR_NOT_READY: return VERR_IO_NOT_READY;
|
---|
61 | case ERROR_BAD_COMMAND: return VERR_IO_BAD_COMMAND;
|
---|
62 | case ERROR_CRC: return VERR_IO_CRC;
|
---|
63 | case ERROR_BAD_LENGTH: return VERR_IO_BAD_LENGTH;
|
---|
64 | case ERROR_SEEK: return VERR_SEEK;
|
---|
65 | case ERROR_NOT_DOS_DISK: return VERR_DISK_INVALID_FORMAT;
|
---|
66 | case ERROR_SECTOR_NOT_FOUND: return VERR_IO_SECTOR_NOT_FOUND;
|
---|
67 | case ERROR_WRITE_FAULT: return VERR_WRITE_ERROR;
|
---|
68 | case ERROR_READ_FAULT: return VERR_READ_ERROR;
|
---|
69 | case ERROR_GEN_FAILURE: return VERR_IO_GEN_FAILURE;
|
---|
70 | case ERROR_SHARING_VIOLATION: return VERR_SHARING_VIOLATION;
|
---|
71 | case ERROR_LOCK_VIOLATION: return VERR_FILE_LOCK_FAILED;
|
---|
72 | case ERROR_HANDLE_EOF: return VERR_EOF;
|
---|
73 |
|
---|
74 | case ERROR_HANDLE_DISK_FULL:
|
---|
75 | case ERROR_DISK_FULL: return VERR_DISK_FULL;
|
---|
76 |
|
---|
77 | case ERROR_NOT_SUPPORTED: return VERR_NOT_SUPPORTED;
|
---|
78 |
|
---|
79 | case ERROR_INVALID_PARAMETER:
|
---|
80 | case ERROR_BAD_ARGUMENTS:
|
---|
81 | case ERROR_PMM_INVALID_FLAGS: return VERR_INVALID_PARAMETER;
|
---|
82 |
|
---|
83 | case ERROR_REM_NOT_LIST: return VERR_NET_IO_ERROR;
|
---|
84 |
|
---|
85 | case ERROR_BAD_NETPATH:
|
---|
86 | case ERROR_NETNAME_DELETED: return VERR_NET_HOST_NOT_FOUND;
|
---|
87 |
|
---|
88 | case ERROR_BAD_NET_NAME:
|
---|
89 | case ERROR_DEV_NOT_EXIST: return VERR_NET_PATH_NOT_FOUND;
|
---|
90 |
|
---|
91 | case ERROR_NETWORK_BUSY:
|
---|
92 | case ERROR_TOO_MANY_CMDS:
|
---|
93 | case ERROR_TOO_MANY_NAMES:
|
---|
94 | case ERROR_TOO_MANY_SESS:
|
---|
95 | case ERROR_OUT_OF_STRUCTURES: return VERR_NET_OUT_OF_RESOURCES;
|
---|
96 |
|
---|
97 | case ERROR_PRINTQ_FULL:
|
---|
98 | case ERROR_NO_SPOOL_SPACE:
|
---|
99 | case ERROR_PRINT_CANCELLED: return VERR_NET_PRINT_ERROR;
|
---|
100 |
|
---|
101 | case ERROR_DUP_NAME:
|
---|
102 | case ERROR_ADAP_HDW_ERR:
|
---|
103 | case ERROR_BAD_NET_RESP:
|
---|
104 | case ERROR_UNEXP_NET_ERR:
|
---|
105 | case ERROR_BAD_REM_ADAP:
|
---|
106 | case ERROR_NETWORK_ACCESS_DENIED:
|
---|
107 | case ERROR_BAD_DEV_TYPE:
|
---|
108 | case ERROR_SHARING_PAUSED:
|
---|
109 | case ERROR_REQ_NOT_ACCEP:
|
---|
110 | case ERROR_REDIR_PAUSED:
|
---|
111 | case ERROR_ALREADY_ASSIGNED:
|
---|
112 | case ERROR_INVALID_PASSWORD:
|
---|
113 | case ERROR_NET_WRITE_FAULT: return VERR_NET_IO_ERROR;
|
---|
114 |
|
---|
115 | case ERROR_FILE_EXISTS:
|
---|
116 | case ERROR_ALREADY_EXISTS: return VERR_ALREADY_EXISTS;
|
---|
117 |
|
---|
118 | case ERROR_CANNOT_MAKE: return VERR_CANT_CREATE;
|
---|
119 | case ERROR_NO_PROC_SLOTS: return VERR_MAX_PROCS_REACHED;
|
---|
120 | case ERROR_TOO_MANY_SEMAPHORES: return VERR_TOO_MANY_SEMAPHORES;
|
---|
121 | case ERROR_EXCL_SEM_ALREADY_OWNED: return VERR_EXCL_SEM_ALREADY_OWNED;
|
---|
122 | case ERROR_SEM_IS_SET: return VERR_SEM_IS_SET;
|
---|
123 | case ERROR_TOO_MANY_SEM_REQUESTS: return VERR_TOO_MANY_SEM_REQUESTS;
|
---|
124 | case ERROR_SEM_OWNER_DIED: return VERR_SEM_OWNER_DIED;
|
---|
125 | case ERROR_DRIVE_LOCKED: return VERR_DRIVE_LOCKED;
|
---|
126 | case ERROR_BROKEN_PIPE: return VERR_BROKEN_PIPE;
|
---|
127 | case ERROR_OPEN_FAILED: return VERR_OPEN_FAILED;
|
---|
128 |
|
---|
129 | case ERROR_BUFFER_OVERFLOW:
|
---|
130 | case ERROR_INSUFFICIENT_BUFFER: return VERR_BUFFER_OVERFLOW;
|
---|
131 |
|
---|
132 | case ERROR_NO_MORE_SEARCH_HANDLES: return VERR_NO_MORE_SEARCH_HANDLES;
|
---|
133 |
|
---|
134 | case ERROR_SEM_TIMEOUT:
|
---|
135 | case ERROR_TIMEOUT: return VERR_TIMEOUT;
|
---|
136 |
|
---|
137 | case ERROR_INVALID_NAME:
|
---|
138 | case ERROR_BAD_PATHNAME: return VERR_INVALID_NAME;
|
---|
139 |
|
---|
140 | case ERROR_NEGATIVE_SEEK: return VERR_NEGATIVE_SEEK;
|
---|
141 | case ERROR_SEEK_ON_DEVICE: return VERR_SEEK_ON_DEVICE;
|
---|
142 |
|
---|
143 | case ERROR_SIGNAL_REFUSED:
|
---|
144 | case ERROR_NO_SIGNAL_SENT: return VERR_SIGNAL_REFUSED;
|
---|
145 |
|
---|
146 | case ERROR_SIGNAL_PENDING: return VERR_SIGNAL_PENDING;
|
---|
147 | case ERROR_MAX_THRDS_REACHED: return VERR_MAX_THRDS_REACHED;
|
---|
148 | case ERROR_LOCK_FAILED: return VERR_FILE_LOCK_FAILED;
|
---|
149 | case ERROR_SEM_NOT_FOUND: return VERR_SEM_NOT_FOUND;
|
---|
150 | case ERROR_FILENAME_EXCED_RANGE: return VERR_FILENAME_TOO_LONG;
|
---|
151 | case ERROR_INVALID_SIGNAL_NUMBER: return VERR_SIGNAL_INVALID;
|
---|
152 |
|
---|
153 | case ERROR_BAD_PIPE: return VERR_BAD_PIPE;
|
---|
154 | case ERROR_PIPE_BUSY: return VERR_PIPE_BUSY;
|
---|
155 | case ERROR_NO_DATA: return VERR_NO_DATA;
|
---|
156 | case ERROR_PIPE_NOT_CONNECTED: return VERR_PIPE_NOT_CONNECTED;
|
---|
157 | case ERROR_MORE_DATA: return VERR_MORE_DATA;
|
---|
158 | case ERROR_NOT_OWNER: return VERR_NOT_OWNER;
|
---|
159 | case ERROR_TOO_MANY_POSTS: return VERR_TOO_MANY_POSTS;
|
---|
160 |
|
---|
161 | case ERROR_INTERRUPT: return VERR_INTERRUPTED;
|
---|
162 | //case ERROR_NO_UNICODE_TRANSLATION: return VERR_NO_TRANSLATION;
|
---|
163 | }
|
---|
164 |
|
---|
165 | /* unknown error. */
|
---|
166 | AssertMsgFailed(("Unhandled error %u\n", uNativeCode));
|
---|
167 | return VERR_UNRESOLVED_ERROR;
|
---|
168 | }
|
---|
169 |
|
---|