Enabled entry for STATUS_OBJECT_NAME_EXISTS
[reactos.git] / reactos / ntoskrnl / dbg / errinfo.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /*
20 * PROJECT: ReactOS kernel
21 * FILE: ntoskrnl/dbg/errinfo.c
22 * PURPOSE: Print information descriptions of error messages
23 * PORTABILITY: Checked
24 * UPDATE HISTORY:
25 * Created 22/05/98
26 */
27
28 /* INCLUDES ******************************************************************/
29
30 #include <ddk/ntddk.h>
31 #include <internal/debug.h>
32
33 /* GLOBALS *******************************************************************/
34
35 static PCHAR SeverityCodes[] = {"SUC", "INF", "ERR", "WRN"};
36
37 static struct _FACLIST
38 {
39 ULONG Code;
40 PCHAR Name;
41 } FacList[] =
42 {
43 {0, "KERNEL"},
44 {0, NULL}
45 };
46
47 static struct _ERRLIST
48 {
49 NTSTATUS Code;
50 PCHAR Name;
51 PCHAR Text;
52 } ErrList[] =
53 {
54 {STATUS_SUCCESS, "SUCCESS", NULL},
55 {STATUS_INSUFFICIENT_RESOURCES, "INSUFFICIENT_RESOURCES", NULL},
56 {STATUS_OBJECT_NAME_EXISTS, "OBJECT_NAME_EXISTS", NULL},
57 {STATUS_OBJECT_NAME_COLLISION, "OBJECT_NAME_COLLISION", NULL},
58 {STATUS_CTL_FILE_NOT_SUPPORTED, "CTL_FILE_NOT_SUPPORTED", NULL},
59 {STATUS_PORT_ALREADY_SET, "PORT_ALREADY_SET", NULL},
60 {STATUS_SECTION_NOT_IMAGE, "SECTION_NOT_IMAGE", NULL},
61 {STATUS_BAD_WORKING_SET_LIMIT, "BAD_WORKING_SET_LIMIT", NULL},
62 {STATUS_INCOMPATIBLE_FILE_MAP, "INCOMPATIBLE_FILE_MAP", NULL},
63 {STATUS_HANDLE_NOT_WAITABLE, "HANDLE_NOT_WAITABLE", NULL},
64 {STATUS_PORT_DISCONNECTED, "PORT_DISCONNECTED", NULL},
65 {STATUS_NOT_LOCKED, "NOT_LOCKED", NULL},
66 {STATUS_NOT_MAPPED_VIEW, "NOT_MAPPED_VIEW", NULL},
67 {STATUS_UNABLE_TO_FREE_VM, "UNABLE_TO_FREE_VM", NULL},
68 {STATUS_UNABLE_TO_DELETE_SECTION, "UNABLE_TO_DELETE_SECTION", NULL},
69 {STATUS_MORE_PROCESSING_REQUIRED, "MORE_PROCESSING_REQUIRED", NULL},
70 {STATUS_INVALID_CID, "INVALID_CID", NULL},
71 {STATUS_BAD_INITIAL_STACK, "BAD_INITIAL_STACK", NULL},
72 {STATUS_INVALID_VOLUME_LABEL, "INVALID_VOLUME_LABEL", NULL},
73 {STATUS_SECTION_NOT_EXTENDED, "SECTION_NOT_EXTENDED", NULL},
74 {STATUS_NOT_MAPPED_DATA, "NOT_MAPPED_DATA", NULL},
75 {STATUS_INFO_LENGTH_MISMATCH, "INFO_LENGTH_MISMATCH", NULL},
76 {STATUS_INVALID_INFO_CLASS, "INVALID_INFO_CLASS", NULL},
77 {STATUS_SUSPEND_COUNT_EXCEEDED, "SUSPEND_COUNT_EXCEEDED", NULL},
78 {STATUS_NOTIFY_ENUM_DIR, "NOTIFY_ENUM_DIR", NULL},
79 {STATUS_REGISTRY_RECOVERED, "REGISTRY_RECOVERED", NULL},
80 {STATUS_REGISTRY_IO_FAILED, "REGISTRY_IO_FAILED", NULL},
81 {STATUS_KEY_DELETED, "KEY_DELETED", NULL},
82 {STATUS_NO_LOG_SPACE, "NO_LOG_SPACE", NULL},
83 {STATUS_KEY_HAS_CHILDREN, "KEY_HAS_CHILDREN", NULL},
84 {STATUS_CHILD_MUST_BE_VOLATILE, "CHILD_MUST_BE_VOLATILE", NULL},
85 {STATUS_REGISTRY_CORRUPT, "REGISTRY_CORRUPT", NULL},
86 {STATUS_DLL_NOT_FOUND, "DLL_NOT_FOUND", NULL},
87 {STATUS_DLL_INIT_FAILED, "DLL_INIT_FAILED", NULL},
88 {STATUS_ORDINAL_NOT_FOUND, "ORDINAL_NOT_FOUND", NULL},
89 {STATUS_ENTRYPOINT_NOT_FOUND, "ENTRYPOINT_NOT_FOUND", NULL},
90 {STATUS_MORE_ENTRIES, "MORE_ENTRIES", NULL},
91 {STATUS_BUFFER_OVERFLOW, "BUFFER_OVERFLOW", NULL},
92 {STATUS_NO_MORE_FILES, "NO_MORE_FILES", NULL},
93 {STATUS_NO_INHERITANCE, "NO_INHERITANCE", NULL},
94 {STATUS_NO_MORE_EAS, "NO_MORE_EAS", NULL},
95 {STATUS_NO_MORE_ENTRIES, "NO_MORE_ENTRIES", NULL},
96 {STATUS_GUIDS_EXHAUSTED, "GUIDS_EXHAUSTED", NULL},
97 {STATUS_AGENTS_EXHAUSTED, "AGENTS_EXHAUSTED", NULL},
98 {STATUS_UNSUCCESSFUL, "UNSUCCESSFUL", NULL},
99 {STATUS_NOT_IMPLEMENTED, "NOT_IMPLEMENTED", NULL},
100 {STATUS_ILLEGAL_FUNCTION, "ILLEGAL_FUNCTION", NULL},
101 {STATUS_PAGEFILE_QUOTA, "PAGEFILE_QUOTA", NULL},
102 {STATUS_COMMITMENT_LIMIT, "COMMITMENT_LIMIT", NULL},
103 {STATUS_SECTION_TOO_BIG, "SECTION_TOO_BIG", NULL},
104 {RPC_NT_SS_IN_NULL_CONTEXT, "RPC_NT_SS_IN_NULL_CONTEXT", NULL},
105 {RPC_NT_INVALID_BINDING, "RPC_NT_INVALID_BINDING", NULL},
106 {STATUS_OBJECT_FILE_MISMATCH, "OBJECT_FILE_MISMATCH", NULL},
107 {STATUS_FILE_CLOSED, "FILE_CLOSED", NULL},
108 {STATUS_INVALID_PORT_HANDLE, "INVALID_PORT_HANDLE", NULL},
109 {STATUS_NOT_COMMITTED, "NOT_COMMITTED", NULL},
110 {STATUS_INVALID_PARAMETER, "INVALID_PARAMETER", NULL},
111 {STATUS_INVALID_PARAMETER_1, "INVALID_PARAMETER_1", NULL},
112 {STATUS_INVALID_PARAMETER_2, "INVALID_PARAMETER_2", NULL},
113 {STATUS_INVALID_PARAMETER_3, "INVALID_PARAMETER_3", NULL},
114 {STATUS_INVALID_PARAMETER_4, "INVALID_PARAMETER_4", NULL},
115 {STATUS_INVALID_PARAMETER_5, "INVALID_PARAMETER_5", NULL},
116 {STATUS_INVALID_PARAMETER_6, "INVALID_PARAMETER_6", NULL},
117 {STATUS_INVALID_PARAMETER_7, "INVALID_PARAMETER_7", NULL},
118 {STATUS_INVALID_PARAMETER_8, "INVALID_PARAMETER_8", NULL},
119 {STATUS_INVALID_PARAMETER_9, "INVALID_PARAMETER_9", NULL},
120 {STATUS_INVALID_PARAMETER_10, "INVALID_PARAMETER_10", NULL},
121 {STATUS_INVALID_PARAMETER_11, "INVALID_PARAMETER_11", NULL},
122 {STATUS_INVALID_PARAMETER_12, "INVALID_PARAMETER_12", NULL},
123 {STATUS_INVALID_PARAMETER_MAX, "INVALID_PARAMETER_MAX", NULL},
124 {STATUS_INVALID_PAGE_PROTECTION, "INVALID_PAGE_PROTECTION", NULL},
125 {STATUS_RESOURCE_DATA_NOT_FOUND, "RESOURCE_DATA_NOT_FOUND", NULL},
126 {STATUS_RESOURCE_TYPE_NOT_FOUND, "RESOURCE_TYPE_NOT_FOUND", NULL},
127 {STATUS_RESOURCE_NAME_NOT_FOUND, "RESOURCE_NAME_NOT_FOUND", NULL},
128 {STATUS_RESOURCE_LANG_NOT_FOUND, "RESOURCE_LANG_NOT_FOUND", NULL},
129 {STATUS_NO_SUCH_DEVICE, "NO_SUCH_DEVICE", NULL},
130 {STATUS_NO_SUCH_FILE, "NO_SUCH_FILE", NULL},
131 {STATUS_INVALID_DEVICE_REQUEST, "INVALID_DEVICE_REQUEST", NULL},
132 {STATUS_END_OF_FILE, "END_OF_FILE", NULL},
133 {STATUS_FILE_FORCED_CLOSED, "FILE_FORCED_CLOSED", NULL},
134 {STATUS_WRONG_VOLUME, "WRONG_VOLUME", NULL},
135 {STATUS_NO_MEDIA, "NO_MEDIA", NULL},
136 {STATUS_NO_MEDIA_IN_DEVICE, "NO_MEDIA_IN_DEVICE", NULL},
137 {STATUS_NONEXISTENT_SECTOR, "NONEXISTENT_SECTOR", NULL},
138 {STATUS_WORKING_SET_QUOTA, "WORKING_SET_QUOTA", NULL},
139 {STATUS_CONFLICTING_ADDRESS, "CONFLICTING_ADDRESS", NULL},
140 {STATUS_INVALID_SYSTEM_SERVICE, "INVALID_SYSTEM_SERVICE", NULL},
141 {STATUS_THREAD_IS_TERMINATING, "THREAD_IS_TERMINATING", NULL},
142 {STATUS_PROCESS_IS_TERMINATING, "PROCESS_IS_TERMINATING", NULL},
143 {STATUS_INVALID_LOCK_SEQUENCE, "INVALID_LOCK_SEQUENCE", NULL},
144 {STATUS_INVALID_VIEW_SIZE, "INVALID_VIEW_SIZE", NULL},
145 {STATUS_ALREADY_COMMITTED, "ALREADY_COMMITTED", NULL},
146 {STATUS_ACCESS_DENIED, "ACCESS_DENIED", NULL},
147 {STATUS_FILE_IS_A_DIRECTORY, "FILE_IS_A_DIRECTORY", NULL},
148 {STATUS_CANNOT_DELETE, "CANNOT_DELETE", NULL},
149 {STATUS_INVALID_COMPUTER_NAME, "INVALID_COMPUTER_NAME", NULL},
150 {STATUS_FILE_DELETED, "FILE_DELETED", NULL},
151 {STATUS_DELETE_PENDING, "DELETE_PENDING", NULL},
152 {STATUS_PORT_CONNECTION_REFUSED, "PORT_CONNECTION_REFUSED", NULL},
153 {STATUS_NO_SUCH_PRIVILEGE, "NO_SUCH_PRIVILEGE", NULL},
154 {STATUS_PRIVILEGE_NOT_HELD, "PRIVILEGE_NOT_HELD", NULL},
155 {STATUS_CANNOT_IMPERSONATE, "CANNOT_IMPERSONATE", NULL},
156 {STATUS_LOGON_FAILURE, "LOGON_FAILURE", NULL},
157 {STATUS_ACCOUNT_RESTRICTION, "ACCOUNT_RESTRICTION", NULL},
158 {STATUS_INVALID_LOGON_HOURS, "INVALID_LOGON_HOURS", NULL},
159 {STATUS_INVALID_WORKSTATION, "INVALID_WORKSTATION", NULL},
160 {STATUS_BUFFER_TOO_SMALL, "BUFFER_TOO_SMALL", NULL},
161 {STATUS_UNABLE_TO_DECOMMIT_VM, "UNABLE_TO_DECOMMIT_VM", NULL},
162 {STATUS_DISK_CORRUPT_ERROR, "DISK_CORRUPT_ERROR", NULL},
163 {STATUS_OBJECT_NAME_INVALID, "OBJECT_NAME_INVALID", NULL},
164 {STATUS_OBJECT_NAME_NOT_FOUND, "OBJECT_NAME_NOT_FOUND", NULL},
165 {STATUS_OBJECT_PATH_INVALID, "OBJECT_PATH_INVALID", NULL},
166 {STATUS_OBJECT_PATH_NOT_FOUND, "OBJECT_PATH_NOT_FOUND", NULL},
167 {STATUS_DFS_EXIT_PATH_FOUND, "DFS_EXIT_PATH_FOUND", NULL},
168 {STATUS_PATH_SYNTAX_BAD, "PATH_SYNTAX_BAD", NULL},
169 {STATUS_DATA_OVERRUN, "DATA_OVERRUN", NULL},
170 {STATUS_DATA_LATE_ERROR, "DATA_LATE_ERROR", NULL},
171 {STATUS_DATA_ERROR, "DATA_ERROR", NULL},
172 {STATUS_CRC_ERROR, "CRC_ERROR", NULL},
173 {STATUS_SHARING_VIOLATION, "SHARING_VIOLATION", NULL},
174 {STATUS_QUOTA_EXCEEDED, "QUOTA_EXCEEDED", NULL},
175 {STATUS_MUTANT_NOT_OWNED, "MUTANT_NOT_OWNED", NULL},
176 {STATUS_SEMAPHORE_LIMIT_EXCEEDED, "SEMAPHORE_LIMIT_EXCEEDED", NULL},
177 {STATUS_DISK_FULL, "DISK_FULL", NULL},
178 {STATUS_LOCK_NOT_GRANTED, "LOCK_NOT_GRANTED", NULL},
179 {STATUS_DEVICE_NOT_READY, "DEVICE_NOT_READY", NULL},
180 {STATUS_IO_TIMEOUT, "IO_TIMEOUT", NULL},
181 {STATUS_MEDIA_WRITE_PROTECTED, "MEDIA_WRITE_PROTECTED", NULL},
182 {STATUS_NO_MEDIA_IN_DRIVE, "NO_MEDIA_IN_DRIVE", NULL},
183 {STATUS_VERIFY_REQUIRED, "VERIFY_REQUIRED", NULL},
184 {STATUS_UNRECOGNIZED_MEDIA, "UNRECOGNIZED_MEDIA", NULL},
185 {STATUS_UNRECOGNIZED_VOLUME, "UNRECOGNIZED_VOLUME", NULL},
186 {STATUS_FS_DRIVER_REQUIRED, "FS_DRIVER_REQUIRED", NULL},
187 {STATUS_NOT_SUPPORTED, "NOT_SUPPORTED", NULL},
188 {STATUS_DISK_OPERATION_FAILED, "DISK_OPERATION_FAILED", NULL},
189 {STATUS_FS_QUERY_REQUIRED, "FS_QUERY_REQUIRED", NULL},
190 {0, NULL, NULL}
191 };
192
193 /* FUNCTIONS *****************************************************************/
194
195 VOID
196 DbgGetErrorText(NTSTATUS ErrorCode, PUNICODE_STRING ErrorText, ULONG Flags)
197 {
198 int i;
199 char TempBuf[255], NumBuf[32];
200 ANSI_STRING AnsiString;
201
202 TempBuf[0] = '\0';
203 if (Flags & DBG_GET_SHOW_FACILITY)
204 {
205 if (NT_CUSTOMER(ErrorCode))
206 {
207 sprintf(TempBuf,
208 "%%CUST-%s-",
209 SeverityCodes[NT_SEVERITY(ErrorCode)]);
210 }
211 else
212 {
213 for (i = 0; FacList[i].Name != NULL; i++)
214 {
215 if (FacList[i].Code == NT_FACILITY(ErrorCode))
216 {
217 break;
218 }
219 }
220 if (FacList[i].Name != NULL)
221 {
222 sprintf(TempBuf, "%%%s-%s-",
223 FacList[i].Name,
224 SeverityCodes[NT_SEVERITY(ErrorCode)]);
225 }
226 else
227 {
228 sprintf(TempBuf, "%%UNKNOWN-%s-",
229 SeverityCodes[NT_SEVERITY(ErrorCode)]);
230 }
231 }
232 }
233 for (i = 0; ErrList[i].Name != NULL; i++)
234 {
235 if (ErrorCode == ErrList[i].Code)
236 {
237 break;
238 }
239 }
240 if (ErrList[i].Name != NULL)
241 {
242 if (Flags & DBG_GET_SHOW_FACILITY)
243 {
244 strcat(TempBuf, ErrList[i].Name);
245 strcat(TempBuf, " ");
246 }
247 if (ErrList[i].Text != NULL)
248 {
249 strcat(TempBuf, ErrList[i].Text);
250 }
251 else
252 {
253 strcat(TempBuf, ErrList[i].Name);
254 }
255 }
256 else
257 {
258 if (Flags & DBG_GET_SHOW_FACILITY)
259 {
260 sprintf(NumBuf, "%08lx", ErrorCode);
261 strcat(TempBuf, NumBuf);
262 strcat(TempBuf, " ");
263 }
264 sprintf(NumBuf, "Unknown Message #%08lx", ErrorCode);
265 strcat(TempBuf, NumBuf);
266 }
267 RtlInitAnsiString(&AnsiString, TempBuf);
268 RtlAnsiStringToUnicodeString(ErrorText, &AnsiString, TRUE);
269 }
270
271 VOID
272 DbgPrintErrorMessage(NTSTATUS ErrorCode)
273 {
274 UNICODE_STRING ErrorText;
275
276 DbgGetErrorText(ErrorCode, &ErrorText, 0xf);
277 DbgPrint("%wZ\n", &ErrorText);
278 RtlFreeUnicodeString(&ErrorText);
279 }
280
281