OpenCBM
sys/libcommon/debug.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 2004 Spiro Trikaliotis
8  *
9  */
10 
21 // #define DBG_IS_DEBUG_C
22 
23 #include <wdm.h>
24 // #include <ntddk.h>
25 #include "cbm_driver.h"
26 
27 #include "../../arch/windows/debug.c"
28 
30 #ifndef min
31 # define min(_x, _y) ( ((_x) < (_y)) ? (_x) : (_y) )
32 #endif
33 
50 #if 0
51  #define REPORT_BUG(_no, _a, _b, _c, _d, _str) KeBugCheckEx(_no, _a, _b, _c, _d)
52 #else
53  #define REPORT_BUG(_no, _a, _b, _c, _d, _str) \
54  DbgPrint("--- REPORT_BUG: %04x (%08x, %08x, %08x, %08x). '%s' " \
55  "in %s, %s(), line %u\n", \
56  _no, _a, _b, _c, _d, _str, \
57  __FILE__, __FUNCTION__, __LINE__);
58 #endif
59 
60 
61 
63 typedef
64 struct NTSTATUS_DEBUGCODE
65 {
67  const UCHAR *Name;
68 
70  NTSTATUS Value;
71 
73 
75 #define DEFINE_STATUSCODE(_x) { #_x, _x }
76 
78 #define _MARKLASTENTRY ((NTSTATUS) -1)
79 
81 #define _LASTENTRY { "", _MARKLASTENTRY }
82 
84 const
86 {
87  DEFINE_STATUSCODE(STATUS_SUCCESS),
88  DEFINE_STATUSCODE(STATUS_SUCCESS),
89  DEFINE_STATUSCODE(STATUS_WAIT_0),
90  DEFINE_STATUSCODE(STATUS_WAIT_1),
91  DEFINE_STATUSCODE(STATUS_WAIT_2),
92  DEFINE_STATUSCODE(STATUS_WAIT_3),
93  DEFINE_STATUSCODE(STATUS_WAIT_63),
94  DEFINE_STATUSCODE(STATUS_ABANDONED),
95  DEFINE_STATUSCODE(STATUS_ABANDONED_WAIT_0),
96  DEFINE_STATUSCODE(STATUS_ABANDONED_WAIT_63),
97  DEFINE_STATUSCODE(STATUS_USER_APC),
98  DEFINE_STATUSCODE(STATUS_KERNEL_APC),
99  DEFINE_STATUSCODE(STATUS_ALERTED),
100  DEFINE_STATUSCODE(STATUS_TIMEOUT),
101  DEFINE_STATUSCODE(STATUS_PENDING),
102  DEFINE_STATUSCODE(STATUS_REPARSE),
103  DEFINE_STATUSCODE(STATUS_MORE_ENTRIES),
104  DEFINE_STATUSCODE(STATUS_NOT_ALL_ASSIGNED),
105  DEFINE_STATUSCODE(STATUS_SOME_NOT_MAPPED),
106  DEFINE_STATUSCODE(STATUS_OPLOCK_BREAK_IN_PROGRESS),
107  DEFINE_STATUSCODE(STATUS_VOLUME_MOUNTED),
108  DEFINE_STATUSCODE(STATUS_RXACT_COMMITTED),
109  DEFINE_STATUSCODE(STATUS_NOTIFY_CLEANUP),
110  DEFINE_STATUSCODE(STATUS_NOTIFY_ENUM_DIR),
111  DEFINE_STATUSCODE(STATUS_NO_QUOTAS_FOR_ACCOUNT),
112  DEFINE_STATUSCODE(STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED),
113  DEFINE_STATUSCODE(STATUS_PAGE_FAULT_TRANSITION),
114  DEFINE_STATUSCODE(STATUS_PAGE_FAULT_DEMAND_ZERO),
115  DEFINE_STATUSCODE(STATUS_PAGE_FAULT_COPY_ON_WRITE),
116  DEFINE_STATUSCODE(STATUS_PAGE_FAULT_GUARD_PAGE),
117  DEFINE_STATUSCODE(STATUS_PAGE_FAULT_PAGING_FILE),
118  DEFINE_STATUSCODE(STATUS_CACHE_PAGE_LOCKED),
119  DEFINE_STATUSCODE(STATUS_CRASH_DUMP),
120  DEFINE_STATUSCODE(STATUS_BUFFER_ALL_ZEROS),
121  DEFINE_STATUSCODE(STATUS_REPARSE_OBJECT),
122  DEFINE_STATUSCODE(STATUS_RESOURCE_REQUIREMENTS_CHANGED),
123  DEFINE_STATUSCODE(STATUS_TRANSLATION_COMPLETE),
124  DEFINE_STATUSCODE(STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY),
125  DEFINE_STATUSCODE(DBG_EXCEPTION_HANDLED),
126  DEFINE_STATUSCODE(DBG_CONTINUE),
127  DEFINE_STATUSCODE(STATUS_OBJECT_NAME_EXISTS),
128  DEFINE_STATUSCODE(STATUS_THREAD_WAS_SUSPENDED),
129  DEFINE_STATUSCODE(STATUS_WORKING_SET_LIMIT_RANGE),
130  DEFINE_STATUSCODE(STATUS_IMAGE_NOT_AT_BASE),
131  DEFINE_STATUSCODE(STATUS_RXACT_STATE_CREATED),
132  DEFINE_STATUSCODE(STATUS_SEGMENT_NOTIFICATION),
133  DEFINE_STATUSCODE(STATUS_LOCAL_USER_SESSION_KEY),
134  DEFINE_STATUSCODE(STATUS_BAD_CURRENT_DIRECTORY),
135  DEFINE_STATUSCODE(STATUS_SERIAL_MORE_WRITES),
136  DEFINE_STATUSCODE(STATUS_REGISTRY_RECOVERED),
137  DEFINE_STATUSCODE(STATUS_FT_READ_RECOVERY_FROM_BACKUP),
138  DEFINE_STATUSCODE(STATUS_FT_WRITE_RECOVERY),
139  DEFINE_STATUSCODE(STATUS_SERIAL_COUNTER_TIMEOUT),
140  DEFINE_STATUSCODE(STATUS_NULL_LM_PASSWORD),
141  DEFINE_STATUSCODE(STATUS_IMAGE_MACHINE_TYPE_MISMATCH),
142  DEFINE_STATUSCODE(STATUS_RECEIVE_PARTIAL),
143  DEFINE_STATUSCODE(STATUS_RECEIVE_EXPEDITED),
144  DEFINE_STATUSCODE(STATUS_RECEIVE_PARTIAL_EXPEDITED),
145  DEFINE_STATUSCODE(STATUS_EVENT_DONE),
146  DEFINE_STATUSCODE(STATUS_EVENT_PENDING),
147  DEFINE_STATUSCODE(STATUS_CHECKING_FILE_SYSTEM),
148  DEFINE_STATUSCODE(STATUS_FATAL_APP_EXIT),
149  DEFINE_STATUSCODE(STATUS_PREDEFINED_HANDLE),
150  DEFINE_STATUSCODE(STATUS_WAS_UNLOCKED),
151  DEFINE_STATUSCODE(STATUS_SERVICE_NOTIFICATION),
152  DEFINE_STATUSCODE(STATUS_WAS_LOCKED),
153  DEFINE_STATUSCODE(STATUS_LOG_HARD_ERROR),
154  DEFINE_STATUSCODE(STATUS_ALREADY_WIN32),
155  DEFINE_STATUSCODE(STATUS_WX86_UNSIMULATE),
156  DEFINE_STATUSCODE(STATUS_WX86_CONTINUE),
157  DEFINE_STATUSCODE(STATUS_WX86_SINGLE_STEP),
158  DEFINE_STATUSCODE(STATUS_WX86_BREAKPOINT),
159  DEFINE_STATUSCODE(STATUS_WX86_EXCEPTION_CONTINUE),
160  DEFINE_STATUSCODE(STATUS_WX86_EXCEPTION_LASTCHANCE),
161  DEFINE_STATUSCODE(STATUS_WX86_EXCEPTION_CHAIN),
162  DEFINE_STATUSCODE(STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE),
163  DEFINE_STATUSCODE(STATUS_NO_YIELD_PERFORMED),
164  DEFINE_STATUSCODE(STATUS_TIMER_RESUME_IGNORED),
165  DEFINE_STATUSCODE(STATUS_ARBITRATION_UNHANDLED),
166  DEFINE_STATUSCODE(STATUS_CARDBUS_NOT_SUPPORTED),
167  DEFINE_STATUSCODE(STATUS_WX86_CREATEWX86TIB),
168  DEFINE_STATUSCODE(STATUS_MP_PROCESSOR_MISMATCH),
169  DEFINE_STATUSCODE(DBG_REPLY_LATER),
170  DEFINE_STATUSCODE(DBG_UNABLE_TO_PROVIDE_HANDLE),
171  DEFINE_STATUSCODE(DBG_TERMINATE_THREAD),
172  DEFINE_STATUSCODE(DBG_TERMINATE_PROCESS),
173  DEFINE_STATUSCODE(DBG_CONTROL_C),
174  DEFINE_STATUSCODE(DBG_PRINTEXCEPTION_C),
175  DEFINE_STATUSCODE(DBG_RIPEXCEPTION),
176  DEFINE_STATUSCODE(DBG_CONTROL_BREAK),
177  DEFINE_STATUSCODE(STATUS_GUARD_PAGE_VIOLATION),
178  DEFINE_STATUSCODE(STATUS_DATATYPE_MISALIGNMENT),
179  DEFINE_STATUSCODE(STATUS_BREAKPOINT),
180  DEFINE_STATUSCODE(STATUS_SINGLE_STEP),
181  DEFINE_STATUSCODE(STATUS_BUFFER_OVERFLOW),
182  DEFINE_STATUSCODE(STATUS_NO_MORE_FILES),
183  DEFINE_STATUSCODE(STATUS_WAKE_SYSTEM_DEBUGGER),
184  DEFINE_STATUSCODE(STATUS_HANDLES_CLOSED),
185  DEFINE_STATUSCODE(STATUS_NO_INHERITANCE),
186  DEFINE_STATUSCODE(STATUS_GUID_SUBSTITUTION_MADE),
187  DEFINE_STATUSCODE(STATUS_PARTIAL_COPY),
188  DEFINE_STATUSCODE(STATUS_DEVICE_PAPER_EMPTY),
189  DEFINE_STATUSCODE(STATUS_DEVICE_POWERED_OFF),
190  DEFINE_STATUSCODE(STATUS_DEVICE_OFF_LINE),
191  DEFINE_STATUSCODE(STATUS_DEVICE_BUSY),
192  DEFINE_STATUSCODE(STATUS_NO_MORE_EAS),
193  DEFINE_STATUSCODE(STATUS_INVALID_EA_NAME),
194  DEFINE_STATUSCODE(STATUS_EA_LIST_INCONSISTENT),
195  DEFINE_STATUSCODE(STATUS_INVALID_EA_FLAG),
196  DEFINE_STATUSCODE(STATUS_VERIFY_REQUIRED),
197  DEFINE_STATUSCODE(STATUS_EXTRANEOUS_INFORMATION),
198  DEFINE_STATUSCODE(STATUS_RXACT_COMMIT_NECESSARY),
199  DEFINE_STATUSCODE(STATUS_NO_MORE_ENTRIES),
200  DEFINE_STATUSCODE(STATUS_FILEMARK_DETECTED),
201  DEFINE_STATUSCODE(STATUS_MEDIA_CHANGED),
202  DEFINE_STATUSCODE(STATUS_BUS_RESET),
203  DEFINE_STATUSCODE(STATUS_END_OF_MEDIA),
204  DEFINE_STATUSCODE(STATUS_BEGINNING_OF_MEDIA),
205  DEFINE_STATUSCODE(STATUS_MEDIA_CHECK),
206  DEFINE_STATUSCODE(STATUS_SETMARK_DETECTED),
207  DEFINE_STATUSCODE(STATUS_NO_DATA_DETECTED),
208  DEFINE_STATUSCODE(STATUS_REDIRECTOR_HAS_OPEN_HANDLES),
209  DEFINE_STATUSCODE(STATUS_SERVER_HAS_OPEN_HANDLES),
210  DEFINE_STATUSCODE(STATUS_ALREADY_DISCONNECTED),
211  DEFINE_STATUSCODE(STATUS_LONGJUMP),
212  DEFINE_STATUSCODE(DBG_EXCEPTION_NOT_HANDLED),
213  DEFINE_STATUSCODE(STATUS_UNSUCCESSFUL),
214  DEFINE_STATUSCODE(STATUS_NOT_IMPLEMENTED),
215  DEFINE_STATUSCODE(STATUS_INVALID_INFO_CLASS),
216  DEFINE_STATUSCODE(STATUS_INFO_LENGTH_MISMATCH),
217  DEFINE_STATUSCODE(STATUS_ACCESS_VIOLATION),
218  DEFINE_STATUSCODE(STATUS_IN_PAGE_ERROR),
219  DEFINE_STATUSCODE(STATUS_PAGEFILE_QUOTA),
220  DEFINE_STATUSCODE(STATUS_INVALID_HANDLE),
221  DEFINE_STATUSCODE(STATUS_BAD_INITIAL_STACK),
222  DEFINE_STATUSCODE(STATUS_BAD_INITIAL_PC),
223  DEFINE_STATUSCODE(STATUS_INVALID_CID),
224  DEFINE_STATUSCODE(STATUS_TIMER_NOT_CANCELED),
225  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER),
226  DEFINE_STATUSCODE(STATUS_NO_SUCH_DEVICE),
227  DEFINE_STATUSCODE(STATUS_NO_SUCH_FILE),
228  DEFINE_STATUSCODE(STATUS_INVALID_DEVICE_REQUEST),
229  DEFINE_STATUSCODE(STATUS_END_OF_FILE),
230  DEFINE_STATUSCODE(STATUS_WRONG_VOLUME),
231  DEFINE_STATUSCODE(STATUS_NO_MEDIA_IN_DEVICE),
232  DEFINE_STATUSCODE(STATUS_UNRECOGNIZED_MEDIA),
233  DEFINE_STATUSCODE(STATUS_NONEXISTENT_SECTOR),
234  DEFINE_STATUSCODE(STATUS_MORE_PROCESSING_REQUIRED),
235  DEFINE_STATUSCODE(STATUS_NO_MEMORY),
236  DEFINE_STATUSCODE(STATUS_CONFLICTING_ADDRESSES),
237  DEFINE_STATUSCODE(STATUS_NOT_MAPPED_VIEW),
238  DEFINE_STATUSCODE(STATUS_UNABLE_TO_FREE_VM),
239  DEFINE_STATUSCODE(STATUS_UNABLE_TO_DELETE_SECTION),
240  DEFINE_STATUSCODE(STATUS_INVALID_SYSTEM_SERVICE),
241  DEFINE_STATUSCODE(STATUS_ILLEGAL_INSTRUCTION),
242  DEFINE_STATUSCODE(STATUS_INVALID_LOCK_SEQUENCE),
243  DEFINE_STATUSCODE(STATUS_INVALID_VIEW_SIZE),
244  DEFINE_STATUSCODE(STATUS_INVALID_FILE_FOR_SECTION),
245  DEFINE_STATUSCODE(STATUS_ALREADY_COMMITTED),
246  DEFINE_STATUSCODE(STATUS_ACCESS_DENIED),
247  DEFINE_STATUSCODE(STATUS_BUFFER_TOO_SMALL),
248  DEFINE_STATUSCODE(STATUS_OBJECT_TYPE_MISMATCH),
249  DEFINE_STATUSCODE(STATUS_NONCONTINUABLE_EXCEPTION),
250  DEFINE_STATUSCODE(STATUS_INVALID_DISPOSITION),
251  DEFINE_STATUSCODE(STATUS_UNWIND),
252  DEFINE_STATUSCODE(STATUS_BAD_STACK),
253  DEFINE_STATUSCODE(STATUS_INVALID_UNWIND_TARGET),
254  DEFINE_STATUSCODE(STATUS_NOT_LOCKED),
255  DEFINE_STATUSCODE(STATUS_PARITY_ERROR),
256  DEFINE_STATUSCODE(STATUS_UNABLE_TO_DECOMMIT_VM),
257  DEFINE_STATUSCODE(STATUS_NOT_COMMITTED),
258  DEFINE_STATUSCODE(STATUS_INVALID_PORT_ATTRIBUTES),
259  DEFINE_STATUSCODE(STATUS_PORT_MESSAGE_TOO_LONG),
260  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_MIX),
261  DEFINE_STATUSCODE(STATUS_INVALID_QUOTA_LOWER),
262  DEFINE_STATUSCODE(STATUS_DISK_CORRUPT_ERROR),
263  DEFINE_STATUSCODE(STATUS_OBJECT_NAME_INVALID),
264  DEFINE_STATUSCODE(STATUS_OBJECT_NAME_NOT_FOUND),
265  DEFINE_STATUSCODE(STATUS_OBJECT_NAME_COLLISION),
266  DEFINE_STATUSCODE(STATUS_PORT_DISCONNECTED),
267  DEFINE_STATUSCODE(STATUS_DEVICE_ALREADY_ATTACHED),
268  DEFINE_STATUSCODE(STATUS_OBJECT_PATH_INVALID),
269  DEFINE_STATUSCODE(STATUS_OBJECT_PATH_NOT_FOUND),
270  DEFINE_STATUSCODE(STATUS_OBJECT_PATH_SYNTAX_BAD),
271  DEFINE_STATUSCODE(STATUS_DATA_OVERRUN),
272  DEFINE_STATUSCODE(STATUS_DATA_LATE_ERROR),
273  DEFINE_STATUSCODE(STATUS_DATA_ERROR),
274  DEFINE_STATUSCODE(STATUS_CRC_ERROR),
275  DEFINE_STATUSCODE(STATUS_SECTION_TOO_BIG),
276  DEFINE_STATUSCODE(STATUS_PORT_CONNECTION_REFUSED),
277  DEFINE_STATUSCODE(STATUS_INVALID_PORT_HANDLE),
278  DEFINE_STATUSCODE(STATUS_SHARING_VIOLATION),
279  DEFINE_STATUSCODE(STATUS_QUOTA_EXCEEDED),
280  DEFINE_STATUSCODE(STATUS_INVALID_PAGE_PROTECTION),
281  DEFINE_STATUSCODE(STATUS_MUTANT_NOT_OWNED),
282  DEFINE_STATUSCODE(STATUS_SEMAPHORE_LIMIT_EXCEEDED),
283  DEFINE_STATUSCODE(STATUS_PORT_ALREADY_SET),
284  DEFINE_STATUSCODE(STATUS_SECTION_NOT_IMAGE),
285  DEFINE_STATUSCODE(STATUS_SUSPEND_COUNT_EXCEEDED),
286  DEFINE_STATUSCODE(STATUS_THREAD_IS_TERMINATING),
287  DEFINE_STATUSCODE(STATUS_BAD_WORKING_SET_LIMIT),
288  DEFINE_STATUSCODE(STATUS_INCOMPATIBLE_FILE_MAP),
289  DEFINE_STATUSCODE(STATUS_SECTION_PROTECTION),
290  DEFINE_STATUSCODE(STATUS_EAS_NOT_SUPPORTED),
291  DEFINE_STATUSCODE(STATUS_EA_TOO_LARGE),
292  DEFINE_STATUSCODE(STATUS_NONEXISTENT_EA_ENTRY),
293  DEFINE_STATUSCODE(STATUS_NO_EAS_ON_FILE),
294  DEFINE_STATUSCODE(STATUS_EA_CORRUPT_ERROR),
295  DEFINE_STATUSCODE(STATUS_FILE_LOCK_CONFLICT),
296  DEFINE_STATUSCODE(STATUS_LOCK_NOT_GRANTED),
297  DEFINE_STATUSCODE(STATUS_DELETE_PENDING),
298  DEFINE_STATUSCODE(STATUS_CTL_FILE_NOT_SUPPORTED),
299  DEFINE_STATUSCODE(STATUS_UNKNOWN_REVISION),
300  DEFINE_STATUSCODE(STATUS_REVISION_MISMATCH),
301  DEFINE_STATUSCODE(STATUS_INVALID_OWNER),
302  DEFINE_STATUSCODE(STATUS_INVALID_PRIMARY_GROUP),
303  DEFINE_STATUSCODE(STATUS_NO_IMPERSONATION_TOKEN),
304  DEFINE_STATUSCODE(STATUS_CANT_DISABLE_MANDATORY),
305  DEFINE_STATUSCODE(STATUS_NO_LOGON_SERVERS),
306  DEFINE_STATUSCODE(STATUS_NO_SUCH_LOGON_SESSION),
307  DEFINE_STATUSCODE(STATUS_NO_SUCH_PRIVILEGE),
308  DEFINE_STATUSCODE(STATUS_PRIVILEGE_NOT_HELD),
309  DEFINE_STATUSCODE(STATUS_INVALID_ACCOUNT_NAME),
310  DEFINE_STATUSCODE(STATUS_USER_EXISTS),
311  DEFINE_STATUSCODE(STATUS_NO_SUCH_USER),
312  DEFINE_STATUSCODE(STATUS_GROUP_EXISTS),
313  DEFINE_STATUSCODE(STATUS_NO_SUCH_GROUP),
314  DEFINE_STATUSCODE(STATUS_MEMBER_IN_GROUP),
315  DEFINE_STATUSCODE(STATUS_MEMBER_NOT_IN_GROUP),
316  DEFINE_STATUSCODE(STATUS_LAST_ADMIN),
317  DEFINE_STATUSCODE(STATUS_WRONG_PASSWORD),
318  DEFINE_STATUSCODE(STATUS_ILL_FORMED_PASSWORD),
319  DEFINE_STATUSCODE(STATUS_PASSWORD_RESTRICTION),
320  DEFINE_STATUSCODE(STATUS_LOGON_FAILURE),
321  DEFINE_STATUSCODE(STATUS_ACCOUNT_RESTRICTION),
322  DEFINE_STATUSCODE(STATUS_INVALID_LOGON_HOURS),
323  DEFINE_STATUSCODE(STATUS_INVALID_WORKSTATION),
324  DEFINE_STATUSCODE(STATUS_PASSWORD_EXPIRED),
325  DEFINE_STATUSCODE(STATUS_ACCOUNT_DISABLED),
326  DEFINE_STATUSCODE(STATUS_NONE_MAPPED),
327  DEFINE_STATUSCODE(STATUS_TOO_MANY_LUIDS_REQUESTED),
328  DEFINE_STATUSCODE(STATUS_LUIDS_EXHAUSTED),
329  DEFINE_STATUSCODE(STATUS_INVALID_SUB_AUTHORITY),
330  DEFINE_STATUSCODE(STATUS_INVALID_ACL),
331  DEFINE_STATUSCODE(STATUS_INVALID_SID),
332  DEFINE_STATUSCODE(STATUS_INVALID_SECURITY_DESCR),
333  DEFINE_STATUSCODE(STATUS_PROCEDURE_NOT_FOUND),
334  DEFINE_STATUSCODE(STATUS_INVALID_IMAGE_FORMAT),
335  DEFINE_STATUSCODE(STATUS_NO_TOKEN),
336  DEFINE_STATUSCODE(STATUS_BAD_INHERITANCE_ACL),
337  DEFINE_STATUSCODE(STATUS_RANGE_NOT_LOCKED),
338  DEFINE_STATUSCODE(STATUS_DISK_FULL),
339  DEFINE_STATUSCODE(STATUS_SERVER_DISABLED),
340  DEFINE_STATUSCODE(STATUS_SERVER_NOT_DISABLED),
341  DEFINE_STATUSCODE(STATUS_TOO_MANY_GUIDS_REQUESTED),
342  DEFINE_STATUSCODE(STATUS_GUIDS_EXHAUSTED),
343  DEFINE_STATUSCODE(STATUS_INVALID_ID_AUTHORITY),
344  DEFINE_STATUSCODE(STATUS_AGENTS_EXHAUSTED),
345  DEFINE_STATUSCODE(STATUS_INVALID_VOLUME_LABEL),
346  DEFINE_STATUSCODE(STATUS_SECTION_NOT_EXTENDED),
347  DEFINE_STATUSCODE(STATUS_NOT_MAPPED_DATA),
348  DEFINE_STATUSCODE(STATUS_RESOURCE_DATA_NOT_FOUND),
349  DEFINE_STATUSCODE(STATUS_RESOURCE_TYPE_NOT_FOUND),
350  DEFINE_STATUSCODE(STATUS_RESOURCE_NAME_NOT_FOUND),
351  DEFINE_STATUSCODE(STATUS_ARRAY_BOUNDS_EXCEEDED),
352  DEFINE_STATUSCODE(STATUS_FLOAT_DENORMAL_OPERAND),
353  DEFINE_STATUSCODE(STATUS_FLOAT_DIVIDE_BY_ZERO),
354  DEFINE_STATUSCODE(STATUS_FLOAT_INEXACT_RESULT),
355  DEFINE_STATUSCODE(STATUS_FLOAT_INVALID_OPERATION),
356  DEFINE_STATUSCODE(STATUS_FLOAT_OVERFLOW),
357  DEFINE_STATUSCODE(STATUS_FLOAT_STACK_CHECK),
358  DEFINE_STATUSCODE(STATUS_FLOAT_UNDERFLOW),
359  DEFINE_STATUSCODE(STATUS_INTEGER_DIVIDE_BY_ZERO),
360  DEFINE_STATUSCODE(STATUS_INTEGER_OVERFLOW),
361  DEFINE_STATUSCODE(STATUS_PRIVILEGED_INSTRUCTION),
362  DEFINE_STATUSCODE(STATUS_TOO_MANY_PAGING_FILES),
363  DEFINE_STATUSCODE(STATUS_FILE_INVALID),
364  DEFINE_STATUSCODE(STATUS_ALLOTTED_SPACE_EXCEEDED),
365  DEFINE_STATUSCODE(STATUS_INSUFFICIENT_RESOURCES),
366  DEFINE_STATUSCODE(STATUS_DFS_EXIT_PATH_FOUND),
367  DEFINE_STATUSCODE(STATUS_DEVICE_DATA_ERROR),
368  DEFINE_STATUSCODE(STATUS_DEVICE_NOT_CONNECTED),
369  DEFINE_STATUSCODE(STATUS_DEVICE_POWER_FAILURE),
370  DEFINE_STATUSCODE(STATUS_FREE_VM_NOT_AT_BASE),
371  DEFINE_STATUSCODE(STATUS_MEMORY_NOT_ALLOCATED),
372  DEFINE_STATUSCODE(STATUS_WORKING_SET_QUOTA),
373  DEFINE_STATUSCODE(STATUS_MEDIA_WRITE_PROTECTED),
374  DEFINE_STATUSCODE(STATUS_DEVICE_NOT_READY),
375  DEFINE_STATUSCODE(STATUS_INVALID_GROUP_ATTRIBUTES),
376  DEFINE_STATUSCODE(STATUS_BAD_IMPERSONATION_LEVEL),
377  DEFINE_STATUSCODE(STATUS_CANT_OPEN_ANONYMOUS),
378  DEFINE_STATUSCODE(STATUS_BAD_VALIDATION_CLASS),
379  DEFINE_STATUSCODE(STATUS_BAD_TOKEN_TYPE),
380  DEFINE_STATUSCODE(STATUS_BAD_MASTER_BOOT_RECORD),
381  DEFINE_STATUSCODE(STATUS_INSTRUCTION_MISALIGNMENT),
382  DEFINE_STATUSCODE(STATUS_INSTANCE_NOT_AVAILABLE),
383  DEFINE_STATUSCODE(STATUS_PIPE_NOT_AVAILABLE),
384  DEFINE_STATUSCODE(STATUS_INVALID_PIPE_STATE),
385  DEFINE_STATUSCODE(STATUS_PIPE_BUSY),
386  DEFINE_STATUSCODE(STATUS_ILLEGAL_FUNCTION),
387  DEFINE_STATUSCODE(STATUS_PIPE_DISCONNECTED),
388  DEFINE_STATUSCODE(STATUS_PIPE_CLOSING),
389  DEFINE_STATUSCODE(STATUS_PIPE_CONNECTED),
390  DEFINE_STATUSCODE(STATUS_PIPE_LISTENING),
391  DEFINE_STATUSCODE(STATUS_INVALID_READ_MODE),
392  DEFINE_STATUSCODE(STATUS_IO_TIMEOUT),
393  DEFINE_STATUSCODE(STATUS_FILE_FORCED_CLOSED),
394  DEFINE_STATUSCODE(STATUS_PROFILING_NOT_STARTED),
395  DEFINE_STATUSCODE(STATUS_PROFILING_NOT_STOPPED),
396  DEFINE_STATUSCODE(STATUS_COULD_NOT_INTERPRET),
397  DEFINE_STATUSCODE(STATUS_FILE_IS_A_DIRECTORY),
398  DEFINE_STATUSCODE(STATUS_NOT_SUPPORTED),
399  DEFINE_STATUSCODE(STATUS_REMOTE_NOT_LISTENING),
400  DEFINE_STATUSCODE(STATUS_DUPLICATE_NAME),
401  DEFINE_STATUSCODE(STATUS_BAD_NETWORK_PATH),
402  DEFINE_STATUSCODE(STATUS_NETWORK_BUSY),
403  DEFINE_STATUSCODE(STATUS_DEVICE_DOES_NOT_EXIST),
404  DEFINE_STATUSCODE(STATUS_TOO_MANY_COMMANDS),
405  DEFINE_STATUSCODE(STATUS_ADAPTER_HARDWARE_ERROR),
406  DEFINE_STATUSCODE(STATUS_INVALID_NETWORK_RESPONSE),
407  DEFINE_STATUSCODE(STATUS_UNEXPECTED_NETWORK_ERROR),
408  DEFINE_STATUSCODE(STATUS_BAD_REMOTE_ADAPTER),
409  DEFINE_STATUSCODE(STATUS_PRINT_QUEUE_FULL),
410  DEFINE_STATUSCODE(STATUS_NO_SPOOL_SPACE),
411  DEFINE_STATUSCODE(STATUS_PRINT_CANCELLED),
412  DEFINE_STATUSCODE(STATUS_NETWORK_NAME_DELETED),
413  DEFINE_STATUSCODE(STATUS_NETWORK_ACCESS_DENIED),
414  DEFINE_STATUSCODE(STATUS_BAD_DEVICE_TYPE),
415  DEFINE_STATUSCODE(STATUS_BAD_NETWORK_NAME),
416  DEFINE_STATUSCODE(STATUS_TOO_MANY_NAMES),
417  DEFINE_STATUSCODE(STATUS_TOO_MANY_SESSIONS),
418  DEFINE_STATUSCODE(STATUS_SHARING_PAUSED),
419  DEFINE_STATUSCODE(STATUS_REQUEST_NOT_ACCEPTED),
420  DEFINE_STATUSCODE(STATUS_REDIRECTOR_PAUSED),
421  DEFINE_STATUSCODE(STATUS_NET_WRITE_FAULT),
422  DEFINE_STATUSCODE(STATUS_PROFILING_AT_LIMIT),
423  DEFINE_STATUSCODE(STATUS_NOT_SAME_DEVICE),
424  DEFINE_STATUSCODE(STATUS_FILE_RENAMED),
425  DEFINE_STATUSCODE(STATUS_VIRTUAL_CIRCUIT_CLOSED),
426  DEFINE_STATUSCODE(STATUS_NO_SECURITY_ON_OBJECT),
427  DEFINE_STATUSCODE(STATUS_CANT_WAIT),
428  DEFINE_STATUSCODE(STATUS_PIPE_EMPTY),
429  DEFINE_STATUSCODE(STATUS_CANT_ACCESS_DOMAIN_INFO),
430  DEFINE_STATUSCODE(STATUS_CANT_TERMINATE_SELF),
431  DEFINE_STATUSCODE(STATUS_INVALID_SERVER_STATE),
432  DEFINE_STATUSCODE(STATUS_INVALID_DOMAIN_STATE),
433  DEFINE_STATUSCODE(STATUS_INVALID_DOMAIN_ROLE),
434  DEFINE_STATUSCODE(STATUS_NO_SUCH_DOMAIN),
435  DEFINE_STATUSCODE(STATUS_DOMAIN_EXISTS),
436  DEFINE_STATUSCODE(STATUS_DOMAIN_LIMIT_EXCEEDED),
437  DEFINE_STATUSCODE(STATUS_OPLOCK_NOT_GRANTED),
438  DEFINE_STATUSCODE(STATUS_INVALID_OPLOCK_PROTOCOL),
439  DEFINE_STATUSCODE(STATUS_INTERNAL_DB_CORRUPTION),
440  DEFINE_STATUSCODE(STATUS_INTERNAL_ERROR),
441  DEFINE_STATUSCODE(STATUS_GENERIC_NOT_MAPPED),
442  DEFINE_STATUSCODE(STATUS_BAD_DESCRIPTOR_FORMAT),
443  DEFINE_STATUSCODE(STATUS_INVALID_USER_BUFFER),
444  DEFINE_STATUSCODE(STATUS_UNEXPECTED_IO_ERROR),
445  DEFINE_STATUSCODE(STATUS_UNEXPECTED_MM_CREATE_ERR),
446  DEFINE_STATUSCODE(STATUS_UNEXPECTED_MM_MAP_ERROR),
447  DEFINE_STATUSCODE(STATUS_UNEXPECTED_MM_EXTEND_ERR),
448  DEFINE_STATUSCODE(STATUS_NOT_LOGON_PROCESS),
449  DEFINE_STATUSCODE(STATUS_LOGON_SESSION_EXISTS),
450  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_1),
451  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_2),
452  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_3),
453  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_4),
454  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_5),
455  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_6),
456  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_7),
457  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_8),
458  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_9),
459  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_10),
460  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_11),
461  DEFINE_STATUSCODE(STATUS_INVALID_PARAMETER_12),
462  DEFINE_STATUSCODE(STATUS_REDIRECTOR_NOT_STARTED),
463  DEFINE_STATUSCODE(STATUS_REDIRECTOR_STARTED),
464  DEFINE_STATUSCODE(STATUS_STACK_OVERFLOW),
465  DEFINE_STATUSCODE(STATUS_NO_SUCH_PACKAGE),
466  DEFINE_STATUSCODE(STATUS_BAD_FUNCTION_TABLE),
467  DEFINE_STATUSCODE(STATUS_VARIABLE_NOT_FOUND),
468  DEFINE_STATUSCODE(STATUS_DIRECTORY_NOT_EMPTY),
469  DEFINE_STATUSCODE(STATUS_FILE_CORRUPT_ERROR),
470  DEFINE_STATUSCODE(STATUS_NOT_A_DIRECTORY),
471  DEFINE_STATUSCODE(STATUS_BAD_LOGON_SESSION_STATE),
472  DEFINE_STATUSCODE(STATUS_LOGON_SESSION_COLLISION),
473  DEFINE_STATUSCODE(STATUS_NAME_TOO_LONG),
474  DEFINE_STATUSCODE(STATUS_FILES_OPEN),
475  DEFINE_STATUSCODE(STATUS_CONNECTION_IN_USE),
476  DEFINE_STATUSCODE(STATUS_MESSAGE_NOT_FOUND),
477  DEFINE_STATUSCODE(STATUS_PROCESS_IS_TERMINATING),
478  DEFINE_STATUSCODE(STATUS_INVALID_LOGON_TYPE),
479  DEFINE_STATUSCODE(STATUS_NO_GUID_TRANSLATION),
480  DEFINE_STATUSCODE(STATUS_CANNOT_IMPERSONATE),
481  DEFINE_STATUSCODE(STATUS_IMAGE_ALREADY_LOADED),
482  DEFINE_STATUSCODE(STATUS_ABIOS_NOT_PRESENT),
483  DEFINE_STATUSCODE(STATUS_ABIOS_LID_NOT_EXIST),
484  DEFINE_STATUSCODE(STATUS_ABIOS_LID_ALREADY_OWNED),
485  DEFINE_STATUSCODE(STATUS_ABIOS_NOT_LID_OWNER),
486  DEFINE_STATUSCODE(STATUS_ABIOS_INVALID_COMMAND),
487  DEFINE_STATUSCODE(STATUS_ABIOS_INVALID_LID),
488  DEFINE_STATUSCODE(STATUS_ABIOS_SELECTOR_NOT_AVAILABLE),
489  DEFINE_STATUSCODE(STATUS_ABIOS_INVALID_SELECTOR),
490  DEFINE_STATUSCODE(STATUS_NO_LDT),
491  DEFINE_STATUSCODE(STATUS_INVALID_LDT_SIZE),
492  DEFINE_STATUSCODE(STATUS_INVALID_LDT_OFFSET),
493  DEFINE_STATUSCODE(STATUS_INVALID_LDT_DESCRIPTOR),
494  DEFINE_STATUSCODE(STATUS_INVALID_IMAGE_NE_FORMAT),
495  DEFINE_STATUSCODE(STATUS_RXACT_INVALID_STATE),
496  DEFINE_STATUSCODE(STATUS_RXACT_COMMIT_FAILURE),
497  DEFINE_STATUSCODE(STATUS_MAPPED_FILE_SIZE_ZERO),
498  DEFINE_STATUSCODE(STATUS_TOO_MANY_OPENED_FILES),
499  DEFINE_STATUSCODE(STATUS_CANCELLED),
500  DEFINE_STATUSCODE(STATUS_CANNOT_DELETE),
501  DEFINE_STATUSCODE(STATUS_INVALID_COMPUTER_NAME),
502  DEFINE_STATUSCODE(STATUS_FILE_DELETED),
503  DEFINE_STATUSCODE(STATUS_SPECIAL_ACCOUNT),
504  DEFINE_STATUSCODE(STATUS_SPECIAL_GROUP),
505  DEFINE_STATUSCODE(STATUS_SPECIAL_USER),
506  DEFINE_STATUSCODE(STATUS_MEMBERS_PRIMARY_GROUP),
507  DEFINE_STATUSCODE(STATUS_FILE_CLOSED),
508  DEFINE_STATUSCODE(STATUS_TOO_MANY_THREADS),
509  DEFINE_STATUSCODE(STATUS_THREAD_NOT_IN_PROCESS),
510  DEFINE_STATUSCODE(STATUS_TOKEN_ALREADY_IN_USE),
511  DEFINE_STATUSCODE(STATUS_PAGEFILE_QUOTA_EXCEEDED),
512  DEFINE_STATUSCODE(STATUS_COMMITMENT_LIMIT),
513  DEFINE_STATUSCODE(STATUS_INVALID_IMAGE_LE_FORMAT),
514  DEFINE_STATUSCODE(STATUS_INVALID_IMAGE_NOT_MZ),
515  DEFINE_STATUSCODE(STATUS_INVALID_IMAGE_PROTECT),
516  DEFINE_STATUSCODE(STATUS_INVALID_IMAGE_WIN_16),
517  DEFINE_STATUSCODE(STATUS_LOGON_SERVER_CONFLICT),
518  DEFINE_STATUSCODE(STATUS_TIME_DIFFERENCE_AT_DC),
519  DEFINE_STATUSCODE(STATUS_SYNCHRONIZATION_REQUIRED),
520  DEFINE_STATUSCODE(STATUS_DLL_NOT_FOUND),
521  DEFINE_STATUSCODE(STATUS_OPEN_FAILED),
522  DEFINE_STATUSCODE(STATUS_IO_PRIVILEGE_FAILED),
523  DEFINE_STATUSCODE(STATUS_ORDINAL_NOT_FOUND),
524  DEFINE_STATUSCODE(STATUS_ENTRYPOINT_NOT_FOUND),
525  DEFINE_STATUSCODE(STATUS_CONTROL_C_EXIT),
526  DEFINE_STATUSCODE(STATUS_LOCAL_DISCONNECT),
527  DEFINE_STATUSCODE(STATUS_REMOTE_DISCONNECT),
528  DEFINE_STATUSCODE(STATUS_REMOTE_RESOURCES),
529  DEFINE_STATUSCODE(STATUS_LINK_FAILED),
530  DEFINE_STATUSCODE(STATUS_LINK_TIMEOUT),
531  DEFINE_STATUSCODE(STATUS_INVALID_CONNECTION),
532  DEFINE_STATUSCODE(STATUS_INVALID_ADDRESS),
533  DEFINE_STATUSCODE(STATUS_DLL_INIT_FAILED),
534  DEFINE_STATUSCODE(STATUS_MISSING_SYSTEMFILE),
535  DEFINE_STATUSCODE(STATUS_UNHANDLED_EXCEPTION),
536  DEFINE_STATUSCODE(STATUS_APP_INIT_FAILURE),
537  DEFINE_STATUSCODE(STATUS_PAGEFILE_CREATE_FAILED),
538  DEFINE_STATUSCODE(STATUS_NO_PAGEFILE),
539  DEFINE_STATUSCODE(STATUS_INVALID_LEVEL),
540  DEFINE_STATUSCODE(STATUS_WRONG_PASSWORD_CORE),
541  DEFINE_STATUSCODE(STATUS_ILLEGAL_FLOAT_CONTEXT),
542  DEFINE_STATUSCODE(STATUS_PIPE_BROKEN),
543  DEFINE_STATUSCODE(STATUS_REGISTRY_CORRUPT),
544  DEFINE_STATUSCODE(STATUS_REGISTRY_IO_FAILED),
545  DEFINE_STATUSCODE(STATUS_NO_EVENT_PAIR),
546  DEFINE_STATUSCODE(STATUS_UNRECOGNIZED_VOLUME),
547  DEFINE_STATUSCODE(STATUS_SERIAL_NO_DEVICE_INITED),
548  DEFINE_STATUSCODE(STATUS_NO_SUCH_ALIAS),
549  DEFINE_STATUSCODE(STATUS_MEMBER_NOT_IN_ALIAS),
550  DEFINE_STATUSCODE(STATUS_MEMBER_IN_ALIAS),
551  DEFINE_STATUSCODE(STATUS_ALIAS_EXISTS),
552  DEFINE_STATUSCODE(STATUS_LOGON_NOT_GRANTED),
553  DEFINE_STATUSCODE(STATUS_TOO_MANY_SECRETS),
554  DEFINE_STATUSCODE(STATUS_SECRET_TOO_LONG),
555  DEFINE_STATUSCODE(STATUS_INTERNAL_DB_ERROR),
556  DEFINE_STATUSCODE(STATUS_FULLSCREEN_MODE),
557  DEFINE_STATUSCODE(STATUS_TOO_MANY_CONTEXT_IDS),
558  DEFINE_STATUSCODE(STATUS_LOGON_TYPE_NOT_GRANTED),
559  DEFINE_STATUSCODE(STATUS_NOT_REGISTRY_FILE),
560  DEFINE_STATUSCODE(STATUS_NT_CROSS_ENCRYPTION_REQUIRED),
561  DEFINE_STATUSCODE(STATUS_DOMAIN_CTRLR_CONFIG_ERROR),
562  DEFINE_STATUSCODE(STATUS_FT_MISSING_MEMBER),
563  DEFINE_STATUSCODE(STATUS_ILL_FORMED_SERVICE_ENTRY),
564  DEFINE_STATUSCODE(STATUS_ILLEGAL_CHARACTER),
565  DEFINE_STATUSCODE(STATUS_UNMAPPABLE_CHARACTER),
566  DEFINE_STATUSCODE(STATUS_UNDEFINED_CHARACTER),
567  DEFINE_STATUSCODE(STATUS_FLOPPY_VOLUME),
568  DEFINE_STATUSCODE(STATUS_FLOPPY_ID_MARK_NOT_FOUND),
569  DEFINE_STATUSCODE(STATUS_FLOPPY_WRONG_CYLINDER),
570  DEFINE_STATUSCODE(STATUS_FLOPPY_UNKNOWN_ERROR),
571  DEFINE_STATUSCODE(STATUS_FLOPPY_BAD_REGISTERS),
572  DEFINE_STATUSCODE(STATUS_DISK_RECALIBRATE_FAILED),
573  DEFINE_STATUSCODE(STATUS_DISK_OPERATION_FAILED),
574  DEFINE_STATUSCODE(STATUS_DISK_RESET_FAILED),
575  DEFINE_STATUSCODE(STATUS_SHARED_IRQ_BUSY),
576  DEFINE_STATUSCODE(STATUS_FT_ORPHANING),
577  DEFINE_STATUSCODE(STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT),
578  DEFINE_STATUSCODE(STATUS_PARTITION_FAILURE),
579  DEFINE_STATUSCODE(STATUS_INVALID_BLOCK_LENGTH),
580  DEFINE_STATUSCODE(STATUS_DEVICE_NOT_PARTITIONED),
581  DEFINE_STATUSCODE(STATUS_UNABLE_TO_LOCK_MEDIA),
582  DEFINE_STATUSCODE(STATUS_UNABLE_TO_UNLOAD_MEDIA),
583  DEFINE_STATUSCODE(STATUS_EOM_OVERFLOW),
584  DEFINE_STATUSCODE(STATUS_NO_MEDIA),
585  DEFINE_STATUSCODE(STATUS_NO_SUCH_MEMBER),
586  DEFINE_STATUSCODE(STATUS_INVALID_MEMBER),
587  DEFINE_STATUSCODE(STATUS_KEY_DELETED),
588  DEFINE_STATUSCODE(STATUS_NO_LOG_SPACE),
589  DEFINE_STATUSCODE(STATUS_TOO_MANY_SIDS),
590  DEFINE_STATUSCODE(STATUS_LM_CROSS_ENCRYPTION_REQUIRED),
591  DEFINE_STATUSCODE(STATUS_KEY_HAS_CHILDREN),
592  DEFINE_STATUSCODE(STATUS_CHILD_MUST_BE_VOLATILE),
593  DEFINE_STATUSCODE(STATUS_DEVICE_CONFIGURATION_ERROR),
594  DEFINE_STATUSCODE(STATUS_DRIVER_INTERNAL_ERROR),
595  DEFINE_STATUSCODE(STATUS_INVALID_DEVICE_STATE),
596  DEFINE_STATUSCODE(STATUS_IO_DEVICE_ERROR),
597  DEFINE_STATUSCODE(STATUS_DEVICE_PROTOCOL_ERROR),
598  DEFINE_STATUSCODE(STATUS_BACKUP_CONTROLLER),
599  DEFINE_STATUSCODE(STATUS_LOG_FILE_FULL),
600  DEFINE_STATUSCODE(STATUS_TOO_LATE),
601  DEFINE_STATUSCODE(STATUS_NO_TRUST_LSA_SECRET),
602  DEFINE_STATUSCODE(STATUS_NO_TRUST_SAM_ACCOUNT),
603  DEFINE_STATUSCODE(STATUS_TRUSTED_DOMAIN_FAILURE),
604  DEFINE_STATUSCODE(STATUS_TRUSTED_RELATIONSHIP_FAILURE),
605  DEFINE_STATUSCODE(STATUS_EVENTLOG_FILE_CORRUPT),
606  DEFINE_STATUSCODE(STATUS_EVENTLOG_CANT_START),
607  DEFINE_STATUSCODE(STATUS_TRUST_FAILURE),
608  DEFINE_STATUSCODE(STATUS_MUTANT_LIMIT_EXCEEDED),
609  DEFINE_STATUSCODE(STATUS_NETLOGON_NOT_STARTED),
610  DEFINE_STATUSCODE(STATUS_ACCOUNT_EXPIRED),
611  DEFINE_STATUSCODE(STATUS_POSSIBLE_DEADLOCK),
612  DEFINE_STATUSCODE(STATUS_NETWORK_CREDENTIAL_CONFLICT),
613  DEFINE_STATUSCODE(STATUS_REMOTE_SESSION_LIMIT),
614  DEFINE_STATUSCODE(STATUS_EVENTLOG_FILE_CHANGED),
615  DEFINE_STATUSCODE(STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT),
616  DEFINE_STATUSCODE(STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT),
617  DEFINE_STATUSCODE(STATUS_NOLOGON_SERVER_TRUST_ACCOUNT),
618  DEFINE_STATUSCODE(STATUS_DOMAIN_TRUST_INCONSISTENT),
619  DEFINE_STATUSCODE(STATUS_FS_DRIVER_REQUIRED),
620  DEFINE_STATUSCODE(STATUS_NO_USER_SESSION_KEY),
621  DEFINE_STATUSCODE(STATUS_USER_SESSION_DELETED),
622  DEFINE_STATUSCODE(STATUS_RESOURCE_LANG_NOT_FOUND),
623  DEFINE_STATUSCODE(STATUS_INSUFF_SERVER_RESOURCES),
624  DEFINE_STATUSCODE(STATUS_INVALID_BUFFER_SIZE),
625  DEFINE_STATUSCODE(STATUS_INVALID_ADDRESS_COMPONENT),
626  DEFINE_STATUSCODE(STATUS_INVALID_ADDRESS_WILDCARD),
627  DEFINE_STATUSCODE(STATUS_TOO_MANY_ADDRESSES),
628  DEFINE_STATUSCODE(STATUS_ADDRESS_ALREADY_EXISTS),
629  DEFINE_STATUSCODE(STATUS_ADDRESS_CLOSED),
630  DEFINE_STATUSCODE(STATUS_CONNECTION_DISCONNECTED),
631  DEFINE_STATUSCODE(STATUS_CONNECTION_RESET),
632  DEFINE_STATUSCODE(STATUS_TOO_MANY_NODES),
633  DEFINE_STATUSCODE(STATUS_TRANSACTION_ABORTED),
634  DEFINE_STATUSCODE(STATUS_TRANSACTION_TIMED_OUT),
635  DEFINE_STATUSCODE(STATUS_TRANSACTION_NO_RELEASE),
636  DEFINE_STATUSCODE(STATUS_TRANSACTION_NO_MATCH),
637  DEFINE_STATUSCODE(STATUS_TRANSACTION_RESPONDED),
638  DEFINE_STATUSCODE(STATUS_TRANSACTION_INVALID_ID),
639  DEFINE_STATUSCODE(STATUS_TRANSACTION_INVALID_TYPE),
640  DEFINE_STATUSCODE(STATUS_NOT_SERVER_SESSION),
641  DEFINE_STATUSCODE(STATUS_NOT_CLIENT_SESSION),
642  DEFINE_STATUSCODE(STATUS_CANNOT_LOAD_REGISTRY_FILE),
643  DEFINE_STATUSCODE(STATUS_DEBUG_ATTACH_FAILED),
644  DEFINE_STATUSCODE(STATUS_SYSTEM_PROCESS_TERMINATED),
645  DEFINE_STATUSCODE(STATUS_DATA_NOT_ACCEPTED),
646  DEFINE_STATUSCODE(STATUS_NO_BROWSER_SERVERS_FOUND),
647  DEFINE_STATUSCODE(STATUS_VDM_HARD_ERROR),
648  DEFINE_STATUSCODE(STATUS_DRIVER_CANCEL_TIMEOUT),
649  DEFINE_STATUSCODE(STATUS_REPLY_MESSAGE_MISMATCH),
650  DEFINE_STATUSCODE(STATUS_MAPPED_ALIGNMENT),
651  DEFINE_STATUSCODE(STATUS_IMAGE_CHECKSUM_MISMATCH),
652  DEFINE_STATUSCODE(STATUS_LOST_WRITEBEHIND_DATA),
653  DEFINE_STATUSCODE(STATUS_CLIENT_SERVER_PARAMETERS_INVALID),
654  DEFINE_STATUSCODE(STATUS_PASSWORD_MUST_CHANGE),
655  DEFINE_STATUSCODE(STATUS_NOT_FOUND),
656  DEFINE_STATUSCODE(STATUS_NOT_TINY_STREAM),
657  DEFINE_STATUSCODE(STATUS_RECOVERY_FAILURE),
658  DEFINE_STATUSCODE(STATUS_STACK_OVERFLOW_READ),
659  DEFINE_STATUSCODE(STATUS_FAIL_CHECK),
660  DEFINE_STATUSCODE(STATUS_DUPLICATE_OBJECTID),
661  DEFINE_STATUSCODE(STATUS_OBJECTID_EXISTS),
662  DEFINE_STATUSCODE(STATUS_CONVERT_TO_LARGE),
663  DEFINE_STATUSCODE(STATUS_RETRY),
664  DEFINE_STATUSCODE(STATUS_FOUND_OUT_OF_SCOPE),
665  DEFINE_STATUSCODE(STATUS_ALLOCATE_BUCKET),
666  DEFINE_STATUSCODE(STATUS_PROPSET_NOT_FOUND),
667  DEFINE_STATUSCODE(STATUS_MARSHALL_OVERFLOW),
668  DEFINE_STATUSCODE(STATUS_INVALID_VARIANT),
669  DEFINE_STATUSCODE(STATUS_DOMAIN_CONTROLLER_NOT_FOUND),
670  DEFINE_STATUSCODE(STATUS_ACCOUNT_LOCKED_OUT),
671  DEFINE_STATUSCODE(STATUS_HANDLE_NOT_CLOSABLE),
672  DEFINE_STATUSCODE(STATUS_CONNECTION_REFUSED),
673  DEFINE_STATUSCODE(STATUS_GRACEFUL_DISCONNECT),
674  DEFINE_STATUSCODE(STATUS_ADDRESS_ALREADY_ASSOCIATED),
675  DEFINE_STATUSCODE(STATUS_ADDRESS_NOT_ASSOCIATED),
676  DEFINE_STATUSCODE(STATUS_CONNECTION_INVALID),
677  DEFINE_STATUSCODE(STATUS_CONNECTION_ACTIVE),
678  DEFINE_STATUSCODE(STATUS_NETWORK_UNREACHABLE),
679  DEFINE_STATUSCODE(STATUS_HOST_UNREACHABLE),
680  DEFINE_STATUSCODE(STATUS_PROTOCOL_UNREACHABLE),
681  DEFINE_STATUSCODE(STATUS_PORT_UNREACHABLE),
682  DEFINE_STATUSCODE(STATUS_REQUEST_ABORTED),
683  DEFINE_STATUSCODE(STATUS_CONNECTION_ABORTED),
684  DEFINE_STATUSCODE(STATUS_BAD_COMPRESSION_BUFFER),
685  DEFINE_STATUSCODE(STATUS_USER_MAPPED_FILE),
686  DEFINE_STATUSCODE(STATUS_AUDIT_FAILED),
687  DEFINE_STATUSCODE(STATUS_TIMER_RESOLUTION_NOT_SET),
688  DEFINE_STATUSCODE(STATUS_CONNECTION_COUNT_LIMIT),
689  DEFINE_STATUSCODE(STATUS_LOGIN_TIME_RESTRICTION),
690  DEFINE_STATUSCODE(STATUS_LOGIN_WKSTA_RESTRICTION),
691  DEFINE_STATUSCODE(STATUS_IMAGE_MP_UP_MISMATCH),
692  DEFINE_STATUSCODE(STATUS_INSUFFICIENT_LOGON_INFO),
693  DEFINE_STATUSCODE(STATUS_BAD_DLL_ENTRYPOINT),
694  DEFINE_STATUSCODE(STATUS_BAD_SERVICE_ENTRYPOINT),
695  DEFINE_STATUSCODE(STATUS_LPC_REPLY_LOST),
696  DEFINE_STATUSCODE(STATUS_IP_ADDRESS_CONFLICT1),
697  DEFINE_STATUSCODE(STATUS_IP_ADDRESS_CONFLICT2),
698  DEFINE_STATUSCODE(STATUS_REGISTRY_QUOTA_LIMIT),
699  DEFINE_STATUSCODE(STATUS_PATH_NOT_COVERED),
700  DEFINE_STATUSCODE(STATUS_NO_CALLBACK_ACTIVE),
701  DEFINE_STATUSCODE(STATUS_LICENSE_QUOTA_EXCEEDED),
702  DEFINE_STATUSCODE(STATUS_PWD_TOO_SHORT),
703  DEFINE_STATUSCODE(STATUS_PWD_TOO_RECENT),
704  DEFINE_STATUSCODE(STATUS_PWD_HISTORY_CONFLICT),
705  DEFINE_STATUSCODE(STATUS_PLUGPLAY_NO_DEVICE),
706  DEFINE_STATUSCODE(STATUS_UNSUPPORTED_COMPRESSION),
707  DEFINE_STATUSCODE(STATUS_INVALID_HW_PROFILE),
708  DEFINE_STATUSCODE(STATUS_INVALID_PLUGPLAY_DEVICE_PATH),
709  DEFINE_STATUSCODE(STATUS_DRIVER_ORDINAL_NOT_FOUND),
710  DEFINE_STATUSCODE(STATUS_DRIVER_ENTRYPOINT_NOT_FOUND),
711  DEFINE_STATUSCODE(STATUS_RESOURCE_NOT_OWNED),
712  DEFINE_STATUSCODE(STATUS_TOO_MANY_LINKS),
713  DEFINE_STATUSCODE(STATUS_QUOTA_LIST_INCONSISTENT),
714  DEFINE_STATUSCODE(STATUS_FILE_IS_OFFLINE),
715  DEFINE_STATUSCODE(STATUS_EVALUATION_EXPIRATION),
716  DEFINE_STATUSCODE(STATUS_ILLEGAL_DLL_RELOCATION),
717  DEFINE_STATUSCODE(STATUS_LICENSE_VIOLATION),
718  DEFINE_STATUSCODE(STATUS_DLL_INIT_FAILED_LOGOFF),
719  DEFINE_STATUSCODE(STATUS_DRIVER_UNABLE_TO_LOAD),
720  DEFINE_STATUSCODE(STATUS_DFS_UNAVAILABLE),
721  DEFINE_STATUSCODE(STATUS_VOLUME_DISMOUNTED),
722  DEFINE_STATUSCODE(STATUS_WX86_INTERNAL_ERROR),
723  DEFINE_STATUSCODE(STATUS_WX86_FLOAT_STACK_CHECK),
724  DEFINE_STATUSCODE(STATUS_VALIDATE_CONTINUE),
725  DEFINE_STATUSCODE(STATUS_NO_MATCH),
726  DEFINE_STATUSCODE(STATUS_NO_MORE_MATCHES),
727  DEFINE_STATUSCODE(STATUS_NOT_A_REPARSE_POINT),
728  DEFINE_STATUSCODE(STATUS_IO_REPARSE_TAG_INVALID),
729  DEFINE_STATUSCODE(STATUS_IO_REPARSE_TAG_MISMATCH),
730  DEFINE_STATUSCODE(STATUS_IO_REPARSE_DATA_INVALID),
731  DEFINE_STATUSCODE(STATUS_IO_REPARSE_TAG_NOT_HANDLED),
732  DEFINE_STATUSCODE(STATUS_REPARSE_POINT_NOT_RESOLVED),
733  DEFINE_STATUSCODE(STATUS_DIRECTORY_IS_A_REPARSE_POINT),
734  DEFINE_STATUSCODE(STATUS_RANGE_LIST_CONFLICT),
735  DEFINE_STATUSCODE(STATUS_SOURCE_ELEMENT_EMPTY),
736  DEFINE_STATUSCODE(STATUS_DESTINATION_ELEMENT_FULL),
737  DEFINE_STATUSCODE(STATUS_ILLEGAL_ELEMENT_ADDRESS),
738  DEFINE_STATUSCODE(STATUS_MAGAZINE_NOT_PRESENT),
739  DEFINE_STATUSCODE(STATUS_REINITIALIZATION_NEEDED),
740  DEFINE_STATUSCODE(STATUS_DEVICE_REQUIRES_CLEANING),
741  DEFINE_STATUSCODE(STATUS_DEVICE_DOOR_OPEN),
742  DEFINE_STATUSCODE(STATUS_ENCRYPTION_FAILED),
743  DEFINE_STATUSCODE(STATUS_DECRYPTION_FAILED),
744  DEFINE_STATUSCODE(STATUS_RANGE_NOT_FOUND),
745  DEFINE_STATUSCODE(STATUS_NO_RECOVERY_POLICY),
746  DEFINE_STATUSCODE(STATUS_NO_EFS),
747  DEFINE_STATUSCODE(STATUS_WRONG_EFS),
748  DEFINE_STATUSCODE(STATUS_NO_USER_KEYS),
749  DEFINE_STATUSCODE(STATUS_FILE_NOT_ENCRYPTED),
750  DEFINE_STATUSCODE(STATUS_NOT_EXPORT_FORMAT),
751  DEFINE_STATUSCODE(STATUS_FILE_ENCRYPTED),
752  DEFINE_STATUSCODE(STATUS_WAKE_SYSTEM),
753  DEFINE_STATUSCODE(STATUS_WMI_GUID_NOT_FOUND),
754  DEFINE_STATUSCODE(STATUS_WMI_INSTANCE_NOT_FOUND),
755  DEFINE_STATUSCODE(STATUS_WMI_ITEMID_NOT_FOUND),
756  DEFINE_STATUSCODE(STATUS_WMI_TRY_AGAIN),
757  DEFINE_STATUSCODE(STATUS_SHARED_POLICY),
758  DEFINE_STATUSCODE(STATUS_POLICY_OBJECT_NOT_FOUND),
759  DEFINE_STATUSCODE(STATUS_POLICY_ONLY_IN_DS),
760  DEFINE_STATUSCODE(STATUS_VOLUME_NOT_UPGRADED),
761  DEFINE_STATUSCODE(STATUS_REMOTE_STORAGE_NOT_ACTIVE),
762  DEFINE_STATUSCODE(STATUS_REMOTE_STORAGE_MEDIA_ERROR),
763  DEFINE_STATUSCODE(STATUS_NO_TRACKING_SERVICE),
764  DEFINE_STATUSCODE(STATUS_SERVER_SID_MISMATCH),
765  DEFINE_STATUSCODE(STATUS_DS_NO_ATTRIBUTE_OR_VALUE),
766  DEFINE_STATUSCODE(STATUS_DS_INVALID_ATTRIBUTE_SYNTAX),
767  DEFINE_STATUSCODE(STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED),
768  DEFINE_STATUSCODE(STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS),
769  DEFINE_STATUSCODE(STATUS_DS_BUSY),
770  DEFINE_STATUSCODE(STATUS_DS_UNAVAILABLE),
771  DEFINE_STATUSCODE(STATUS_DS_NO_RIDS_ALLOCATED),
772  DEFINE_STATUSCODE(STATUS_DS_NO_MORE_RIDS),
773  DEFINE_STATUSCODE(STATUS_DS_INCORRECT_ROLE_OWNER),
774  DEFINE_STATUSCODE(STATUS_DS_RIDMGR_INIT_ERROR),
775  DEFINE_STATUSCODE(STATUS_DS_OBJ_CLASS_VIOLATION),
776  DEFINE_STATUSCODE(STATUS_DS_CANT_ON_NON_LEAF),
777  DEFINE_STATUSCODE(STATUS_DS_CANT_ON_RDN),
778  DEFINE_STATUSCODE(STATUS_DS_CANT_MOD_OBJ_CLASS),
779  DEFINE_STATUSCODE(STATUS_DS_CROSS_DOM_MOVE_FAILED),
780  DEFINE_STATUSCODE(STATUS_DS_GC_NOT_AVAILABLE),
781  DEFINE_STATUSCODE(STATUS_DIRECTORY_SERVICE_REQUIRED),
782  DEFINE_STATUSCODE(STATUS_REPARSE_ATTRIBUTE_CONFLICT),
783  DEFINE_STATUSCODE(STATUS_CANT_ENABLE_DENY_ONLY),
784  DEFINE_STATUSCODE(STATUS_FLOAT_MULTIPLE_FAULTS),
785  DEFINE_STATUSCODE(STATUS_FLOAT_MULTIPLE_TRAPS),
786  DEFINE_STATUSCODE(STATUS_DEVICE_REMOVED),
787  DEFINE_STATUSCODE(STATUS_JOURNAL_DELETE_IN_PROGRESS),
788  DEFINE_STATUSCODE(STATUS_JOURNAL_NOT_ACTIVE),
789  DEFINE_STATUSCODE(STATUS_NOINTERFACE),
790  DEFINE_STATUSCODE(STATUS_DS_ADMIN_LIMIT_EXCEEDED),
791  DEFINE_STATUSCODE(STATUS_DRIVER_FAILED_SLEEP),
792  DEFINE_STATUSCODE(STATUS_MUTUAL_AUTHENTICATION_FAILED),
793  DEFINE_STATUSCODE(STATUS_CORRUPT_SYSTEM_FILE),
794  DEFINE_STATUSCODE(STATUS_DATATYPE_MISALIGNMENT_ERROR),
795  DEFINE_STATUSCODE(STATUS_WMI_READ_ONLY),
796  DEFINE_STATUSCODE(STATUS_WMI_SET_FAILURE),
797  DEFINE_STATUSCODE(STATUS_COMMITMENT_MINIMUM),
798  DEFINE_STATUSCODE(STATUS_REG_NAT_CONSUMPTION),
799  DEFINE_STATUSCODE(STATUS_TRANSPORT_FULL),
800  DEFINE_STATUSCODE(STATUS_DS_SAM_INIT_FAILURE),
801  DEFINE_STATUSCODE(STATUS_ONLY_IF_CONNECTED),
802  DEFINE_STATUSCODE(STATUS_DS_SENSITIVE_GROUP_VIOLATION),
803  DEFINE_STATUSCODE(STATUS_PNP_RESTART_ENUMERATION),
804  DEFINE_STATUSCODE(STATUS_JOURNAL_ENTRY_DELETED),
805  DEFINE_STATUSCODE(STATUS_DS_CANT_MOD_PRIMARYGROUPID),
806  DEFINE_STATUSCODE(STATUS_SYSTEM_IMAGE_BAD_SIGNATURE),
807  DEFINE_STATUSCODE(STATUS_PNP_REBOOT_REQUIRED),
808  DEFINE_STATUSCODE(STATUS_POWER_STATE_INVALID),
809  DEFINE_STATUSCODE(STATUS_DS_INVALID_GROUP_TYPE),
810  DEFINE_STATUSCODE(STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN),
811  DEFINE_STATUSCODE(STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN),
812  DEFINE_STATUSCODE(STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER),
813  DEFINE_STATUSCODE(STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER),
814  DEFINE_STATUSCODE(STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER),
815  DEFINE_STATUSCODE(STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER),
816  DEFINE_STATUSCODE(STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER),
817  DEFINE_STATUSCODE(STATUS_DS_HAVE_PRIMARY_MEMBERS),
818  DEFINE_STATUSCODE(STATUS_WMI_NOT_SUPPORTED),
819  DEFINE_STATUSCODE(STATUS_INSUFFICIENT_POWER),
820  DEFINE_STATUSCODE(STATUS_SAM_NEED_BOOTKEY_PASSWORD),
821  DEFINE_STATUSCODE(STATUS_SAM_NEED_BOOTKEY_FLOPPY),
822  DEFINE_STATUSCODE(STATUS_DS_CANT_START),
823  DEFINE_STATUSCODE(STATUS_DS_INIT_FAILURE),
824  DEFINE_STATUSCODE(STATUS_SAM_INIT_FAILURE),
825  DEFINE_STATUSCODE(STATUS_DS_GC_REQUIRED),
826  DEFINE_STATUSCODE(STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY),
827  DEFINE_STATUSCODE(STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS),
828  DEFINE_STATUSCODE(STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED),
829  DEFINE_STATUSCODE(STATUS_MULTIPLE_FAULT_VIOLATION),
830  DEFINE_STATUSCODE(STATUS_NOT_SUPPORTED_ON_SBS),
831  DEFINE_STATUSCODE(STATUS_WOW_ASSERTION),
832  DEFINE_STATUSCODE(DBG_NO_STATE_CHANGE),
833  DEFINE_STATUSCODE(DBG_APP_NOT_IDLE),
834  DEFINE_STATUSCODE(RPC_NT_INVALID_STRING_BINDING),
835  DEFINE_STATUSCODE(RPC_NT_WRONG_KIND_OF_BINDING),
836  DEFINE_STATUSCODE(RPC_NT_INVALID_BINDING),
837  DEFINE_STATUSCODE(RPC_NT_PROTSEQ_NOT_SUPPORTED),
838  DEFINE_STATUSCODE(RPC_NT_INVALID_RPC_PROTSEQ),
839  DEFINE_STATUSCODE(RPC_NT_INVALID_STRING_UUID),
840  DEFINE_STATUSCODE(RPC_NT_INVALID_ENDPOINT_FORMAT),
841  DEFINE_STATUSCODE(RPC_NT_INVALID_NET_ADDR),
842  DEFINE_STATUSCODE(RPC_NT_NO_ENDPOINT_FOUND),
843  DEFINE_STATUSCODE(RPC_NT_INVALID_TIMEOUT),
844  DEFINE_STATUSCODE(RPC_NT_OBJECT_NOT_FOUND),
845  DEFINE_STATUSCODE(RPC_NT_ALREADY_REGISTERED),
846  DEFINE_STATUSCODE(RPC_NT_TYPE_ALREADY_REGISTERED),
847  DEFINE_STATUSCODE(RPC_NT_ALREADY_LISTENING),
848  DEFINE_STATUSCODE(RPC_NT_NO_PROTSEQS_REGISTERED),
849  DEFINE_STATUSCODE(RPC_NT_NOT_LISTENING),
850  DEFINE_STATUSCODE(RPC_NT_UNKNOWN_MGR_TYPE),
851  DEFINE_STATUSCODE(RPC_NT_UNKNOWN_IF),
852  DEFINE_STATUSCODE(RPC_NT_NO_BINDINGS),
853  DEFINE_STATUSCODE(RPC_NT_NO_PROTSEQS),
854  DEFINE_STATUSCODE(RPC_NT_CANT_CREATE_ENDPOINT),
855  DEFINE_STATUSCODE(RPC_NT_OUT_OF_RESOURCES),
856  DEFINE_STATUSCODE(RPC_NT_SERVER_UNAVAILABLE),
857  DEFINE_STATUSCODE(RPC_NT_SERVER_TOO_BUSY),
858  DEFINE_STATUSCODE(RPC_NT_INVALID_NETWORK_OPTIONS),
859  DEFINE_STATUSCODE(RPC_NT_NO_CALL_ACTIVE),
860  DEFINE_STATUSCODE(RPC_NT_CALL_FAILED),
861  DEFINE_STATUSCODE(RPC_NT_CALL_FAILED_DNE),
862  DEFINE_STATUSCODE(RPC_NT_PROTOCOL_ERROR),
863  DEFINE_STATUSCODE(RPC_NT_UNSUPPORTED_TRANS_SYN),
864  DEFINE_STATUSCODE(RPC_NT_UNSUPPORTED_TYPE),
865  DEFINE_STATUSCODE(RPC_NT_INVALID_TAG),
866  DEFINE_STATUSCODE(RPC_NT_INVALID_BOUND),
867  DEFINE_STATUSCODE(RPC_NT_NO_ENTRY_NAME),
868  DEFINE_STATUSCODE(RPC_NT_INVALID_NAME_SYNTAX),
869  DEFINE_STATUSCODE(RPC_NT_UNSUPPORTED_NAME_SYNTAX),
870  DEFINE_STATUSCODE(RPC_NT_UUID_NO_ADDRESS),
871  DEFINE_STATUSCODE(RPC_NT_DUPLICATE_ENDPOINT),
872  DEFINE_STATUSCODE(RPC_NT_UNKNOWN_AUTHN_TYPE),
873  DEFINE_STATUSCODE(RPC_NT_MAX_CALLS_TOO_SMALL),
874  DEFINE_STATUSCODE(RPC_NT_STRING_TOO_LONG),
875  DEFINE_STATUSCODE(RPC_NT_PROTSEQ_NOT_FOUND),
876  DEFINE_STATUSCODE(RPC_NT_PROCNUM_OUT_OF_RANGE),
877  DEFINE_STATUSCODE(RPC_NT_BINDING_HAS_NO_AUTH),
878  DEFINE_STATUSCODE(RPC_NT_UNKNOWN_AUTHN_SERVICE),
879  DEFINE_STATUSCODE(RPC_NT_UNKNOWN_AUTHN_LEVEL),
880  DEFINE_STATUSCODE(RPC_NT_INVALID_AUTH_IDENTITY),
881  DEFINE_STATUSCODE(RPC_NT_UNKNOWN_AUTHZ_SERVICE),
882  DEFINE_STATUSCODE(EPT_NT_INVALID_ENTRY),
883  DEFINE_STATUSCODE(EPT_NT_CANT_PERFORM_OP),
884  DEFINE_STATUSCODE(EPT_NT_NOT_REGISTERED),
885  DEFINE_STATUSCODE(RPC_NT_NOTHING_TO_EXPORT),
886  DEFINE_STATUSCODE(RPC_NT_INCOMPLETE_NAME),
887  DEFINE_STATUSCODE(RPC_NT_INVALID_VERS_OPTION),
888  DEFINE_STATUSCODE(RPC_NT_NO_MORE_MEMBERS),
889  DEFINE_STATUSCODE(RPC_NT_NOT_ALL_OBJS_UNEXPORTED),
890  DEFINE_STATUSCODE(RPC_NT_INTERFACE_NOT_FOUND),
891  DEFINE_STATUSCODE(RPC_NT_ENTRY_ALREADY_EXISTS),
892  DEFINE_STATUSCODE(RPC_NT_ENTRY_NOT_FOUND),
893  DEFINE_STATUSCODE(RPC_NT_NAME_SERVICE_UNAVAILABLE),
894  DEFINE_STATUSCODE(RPC_NT_INVALID_NAF_ID),
895  DEFINE_STATUSCODE(RPC_NT_CANNOT_SUPPORT),
896  DEFINE_STATUSCODE(RPC_NT_NO_CONTEXT_AVAILABLE),
897  DEFINE_STATUSCODE(RPC_NT_INTERNAL_ERROR),
898  DEFINE_STATUSCODE(RPC_NT_ZERO_DIVIDE),
899  DEFINE_STATUSCODE(RPC_NT_ADDRESS_ERROR),
900  DEFINE_STATUSCODE(RPC_NT_FP_DIV_ZERO),
901  DEFINE_STATUSCODE(RPC_NT_FP_UNDERFLOW),
902  DEFINE_STATUSCODE(RPC_NT_FP_OVERFLOW),
903  DEFINE_STATUSCODE(RPC_NT_NO_MORE_ENTRIES),
904  DEFINE_STATUSCODE(RPC_NT_SS_CHAR_TRANS_OPEN_FAIL),
905  DEFINE_STATUSCODE(RPC_NT_SS_CHAR_TRANS_SHORT_FILE),
906  DEFINE_STATUSCODE(RPC_NT_SS_IN_NULL_CONTEXT),
907  DEFINE_STATUSCODE(RPC_NT_SS_CONTEXT_MISMATCH),
908  DEFINE_STATUSCODE(RPC_NT_SS_CONTEXT_DAMAGED),
909  DEFINE_STATUSCODE(RPC_NT_SS_HANDLES_MISMATCH),
910  DEFINE_STATUSCODE(RPC_NT_SS_CANNOT_GET_CALL_HANDLE),
911  DEFINE_STATUSCODE(RPC_NT_NULL_REF_POINTER),
912  DEFINE_STATUSCODE(RPC_NT_ENUM_VALUE_OUT_OF_RANGE),
913  DEFINE_STATUSCODE(RPC_NT_BYTE_COUNT_TOO_SMALL),
914  DEFINE_STATUSCODE(RPC_NT_BAD_STUB_DATA),
915  DEFINE_STATUSCODE(RPC_NT_CALL_IN_PROGRESS),
916  DEFINE_STATUSCODE(RPC_NT_NO_MORE_BINDINGS),
917  DEFINE_STATUSCODE(RPC_NT_GROUP_MEMBER_NOT_FOUND),
918  DEFINE_STATUSCODE(EPT_NT_CANT_CREATE),
919  DEFINE_STATUSCODE(RPC_NT_INVALID_OBJECT),
920  DEFINE_STATUSCODE(RPC_NT_NO_INTERFACES),
921  DEFINE_STATUSCODE(RPC_NT_CALL_CANCELLED),
922  DEFINE_STATUSCODE(RPC_NT_BINDING_INCOMPLETE),
923  DEFINE_STATUSCODE(RPC_NT_COMM_FAILURE),
924  DEFINE_STATUSCODE(RPC_NT_UNSUPPORTED_AUTHN_LEVEL),
925  DEFINE_STATUSCODE(RPC_NT_NO_PRINC_NAME),
926  DEFINE_STATUSCODE(RPC_NT_NOT_RPC_ERROR),
927  DEFINE_STATUSCODE(RPC_NT_UUID_LOCAL_ONLY),
928  DEFINE_STATUSCODE(RPC_NT_SEC_PKG_ERROR),
929  DEFINE_STATUSCODE(RPC_NT_NOT_CANCELLED),
930  DEFINE_STATUSCODE(RPC_NT_INVALID_ES_ACTION),
931  DEFINE_STATUSCODE(RPC_NT_WRONG_ES_VERSION),
932  DEFINE_STATUSCODE(RPC_NT_WRONG_STUB_VERSION),
933  DEFINE_STATUSCODE(RPC_NT_INVALID_PIPE_OBJECT),
934  DEFINE_STATUSCODE(RPC_NT_INVALID_PIPE_OPERATION),
935  DEFINE_STATUSCODE(RPC_NT_WRONG_PIPE_VERSION),
936  DEFINE_STATUSCODE(RPC_NT_PIPE_CLOSED),
937  DEFINE_STATUSCODE(RPC_NT_PIPE_DISCIPLINE_ERROR),
938  DEFINE_STATUSCODE(RPC_NT_PIPE_EMPTY),
939  DEFINE_STATUSCODE(RPC_NT_INVALID_ASYNC_HANDLE),
940  DEFINE_STATUSCODE(RPC_NT_INVALID_ASYNC_CALL),
941  DEFINE_STATUSCODE(RPC_NT_SEND_INCOMPLETE),
942  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_OPCODE),
943  DEFINE_STATUSCODE(STATUS_ACPI_STACK_OVERFLOW),
944  DEFINE_STATUSCODE(STATUS_ACPI_ASSERT_FAILED),
945  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_INDEX),
946  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_ARGUMENT),
947  DEFINE_STATUSCODE(STATUS_ACPI_FATAL),
948  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_SUPERNAME),
949  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_ARGTYPE),
950  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_OBJTYPE),
951  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_TARGETTYPE),
952  DEFINE_STATUSCODE(STATUS_ACPI_INCORRECT_ARGUMENT_COUNT),
953  DEFINE_STATUSCODE(STATUS_ACPI_ADDRESS_NOT_MAPPED),
954  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_EVENTTYPE),
955  DEFINE_STATUSCODE(STATUS_ACPI_HANDLER_COLLISION),
956  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_DATA),
957  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_REGION),
958  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_ACCESS_SIZE),
959  DEFINE_STATUSCODE(STATUS_ACPI_ACQUIRE_GLOBAL_LOCK),
960  DEFINE_STATUSCODE(STATUS_ACPI_ALREADY_INITIALIZED),
961  DEFINE_STATUSCODE(STATUS_ACPI_NOT_INITIALIZED),
962  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_MUTEX_LEVEL),
963  DEFINE_STATUSCODE(STATUS_ACPI_MUTEX_NOT_OWNED),
964  DEFINE_STATUSCODE(STATUS_ACPI_MUTEX_NOT_OWNER),
965  DEFINE_STATUSCODE(STATUS_ACPI_RS_ACCESS),
966  DEFINE_STATUSCODE(STATUS_ACPI_INVALID_TABLE),
967  DEFINE_STATUSCODE(STATUS_ACPI_REG_HANDLER_FAILED),
968  DEFINE_STATUSCODE(STATUS_ACPI_POWER_REQUEST_FAILED),
969  DEFINE_STATUSCODE(STATUS_CTX_WINSTATION_NAME_INVALID),
970  DEFINE_STATUSCODE(STATUS_CTX_INVALID_PD),
971  DEFINE_STATUSCODE(STATUS_CTX_PD_NOT_FOUND),
972  DEFINE_STATUSCODE(STATUS_CTX_CDM_CONNECT),
973  DEFINE_STATUSCODE(STATUS_CTX_CDM_DISCONNECT),
974  DEFINE_STATUSCODE(STATUS_CTX_CLOSE_PENDING),
975  DEFINE_STATUSCODE(STATUS_CTX_NO_OUTBUF),
976  DEFINE_STATUSCODE(STATUS_CTX_MODEM_INF_NOT_FOUND),
977  DEFINE_STATUSCODE(STATUS_CTX_INVALID_MODEMNAME),
978  DEFINE_STATUSCODE(STATUS_CTX_RESPONSE_ERROR),
979  DEFINE_STATUSCODE(STATUS_CTX_MODEM_RESPONSE_TIMEOUT),
980  DEFINE_STATUSCODE(STATUS_CTX_MODEM_RESPONSE_NO_CARRIER),
981  DEFINE_STATUSCODE(STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE),
982  DEFINE_STATUSCODE(STATUS_CTX_MODEM_RESPONSE_BUSY),
983  DEFINE_STATUSCODE(STATUS_CTX_MODEM_RESPONSE_VOICE),
984  DEFINE_STATUSCODE(STATUS_CTX_TD_ERROR),
985  DEFINE_STATUSCODE(STATUS_CTX_LICENSE_CLIENT_INVALID),
986  DEFINE_STATUSCODE(STATUS_CTX_LICENSE_NOT_AVAILABLE),
987  DEFINE_STATUSCODE(STATUS_CTX_LICENSE_EXPIRED),
988  DEFINE_STATUSCODE(STATUS_CTX_WINSTATION_NOT_FOUND),
989  DEFINE_STATUSCODE(STATUS_CTX_WINSTATION_NAME_COLLISION),
990  DEFINE_STATUSCODE(STATUS_CTX_WINSTATION_BUSY),
991  DEFINE_STATUSCODE(STATUS_CTX_BAD_VIDEO_MODE),
992  DEFINE_STATUSCODE(STATUS_CTX_GRAPHICS_INVALID),
993  DEFINE_STATUSCODE(STATUS_CTX_NOT_CONSOLE),
994  DEFINE_STATUSCODE(STATUS_CTX_CLIENT_QUERY_TIMEOUT),
995  DEFINE_STATUSCODE(STATUS_CTX_CONSOLE_DISCONNECT),
996  DEFINE_STATUSCODE(STATUS_CTX_CONSOLE_CONNECT),
997  DEFINE_STATUSCODE(STATUS_CTX_SHADOW_DENIED),
998  DEFINE_STATUSCODE(STATUS_CTX_WINSTATION_ACCESS_DENIED),
999  DEFINE_STATUSCODE(STATUS_CTX_INVALID_WD),
1000  DEFINE_STATUSCODE(STATUS_CTX_WD_NOT_FOUND),
1001  DEFINE_STATUSCODE(STATUS_CTX_SHADOW_INVALID),
1002  DEFINE_STATUSCODE(STATUS_CTX_SHADOW_DISABLED),
1003  DEFINE_STATUSCODE(STATUS_RDP_PROTOCOL_ERROR),
1004  DEFINE_STATUSCODE(STATUS_CTX_CLIENT_LICENSE_NOT_SET),
1005  DEFINE_STATUSCODE(STATUS_CTX_CLIENT_LICENSE_IN_USE),
1006  DEFINE_STATUSCODE(STATUS_PNP_BAD_MPS_TABLE),
1007  DEFINE_STATUSCODE(STATUS_PNP_TRANSLATION_FAILED),
1008  DEFINE_STATUSCODE(STATUS_PNP_IRQ_TRANSLATION_FAILED),
1009 
1010  _LASTENTRY
1011 };
1012 
1013 
1026 const UCHAR *
1027 DebugNtStatus(NTSTATUS Value)
1028 {
1029  int i = 0;
1030 
1031  while (text[i].Value != _MARKLASTENTRY)
1032  {
1033  if (text[i].Value == Value)
1034  {
1035  return text[i].Name;
1036  }
1037  ++i;
1038  }
1039 
1040  return "*UNKNOWN*";
1041 }
1042 
1043 #if DBG
1044 
1046 #define USE_SPINLOCK 1
1047 
1048 /* \brief use IRQL elevation for the debugging buffer implementation */
1049 // #define USE_IRQL_ELEVATION 1
1050 
1051 static volatile PCHAR DbgMemoryBuffer = NULL;
1052 static volatile ULONG DbgNextWriteMemoryBuffer = 0;
1053 
1054 #ifdef USE_SPINLOCK
1055 
1056 static KSPIN_LOCK DbgMemoryBufferSpinLock;
1057 static KIRQL DbgMemoryBufferSpinLockIrql;
1058 
1059 #else // #ifdef USE_SPINLOCK
1060 
1061 static LONG DbgMemoryBufferSpinLock = 0;
1062 static LONG DbgMemoryBufferUsageCounter = 0;
1063 
1064 #ifdef USE_IRQL_ELEVATION
1065  static KIRQL DbgMemoryBufferIrql;
1066 #endif
1067 
1068 #endif // #ifdef USE_SPINLOCK
1069 
1071 #define DBG_SIZE_MEMORY_BUFFER 0x20000u
1072 
1088 static VOID
1089 DbgBufferSynchronizeStart(VOID)
1090 {
1091  LONG tmp;
1092  KIRQL irql; // do not use Irql directly, but only indirectly,
1093  // as suggested by Doron Holan at
1094  // http://blogs.msdn.com/doronh/archive/2006/03/08/546934.aspx
1095 
1096 #ifdef USE_SPINLOCK
1097 
1098  KeAcquireSpinLock(&DbgMemoryBufferSpinLock, &irql);
1099  DbgMemoryBufferSpinLockIrql = irql;
1100 
1101 #else // #ifdef USE_SPINLOCK
1102 
1103  #ifdef USE_IRQL_ELEVATION
1104 
1105  if (DbgMemoryBufferIrql != PASSIVE_LEVEL)
1106  {
1107  REPORT_BUG(0x133, DbgMemoryBufferUsageCounter,
1108  DbgMemoryBufferSpinLock, DbgMemoryBufferIrql, 0,
1109  "Not IRQL == PASSIVE_LEVEL");
1110  }
1111 
1112  KeRaiseIrql(DISPATCH_LEVEL, &DbgMemoryBufferIrql);
1113 
1114  #endif // #ifdef USE_IRQL_ELEVATION
1115 
1116  while (InterlockedExchange(&DbgMemoryBufferSpinLock, 1) == 0)
1117  ;
1118 
1119  tmp = InterlockedIncrement(&DbgMemoryBufferUsageCounter);
1120  if (tmp != 1)
1121  {
1122  REPORT_BUG(0x130, tmp, DbgMemoryBufferSpinLock, 0, 0,
1123  "Usage counter bigger than 1 after incrementing!");
1124  }
1125 
1126 #endif // #ifdef USE_SPINLOCK
1127 }
1128 
1136 static VOID
1137 DbgBufferSynchronizeStop(VOID)
1138 {
1139  LONG tmp;
1140 
1141 #ifdef USE_SPINLOCK
1142 
1143  KeReleaseSpinLock(&DbgMemoryBufferSpinLock, DbgMemoryBufferSpinLockIrql);
1144 
1145 #else // #ifdef USE_SPINLOCK
1146 
1147  tmp = InterlockedDecrement(&DbgMemoryBufferUsageCounter);
1148  if (tmp != 0)
1149  {
1150  REPORT_BUG(0x131, tmp, DbgMemoryBufferSpinLock, 0, 0,
1151  "Usage counter not null after decrementing!");
1152  }
1153 
1154  tmp = InterlockedExchange(&DbgMemoryBufferSpinLock, 0);
1155  if (tmp != 1)
1156  {
1157  REPORT_BUG(0x132, DbgMemoryBufferUsageCounter, tmp, 0, 0,
1158  "(own) Spinlock not 1 before releasing.");
1159  }
1160 
1161  #ifdef USE_IRQL_ELEVATION
1162 
1163  KeLowerIrql(DbgMemoryBufferIrql);
1164  DbgMemoryBufferIrql = PASSIVE_LEVEL;
1165 
1166  #endif // #ifdef USE_IRQL_ELEVATION
1167 
1168 #endif // #ifdef USE_SPINLOCK
1169 }
1170 
1176 VOID
1177 DbgInit(VOID)
1178 {
1179 #ifdef USE_SPINLOCK
1180 
1181  KeInitializeSpinLock(&DbgMemoryBufferSpinLock);
1182 
1183 #endif // #ifdef USE_SPINLOCK
1184 }
1185 
1191 VOID
1193 {
1194  DbgBufferSynchronizeStart();
1195 
1196  DbgMemoryBuffer = ExAllocatePoolWithTag(NonPagedPool,
1198 
1199  if (DbgMemoryBuffer)
1200  {
1201  RtlZeroMemory(DbgMemoryBuffer, DBG_SIZE_MEMORY_BUFFER + 1);
1202  }
1203 
1204  DbgNextWriteMemoryBuffer = 0;
1205 
1206  DbgBufferSynchronizeStop();
1207 }
1208 
1213 VOID
1215 {
1216  DbgBufferSynchronizeStart();
1217 
1218  if (DbgMemoryBuffer)
1219  {
1220  ExFreePool(DbgMemoryBuffer);
1221  DbgMemoryBuffer = NULL;
1222  }
1223 
1224  DbgBufferSynchronizeStop();
1225 }
1226 
1240 VOID
1241 DbgOutputMemoryBuffer(const char *String)
1242 {
1243  DbgBufferSynchronizeStart();
1244 
1245  if (DbgMemoryBuffer)
1246  {
1247  PCHAR localMemoryBuffer;
1248  ULONG localNextWriteMemoryBuffer;
1249  ULONG strLength;
1250 
1251  localMemoryBuffer = DbgMemoryBuffer;
1252  localNextWriteMemoryBuffer = DbgNextWriteMemoryBuffer;
1253 
1254  if (DbgNextWriteMemoryBuffer > DBG_SIZE_MEMORY_BUFFER)
1255  {
1256  REPORT_BUG(0x123, DbgNextWriteMemoryBuffer, DBG_SIZE_MEMORY_BUFFER, -1, 0,
1257  "DbgNextWriteMemoryBuffer already out of buffer!");
1258  }
1259 
1260  strLength = strlen(String) + 1;
1261 
1262  if (strLength >= 200)
1263  {
1264  REPORT_BUG(0x123, DbgNextWriteMemoryBuffer, DBG_SIZE_MEMORY_BUFFER,
1265  strLength, 0, "string too long");
1266  }
1267 
1268  // Sanity check
1269 
1270  if ((localMemoryBuffer != DbgMemoryBuffer)
1271  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1272  {
1273  REPORT_BUG(0x140, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1274  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1275  "local copies do not match the global ones (1)");
1276  }
1277 
1278  // Does the string fit into the buffer?
1279 
1280  if (DbgNextWriteMemoryBuffer + strLength > DBG_SIZE_MEMORY_BUFFER)
1281  {
1282  if (DBG_SIZE_MEMORY_BUFFER - DbgNextWriteMemoryBuffer >= strLength)
1283  {
1284  REPORT_BUG(0x124, DbgNextWriteMemoryBuffer, DBG_SIZE_MEMORY_BUFFER,
1285  strLength, 0, "");
1286  }
1287 
1288  // Sanity check
1289 
1290  if ((localMemoryBuffer != DbgMemoryBuffer)
1291  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1292  {
1293  REPORT_BUG(0x141, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1294  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1295  "local copies do not match the global ones (2)");
1296  }
1297 
1298  RtlZeroMemory(&DbgMemoryBuffer[DbgNextWriteMemoryBuffer],
1299  DBG_SIZE_MEMORY_BUFFER - DbgNextWriteMemoryBuffer);
1300 
1301  // Sanity check
1302 
1303  if ((localMemoryBuffer != DbgMemoryBuffer)
1304  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1305  {
1306  REPORT_BUG(0x142, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1307  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1308  "local copies do not match the global ones (3)");
1309  }
1310 
1311  DbgNextWriteMemoryBuffer = 0;
1312  localNextWriteMemoryBuffer = 0;
1313  }
1314 
1315  // Sanity check
1316 
1317  if ((localMemoryBuffer != DbgMemoryBuffer)
1318  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1319  {
1320  REPORT_BUG(0x143, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1321  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1322  "local copies do not match the global ones (4)");
1323  }
1324 
1325  if (DbgNextWriteMemoryBuffer > DBG_SIZE_MEMORY_BUFFER)
1326  {
1327  REPORT_BUG(0x125, DbgNextWriteMemoryBuffer, DBG_SIZE_MEMORY_BUFFER,
1328  strLength, 0,
1329  "String does not fit in the buffer (but should have fitted!)");
1330  }
1331 
1332  // Sanity check
1333 
1334  if ((localMemoryBuffer != DbgMemoryBuffer)
1335  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1336  {
1337  REPORT_BUG(0x144, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1338  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1339  "local copies do not match the global ones (5)");
1340  }
1341 
1342  if (DbgNextWriteMemoryBuffer > 0)
1343  {
1344  DbgMemoryBuffer[DbgNextWriteMemoryBuffer-1] = 13;
1345  }
1346 
1347  // Sanity check
1348 
1349  if ((localMemoryBuffer != DbgMemoryBuffer)
1350  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1351  {
1352  REPORT_BUG(0x145, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1353  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1354  "local copies do not match the global ones (6)");
1355  }
1356 
1357  RtlCopyMemory(&DbgMemoryBuffer[DbgNextWriteMemoryBuffer], String, strLength);
1358  DbgNextWriteMemoryBuffer += strLength;
1359  localNextWriteMemoryBuffer += strLength;
1360 
1361  // Sanity check
1362 
1363  if ((localMemoryBuffer != DbgMemoryBuffer)
1364  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1365  {
1366  REPORT_BUG(0x146, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1367  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1368  "local copies do not match the global ones (7)");
1369  }
1370 
1371  if (DbgNextWriteMemoryBuffer > DBG_SIZE_MEMORY_BUFFER)
1372  {
1373  REPORT_BUG(0x126, DbgNextWriteMemoryBuffer, DBG_SIZE_MEMORY_BUFFER,
1374  strLength, 0,
1375  "DbgNextWriteMemoryBuffer out of buffer after write!");
1376  }
1377 
1378  // Sanity check
1379 
1380  if ((localMemoryBuffer != DbgMemoryBuffer)
1381  || (localNextWriteMemoryBuffer != DbgNextWriteMemoryBuffer))
1382  {
1383  REPORT_BUG(0x147, (ULONG_PTR) localMemoryBuffer, (ULONG_PTR) DbgMemoryBuffer,
1384  localNextWriteMemoryBuffer, DbgNextWriteMemoryBuffer,
1385  "local copies do not match the global ones (8)");
1386  }
1387  }
1388 
1389  DbgBufferSynchronizeStop();
1390 }
1391 
1415 NTSTATUS
1416 cbm_dbg_readbuffer(IN PDEVICE_EXTENSION Pdx, OUT PCHAR ReturnBuffer,
1417  IN OUT PULONG ReturnLength)
1418 {
1419  FUNC_ENTER();
1420 
1421  DbgBufferSynchronizeStart();
1422 
1423  if (DbgMemoryBuffer)
1424  {
1425  PCHAR writePosition;
1426  ULONG stillToWrite;
1427  ULONG writtenBytes;
1428 
1429  writePosition = ReturnBuffer;
1430  stillToWrite = *ReturnLength;
1431  writtenBytes = 0;
1432 
1433 
1434  if (stillToWrite > DbgNextWriteMemoryBuffer)
1435  {
1436  ULONG lengthBeforeWrapAround;
1437 
1439 
1440  // First of all, find out if there are any "old" entries
1441  // from before the wrap-around
1442 
1443  lengthBeforeWrapAround =
1444  strlen(&DbgMemoryBuffer[DbgNextWriteMemoryBuffer+1]) + 1;
1445 
1446  if (lengthBeforeWrapAround > 1)
1447  {
1448  ULONG lengthToCopy;
1449 
1450  lengthToCopy = stillToWrite - DbgNextWriteMemoryBuffer + 1;
1451 
1452  lengthToCopy = min(lengthToCopy, lengthBeforeWrapAround);
1453 
1454  RtlCopyMemory(writePosition,
1455  &DbgMemoryBuffer[DbgNextWriteMemoryBuffer
1456  + lengthBeforeWrapAround
1457  - lengthToCopy],
1458  lengthToCopy);
1459 
1460  writePosition += lengthToCopy;
1461  writtenBytes += lengthToCopy;
1462  stillToWrite -= lengthToCopy;
1463 
1464  if (stillToWrite > 0)
1465  {
1466  *writePosition++ = 13;
1467  ++writtenBytes;
1468  --stillToWrite;
1469  }
1470  }
1471  }
1472 
1473  stillToWrite = min(stillToWrite, DbgNextWriteMemoryBuffer);
1474 
1475  RtlCopyMemory(writePosition,
1476  &DbgMemoryBuffer[DbgNextWriteMemoryBuffer - stillToWrite],
1477  stillToWrite);
1478 
1479  writtenBytes += stillToWrite;
1480 
1481 
1482  *ReturnLength = writtenBytes;
1483  }
1484 
1485  DbgBufferSynchronizeStop();
1486 
1487  FUNC_LEAVE_NTSTATUS_CONST(STATUS_SUCCESS);
1488 }
1489 
1490 #endif
#define DBG_SIZE_MEMORY_BUFFER
the size of the memory buffer used for the debugging buffer
#define _MARKLASTENTRY
const NTSTATUS_DEBUGCODE text[]
#define MTAG_DBGBUFFER
Definition: memtags.h:41
VOID DbgAllocateMemoryBuffer(VOID)
Get storage area for debugging output.
struct NTSTATUS_DEBUGCODE NTSTATUS_DEBUGCODE
NTSTATUS cbm_dbg_readbuffer(IN PDEVICE_EXTENSION Pdx, OUT PCHAR ReturnBuffer, IN OUT PULONG ReturnLength)
Give the debug buffer contents to the installer.
#define REPORT_BUG(_no, _a, _b, _c, _d, _str)
@@@
VOID DbgOutputMemoryBuffer(const char *String)
Output into the debugging buffer.
#define _LASTENTRY
#define FUNC_ENTER()
Definition: debug.h:347
const UCHAR * DebugNtStatus(NTSTATUS Value)
Return the description of an NTSTATUS code.
Definitions for the opencbm driver.
#define DEFINE_STATUSCODE(_x)
#define min(_x, _y)
VOID DbgInit(VOID)
Initialise debugging system.
VOID DbgFreeMemoryBuffer(VOID)
Free storage area for debugging output.