VirtualBox

source: vbox/trunk/src/VBox/Runtime/os2/RTErrConvertFromOS2.cpp@ 78229

Last change on this file since 78229 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 7.7 KB
Line 
1/* $Id: RTErrConvertFromOS2.cpp 76553 2019-01-01 01:45:53Z vboxsync $ */
2/** @file
3 * IPRT - Convert OS/2 error codes to iprt status codes.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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#define INCL_ERRORS
32#define INCL_DOSERRORS
33#include <os2.h>
34#undef RT_MAX
35
36#include <iprt/err.h>
37#include <iprt/log.h>
38#include <iprt/assert.h>
39
40
41RTDECL(int) RTErrConvertFromOS2(unsigned uNativeCode)
42{
43 /* very fast check for no error. */
44 if (uNativeCode == NO_ERROR)
45 return VINF_SUCCESS;
46
47 switch (uNativeCode)
48 {
49 case ERROR_INVALID_FUNCTION: return VERR_INVALID_FUNCTION;
50 case ERROR_FILE_NOT_FOUND: return VERR_FILE_NOT_FOUND;
51 case ERROR_PATH_NOT_FOUND: return VERR_PATH_NOT_FOUND;
52 case ERROR_TOO_MANY_OPEN_FILES: return VERR_TOO_MANY_OPEN_FILES;
53 case ERROR_ACCESS_DENIED: return VERR_ACCESS_DENIED;
54
55 case ERROR_INVALID_HANDLE:
56 case ERROR_DIRECT_ACCESS_HANDLE: return VERR_INVALID_HANDLE;
57
58 case ERROR_NOT_ENOUGH_MEMORY: return VERR_NO_MEMORY;
59
60 case ERROR_INVALID_DRIVE: return VERR_INVALID_DRIVE;
61 case ERROR_CURRENT_DIRECTORY: return VERR_CANT_DELETE_DIRECTORY;
62 case ERROR_NOT_SAME_DEVICE: return VERR_NOT_SAME_DEVICE;
63 case ERROR_NO_MORE_FILES: return VERR_NO_MORE_FILES;
64 case ERROR_WRITE_PROTECT: return VERR_WRITE_PROTECT;
65 case ERROR_BAD_UNIT: return VERR_IO_BAD_UNIT;
66 case ERROR_NOT_READY: return VERR_IO_NOT_READY;
67 case ERROR_BAD_COMMAND: return VERR_IO_BAD_COMMAND;
68 case ERROR_CRC: return VERR_IO_CRC;
69 case ERROR_BAD_LENGTH: return VERR_IO_BAD_LENGTH;
70 case ERROR_SEEK: return VERR_SEEK;
71 case ERROR_NOT_DOS_DISK: return VERR_DISK_INVALID_FORMAT;
72 case ERROR_SECTOR_NOT_FOUND: return VERR_IO_SECTOR_NOT_FOUND;
73 case ERROR_WRITE_FAULT: return VERR_WRITE_ERROR;
74 case ERROR_READ_FAULT: return VERR_READ_ERROR;
75 case ERROR_GEN_FAILURE: return VERR_IO_GEN_FAILURE;
76 case ERROR_SHARING_VIOLATION: return VERR_SHARING_VIOLATION;
77 case ERROR_LOCK_VIOLATION: return VERR_FILE_LOCK_FAILED;
78 case ERROR_HANDLE_EOF: return VERR_EOF;
79
80 case ERROR_HANDLE_DISK_FULL:
81 case ERROR_DISK_FULL: return VERR_DISK_FULL;
82
83 case ERROR_NOT_SUPPORTED: return VERR_NOT_SUPPORTED;
84
85 case ERROR_INVALID_PARAMETER:
86 case ERROR_BAD_ARGUMENTS:
87 case ERROR_PMM_INVALID_FLAGS: return VERR_INVALID_PARAMETER;
88
89 case ERROR_REM_NOT_LIST: return VERR_NET_IO_ERROR;
90
91 case ERROR_BAD_NETPATH:
92 case ERROR_NETNAME_DELETED: return VERR_NET_HOST_NOT_FOUND;
93
94 case ERROR_BAD_NET_NAME:
95 case ERROR_DEV_NOT_EXIST: return VERR_NET_PATH_NOT_FOUND;
96
97 case ERROR_NETWORK_BUSY:
98 case ERROR_TOO_MANY_CMDS:
99 case ERROR_TOO_MANY_NAMES:
100 case ERROR_TOO_MANY_SESS:
101 case ERROR_OUT_OF_STRUCTURES: return VERR_NET_OUT_OF_RESOURCES;
102
103 case ERROR_PRINTQ_FULL:
104 case ERROR_NO_SPOOL_SPACE:
105 case ERROR_PRINT_CANCELLED: return VERR_NET_PRINT_ERROR;
106
107 case ERROR_DUP_NAME:
108 case ERROR_ADAP_HDW_ERR:
109 case ERROR_BAD_NET_RESP:
110 case ERROR_UNEXP_NET_ERR:
111 case ERROR_BAD_REM_ADAP:
112 case ERROR_NETWORK_ACCESS_DENIED:
113 case ERROR_BAD_DEV_TYPE:
114 case ERROR_SHARING_PAUSED:
115 case ERROR_REQ_NOT_ACCEP:
116 case ERROR_REDIR_PAUSED:
117 case ERROR_ALREADY_ASSIGNED:
118 case ERROR_INVALID_PASSWORD:
119 case ERROR_NET_WRITE_FAULT: return VERR_NET_IO_ERROR;
120
121 case ERROR_FILE_EXISTS:
122 case ERROR_ALREADY_EXISTS: return VERR_ALREADY_EXISTS;
123
124 case ERROR_CANNOT_MAKE: return VERR_CANT_CREATE;
125 case ERROR_NO_PROC_SLOTS: return VERR_MAX_PROCS_REACHED;
126 case ERROR_TOO_MANY_SEMAPHORES: return VERR_TOO_MANY_SEMAPHORES;
127 case ERROR_EXCL_SEM_ALREADY_OWNED: return VERR_EXCL_SEM_ALREADY_OWNED;
128 case ERROR_SEM_IS_SET: return VERR_SEM_IS_SET;
129 case ERROR_TOO_MANY_SEM_REQUESTS: return VERR_TOO_MANY_SEM_REQUESTS;
130 case ERROR_SEM_OWNER_DIED: return VERR_SEM_OWNER_DIED;
131 case ERROR_DRIVE_LOCKED: return VERR_DRIVE_LOCKED;
132 case ERROR_BROKEN_PIPE: return VERR_BROKEN_PIPE;
133 case ERROR_OPEN_FAILED: return VERR_OPEN_FAILED;
134
135 case ERROR_BUFFER_OVERFLOW:
136 case ERROR_INSUFFICIENT_BUFFER: return VERR_BUFFER_OVERFLOW;
137
138 case ERROR_NO_MORE_SEARCH_HANDLES: return VERR_NO_MORE_SEARCH_HANDLES;
139
140 case ERROR_SEM_TIMEOUT:
141 case ERROR_TIMEOUT: return VERR_TIMEOUT;
142
143 case ERROR_INVALID_NAME:
144 case ERROR_BAD_PATHNAME: return VERR_INVALID_NAME;
145
146 case ERROR_NEGATIVE_SEEK: return VERR_NEGATIVE_SEEK;
147 case ERROR_SEEK_ON_DEVICE: return VERR_SEEK_ON_DEVICE;
148
149 case ERROR_SIGNAL_REFUSED:
150 case ERROR_NO_SIGNAL_SENT: return VERR_SIGNAL_REFUSED;
151
152 case ERROR_SIGNAL_PENDING: return VERR_SIGNAL_PENDING;
153 case ERROR_MAX_THRDS_REACHED: return VERR_MAX_THRDS_REACHED;
154 case ERROR_LOCK_FAILED: return VERR_FILE_LOCK_FAILED;
155 case ERROR_SEM_NOT_FOUND: return VERR_SEM_NOT_FOUND;
156 case ERROR_FILENAME_EXCED_RANGE: return VERR_FILENAME_TOO_LONG;
157 case ERROR_INVALID_SIGNAL_NUMBER: return VERR_SIGNAL_INVALID;
158
159 case ERROR_BAD_PIPE: return VERR_BAD_PIPE;
160 case ERROR_PIPE_BUSY: return VERR_PIPE_BUSY;
161 case ERROR_NO_DATA: return VERR_NO_DATA;
162 case ERROR_PIPE_NOT_CONNECTED: return VERR_PIPE_NOT_CONNECTED;
163 case ERROR_MORE_DATA: return VERR_MORE_DATA;
164 case ERROR_NOT_OWNER: return VERR_NOT_OWNER;
165 case ERROR_TOO_MANY_POSTS: return VERR_TOO_MANY_POSTS;
166
167 case ERROR_INTERRUPT: return VERR_INTERRUPTED;
168
169 case ERROR_BUSY: return VERR_MEMORY_BUSY;
170 //case ERROR_NO_UNICODE_TRANSLATION: return VERR_NO_TRANSLATION;
171 }
172
173 /* unknown error. */
174 AssertLogRelMsgFailed(("Unhandled error %u\n", uNativeCode));
175 return VERR_UNRESOLVED_ERROR;
176}
177
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette