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.

80 lines
1.5 KiB

  1. /*
  2. Copyright (c) 1992,1993 Microsoft Corporation
  3. Module Name:
  4. psdiblib.c
  5. Abstract:
  6. This file contains some general functionality that is used by all the
  7. PSTODIB components. Currently only a mechanism to log errors to the
  8. event log exists.
  9. Author:
  10. James Bratsanos <v-jimbr@microsoft.com or mcrafts!jamesb>
  11. Revision History:
  12. 6 Dec 1992 Initial Version
  13. Notes: Tab stop: 4
  14. --*/
  15. #include <windows.h>
  16. #include <stdio.h>
  17. #include "psdiblib.h"
  18. #include "debug.h"
  19. VOID
  20. PsLogEvent(
  21. IN DWORD dwErrorCode,
  22. IN WORD cStrings,
  23. IN LPTSTR alptStrStrings[],
  24. IN DWORD dwFlags )
  25. {
  26. HANDLE hLog;
  27. PSID pSidUser = (PSID) NULL;
  28. WORD wEventType;
  29. hLog = RegisterEventSource( NULL, MACPRINT_EVENT_SOURCE );
  30. if ( hLog != (HANDLE) NULL) {
  31. if ( dwFlags & PSLOG_ERROR) {
  32. wEventType = EVENTLOG_ERROR_TYPE;
  33. } else {
  34. wEventType = EVENTLOG_WARNING_TYPE;
  35. }
  36. ReportEvent( hLog,
  37. wEventType,
  38. EVENT_CATEGORY_PSTODIB, // event category
  39. dwErrorCode,
  40. pSidUser,
  41. cStrings,
  42. 0,
  43. alptStrStrings,
  44. (PVOID)NULL
  45. );
  46. DeregisterEventSource( hLog );
  47. } else{
  48. //DJC
  49. DBGOUT(("\nRegister Event is failing... returns %d",GetLastError()));
  50. }
  51. return;
  52. }
  53.