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.

109 lines
2.4 KiB

  1. /********************************************************************/
  2. /** Copyright(c) 1989 Microsoft Corporation. **/
  3. /********************************************************************/
  4. //***
  5. //
  6. // Filename: errorlog.c
  7. //
  8. // Description:
  9. //
  10. // History:
  11. // May 11,1992. NarenG Created original version.
  12. // Feb 2,1993 SueA Added routine to handle server's event
  13. // logging (from FSCTL by service)
  14. //
  15. #include "afpsvcp.h"
  16. //**
  17. //
  18. // Call: AfpLogEvent
  19. //
  20. // Returns: none
  21. //
  22. // Description:
  23. //
  24. VOID
  25. AfpLogEvent(
  26. IN DWORD dwMessageId,
  27. IN WORD cNumberOfSubStrings,
  28. IN LPWSTR * plpwsSubStrings,
  29. IN DWORD dwErrorCode,
  30. IN WORD wSeverity
  31. )
  32. {
  33. HANDLE hLog;
  34. PSID pSidUser = NULL;
  35. hLog = RegisterEventSource( NULL, AFP_SERVICE_NAME );
  36. AFP_ASSERT( hLog != NULL );
  37. // Log the error code specified
  38. //
  39. ReportEvent( hLog,
  40. wSeverity,
  41. 0, // event category
  42. dwMessageId,
  43. pSidUser,
  44. cNumberOfSubStrings,
  45. sizeof(DWORD),
  46. plpwsSubStrings,
  47. (PVOID)&dwErrorCode
  48. );
  49. DeregisterEventSource( hLog );
  50. AFP_PRINT( ("AFPSVC_Errorlog: dwMessageId = %d\n", dwMessageId ));
  51. return;
  52. }
  53. //**
  54. //
  55. // Call: AfpLogServerEvent
  56. //
  57. // Returns: none
  58. //
  59. // Description: Gets an error or audit log packet from the Afp Server FSD
  60. // and does the event logging on its behalf. (See AfpServerHelper thread
  61. // routine in srvrhlpr.c)
  62. //
  63. VOID
  64. AfpLogServerEvent(
  65. IN PAFP_FSD_CMD_PKT pAfpFsdCmd
  66. )
  67. {
  68. PAFP_EVENTLOG_DESC pEventData;
  69. HANDLE hLog;
  70. PSID pSidUser = NULL;
  71. int i;
  72. hLog = RegisterEventSource( NULL, AFP_SERVICE_NAME );
  73. AFP_ASSERT( hLog != NULL );
  74. pEventData = &pAfpFsdCmd->Data.Eventlog;
  75. OFFSET_TO_POINTER(pEventData->ppStrings, pAfpFsdCmd);
  76. for (i = 0; i < pEventData->StringCount; i++)
  77. {
  78. OFFSET_TO_POINTER(pEventData->ppStrings[i], pAfpFsdCmd);
  79. }
  80. OFFSET_TO_POINTER(pEventData->pDumpData, pAfpFsdCmd);
  81. ReportEvent( hLog,
  82. pEventData->EventType,
  83. 0, // event category
  84. pEventData->MsgID,
  85. pSidUser,
  86. pEventData->StringCount,
  87. pEventData->DumpDataLen,
  88. pEventData->ppStrings,
  89. pEventData->pDumpData
  90. );
  91. DeregisterEventSource( hLog );
  92. }