ReactOS 0.4.15-dev-5669-g09dde2c
SError.c
Go to the documentation of this file.
1#include "syshdrs.h"
2
3#if defined(WIN32) || defined(_WINDOWS)
4
5const char *wsaerrlist[128] = {
6 /* 0 */ "Unknown error #0",
7 /* 1 */ "Unknown error #1",
8 /* 2 */ "Unknown error #2",
9 /* 3 */ "Unknown error #3",
10 /* 4 */ "Interrupted system call",
11 /* 5 */ "Unknown error #5",
12 /* 6 */ "Unknown error #6",
13 /* 7 */ "Unknown error #7",
14 /* 8 */ "Unknown error #8",
15 /* 9 */ "Bad file descriptor",
16 /* 10 */ "Unknown error #10",
17 /* 11 */ "Unknown error #11",
18 /* 12 */ "Unknown error #12",
19 /* 13 */ "Permission denied",
20 /* 14 */ "Bad address",
21 /* 15 */ "Unknown error #15",
22 /* 16 */ "Unknown error #16",
23 /* 17 */ "Unknown error #17",
24 /* 18 */ "Unknown error #18",
25 /* 19 */ "Unknown error #19",
26 /* 20 */ "Unknown error #20",
27 /* 21 */ "Unknown error #21",
28 /* 22 */ "Invalid argument",
29 /* 23 */ "Unknown error #23",
30 /* 24 */ "Too many open files",
31 /* 25 */ "Unknown error #25",
32 /* 26 */ "Unknown error #26",
33 /* 27 */ "Unknown error #27",
34 /* 28 */ "Unknown error #28",
35 /* 29 */ "Unknown error #29",
36 /* 30 */ "Unknown error #30",
37 /* 31 */ "Unknown error #31",
38 /* 32 */ "Unknown error #32",
39 /* 33 */ "Unknown error #33",
40 /* 34 */ "Unknown error #34",
41 /* 35 */ "Resource temporarily unavailable",
42 /* 36 */ "Operation now in progress",
43 /* 37 */ "Operation already in progress",
44 /* 38 */ "Socket operation on non-socket",
45 /* 39 */ "Destination address required",
46 /* 40 */ "Message too long",
47 /* 41 */ "Protocol wrong type for socket",
48 /* 42 */ "Protocol not available",
49 /* 43 */ "Protocol not supported",
50 /* 44 */ "Socket type not supported",
51 /* 45 */ "Operation not supported",
52 /* 46 */ "Protocol family not supported",
53 /* 47 */ "Address family not supported by protocol",
54 /* 48 */ "Address already in use",
55 /* 49 */ "Cannot assign requested address",
56 /* 50 */ "Network is down",
57 /* 51 */ "Network is unreachable",
58 /* 52 */ "Network dropped connection on reset",
59 /* 53 */ "Software caused connection abort",
60 /* 54 */ "Connection reset by peer",
61 /* 55 */ "No buffer space available",
62 /* 56 */ "Transport endpoint is already connected",
63 /* 57 */ "Transport endpoint is not connected",
64 /* 58 */ "Cannot send after transport endpoint shutdown",
65 /* 59 */ "Too many references: cannot splice",
66 /* 60 */ "Connection timed out",
67 /* 61 */ "Connection refused",
68 /* 62 */ "Too many levels of symbolic links",
69 /* 63 */ "File name too long",
70 /* 64 */ "Host is down",
71 /* 65 */ "No route to host",
72 /* 66 */ "Directory not empty",
73 /* 67 */ "WSAEPROCLIM error",
74 /* 68 */ "Too many users",
75 /* 69 */ "Disc quota exceeded",
76 /* 70 */ "Stale NFS file handle",
77 /* 71 */ "Object is remote",
78 /* 72 */ "Unknown error #72",
79 /* 73 */ "Unknown error #73",
80 /* 74 */ "Unknown error #74",
81 /* 75 */ "Unknown error #75",
82 /* 76 */ "Unknown error #76",
83 /* 77 */ "Unknown error #77",
84 /* 78 */ "Unknown error #78",
85 /* 79 */ "Unknown error #79",
86 /* 80 */ "Unknown error #80",
87 /* 81 */ "Unknown error #81",
88 /* 82 */ "Unknown error #82",
89 /* 83 */ "Unknown error #83",
90 /* 84 */ "Unknown error #84",
91 /* 85 */ "Unknown error #85",
92 /* 86 */ "Unknown error #86",
93 /* 87 */ "Unknown error #87",
94 /* 88 */ "Unknown error #88",
95 /* 89 */ "Unknown error #89",
96 /* 90 */ "Unknown error #90",
97 /* 91 */ "WSASYSNOTREADY error",
98 /* 92 */ "Version not supported",
99 /* 93 */ "Winsock not initialised",
100 /* 94 */ "Unknown error #94",
101 /* 95 */ "Unknown error #95",
102 /* 96 */ "Unknown error #96",
103 /* 97 */ "Unknown error #97",
104 /* 98 */ "Unknown error #98",
105 /* 99 */ "Unknown error #99",
106 /* 100 */ "Unknown error #100",
107 /* 101 */ "WSAEDISCON error",
108 /* 102 */ "Unknown error #102",
109 /* 103 */ "Unknown error #103",
110 /* 104 */ "Unknown error #104",
111 /* 105 */ "Unknown error #105",
112 /* 106 */ "Unknown error #106",
113 /* 107 */ "Unknown error #107",
114 /* 108 */ "Unknown error #108",
115 /* 109 */ "Unknown error #109",
116 /* 110 */ "Unknown error #110",
117 /* 111 */ "Unknown error #111",
118 /* 112 */ "Unknown error #112",
119 /* 113 */ "Unknown error #113",
120 /* 114 */ "Unknown error #114",
121 /* 115 */ "Unknown error #115",
122 /* 116 */ "Unknown error #116",
123 /* 117 */ "Unknown error #117",
124 /* 118 */ "Unknown error #118",
125 /* 119 */ "Unknown error #119",
126 /* 120 */ "Unknown error #120",
127 /* 121 */ "Unknown error #121",
128 /* 122 */ "Unknown error #122",
129 /* 123 */ "Unknown error #123",
130 /* 124 */ "Unknown error #124",
131 /* 125 */ "Unknown error #125",
132 /* 126 */ "Unknown error #126",
133 /* 127 */ "Unknown error #127",
134};
135
136#endif /* Windows */
137
138
139
140const char *
142{
143#if defined(WIN32) || defined(_WINDOWS)
144 const char *cp;
145 static char estr[32];
146
147 if (e == 0)
148 e = WSAGetLastError();
149
150 if ((e >= WSABASEERR) && (e < (WSABASEERR + (sizeof(wsaerrlist) / sizeof(const char *))))) {
151 return wsaerrlist[e - WSABASEERR];
152 }
153
154 cp = strerror(e);
155 if ((cp == NULL) || (cp[0] == '\0') || (strcmp(cp, "Unknown error") == 0)) {
156 wsprintf(estr, "Error #%d", e);
157 cp = estr;
158 }
159 return cp;
160#elif defined(HAVE_STRERROR)
161 if (e == 0)
162 e = errno;
163 return strerror(e);
164#else
165 static char estr[32];
166 if (e == 0)
167 e = errno;
168 sprintf(estr, "Error #%d", e);
169 return (estr);
170#endif
171} /* SError */
const char * SError(int e)
Definition: SError.c:141
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define NULL
Definition: types.h:112
#define e
Definition: ke_i.h:82
POINT cp
Definition: magnifier.c:59
#define sprintf(buf, format,...)
Definition: sprintf.c:55
const char * strerror(int err)
Definition: compat_str.c:23
#define errno
Definition: errno.h:18
#define WSABASEERR
Definition: winerror.h:1941
int PASCAL FAR WSAGetLastError(void)
Definition: dllmain.c:112
#define wsprintf
Definition: winuser.h:5855