Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. lpclog.c
  5. Abstract:
  6. Local Inter-Process Communication (LPC) error logging
  7. _LPC_LOG_ERRORS needs to be defined in lpcp.h in order
  8. to allow LPC error logging.
  9. Author:
  10. Adrian Marinescu (adrmarin) 28 Feb 2002
  11. Revision History:
  12. --*/
  13. #include "lpcp.h"
  14. #ifdef _LPC_LOG_ERRORS
  15. typedef struct _LPCP_LOG_ENTRY {
  16. NTSTATUS Status;
  17. CLIENT_ID CrtProcess;
  18. PORT_MESSAGE Message;
  19. } LPCP_LOG_ENTRY, *PLPCP_LOG_ENTRY;
  20. #define LPCP_LOG_QUEUE_SIZE 32
  21. PLPCP_LOG_ENTRY LpcpLogBuffer = NULL;
  22. LONG LpcpLogIndex = 0;
  23. NTSTATUS LpcpLogErrorFilter = STATUS_NO_MEMORY;
  24. VOID
  25. LpcpInitilizeLogging()
  26. {
  27. LpcpLogBuffer = ExAllocatePoolWithTag( PagedPool,
  28. LPCP_LOG_QUEUE_SIZE * sizeof(LPCP_LOG_ENTRY),
  29. 'LcpL'
  30. );
  31. }
  32. VOID
  33. LpcpLogEntry (
  34. NTSTATUS Status,
  35. CLIENT_ID ClientId,
  36. PPORT_MESSAGE PortMessage
  37. )
  38. {
  39. if (LpcpLogBuffer != NULL) {
  40. LONG Index = InterlockedIncrement(&LpcpLogIndex) % LPCP_LOG_QUEUE_SIZE;
  41. LpcpLogBuffer[Index].CrtProcess = ClientId;
  42. LpcpLogBuffer[Index].Status = Status;
  43. LpcpLogBuffer[Index].Message = *PortMessage;
  44. }
  45. }
  46. #endif // _LPC_LOG_ERRORS