VirtualBox

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

Last change on this file since 6079 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

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