- Add some missing IO_ERROR definitions to the DDK and add some tags

- Fix IoSetThreadHardErrorMode... it was reading the TEB instead of the PETHREAD.
- Optimize Error Logging: Use a static work item instead of allocating one each time, and don't use a spinlock for the buffer count, when we can use interlocked functions instead.
- Log Entries can have Device AND/OR Driver Objects, not just a single one. They must also be referenced/dereferenced on allocation/free.
- Rewrite IopLogWorker to properly deal with Device/Driver objects and querying their names, as well as with additional strings that the caller might be sending.

svn path=/trunk/; revision=22734
This commit is contained in:
Alex Ionescu 2006-07-01 03:36:15 +00:00
parent 3f9f57f91e
commit c31f4054ec
4 changed files with 628 additions and 470 deletions

View file

@ -1849,6 +1849,14 @@ typedef struct _IO_ERROR_LOG_MESSAGE {
#define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \ #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
sizeof(IO_ERROR_LOG_PACKET) + \ sizeof(IO_ERROR_LOG_PACKET) + \
(sizeof(WCHAR) * 40)) (sizeof(WCHAR) * 40))
#define ERROR_LOG_MESSAGE_LIMIT_SIZE \
(ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
#define IO_ERROR_LOG_MESSAGE_LENGTH \
((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
ERROR_LOG_MESSAGE_LIMIT_SIZE : \
PORT_MAXIMUM_MESSAGE_LENGTH)
#define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
typedef struct _CONTROLLER_OBJECT { typedef struct _CONTROLLER_OBJECT {
CSHORT Type; CSHORT Type;

View file

@ -218,6 +218,29 @@ typedef struct _IO_INTERRUPT
KSPIN_LOCK SpinLock; KSPIN_LOCK SpinLock;
} IO_INTERRUPT, *PIO_INTERRUPT; } IO_INTERRUPT, *PIO_INTERRUPT;
//
// I/O Error Log Packet Header
//
typedef struct _ERROR_LOG_ENTRY
{
CSHORT Type;
CSHORT Size;
LIST_ENTRY ListEntry;
PDEVICE_OBJECT DeviceObject;
PDRIVER_OBJECT DriverObject;
LARGE_INTEGER TimeStamp;
} ERROR_LOG_ENTRY, *PERROR_LOG_ENTRY;
//
// Event Log LPC Message
//
typedef struct _ELF_API_MSG
{
PORT_MESSAGE h;
ULONG Unknown[2];
IO_ERROR_LOG_MESSAGE IoErrorMessage;
} ELF_API_MSG, *PELF_API_MSG;
// //
// To simplify matters, the kernel is made to support both the checked and free // To simplify matters, the kernel is made to support both the checked and free
// version of the I/O Remove Lock in the same binary. This structure includes // version of the I/O Remove Lock in the same binary. This structure includes
@ -604,12 +627,18 @@ IoInitCancelHandling(
// //
// Error Logging Routines // Error Logging Routines
// //
VOID
NTSTATUS NTAPI
IopInitErrorLog( IopInitErrorLog(
VOID VOID
); );
VOID
NTAPI
IopLogWorker(
IN PVOID Parameter
);
// //
// Raw File System MiniDriver // Raw File System MiniDriver
// //

View file

@ -49,6 +49,9 @@
#define IO_SMALLIRP_CPU TAG('I', 'r', 'p', 'S') #define IO_SMALLIRP_CPU TAG('I', 'r', 'p', 'S')
#define IOC_TAG1 TAG('I', 'p', 'c', ' ') #define IOC_TAG1 TAG('I', 'p', 'c', ' ')
#define IOC_CPU TAG('I', 'p', 'c', 'P') #define IOC_CPU TAG('I', 'p', 'c', 'P')
#define TAG_APC TAG('K', 'A', 'P', 'C')
#define TAG_IO TAG('I', 'o', ' ', ' ')
#define TAG_ERROR_LOG TAG('I', 'o', 'E', 'r')
/* formerly located in io/work.c */ /* formerly located in io/work.c */
#define TAG_IOWI TAG('I', 'O', 'W', 'I') #define TAG_IOWI TAG('I', 'O', 'W', 'I')

File diff suppressed because it is too large Load diff