VirtualBox

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

Last change on this file since 5197 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

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