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
2.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: notifyev.cxx
  7. //
  8. // Contents: CClientNotifyEvent class
  9. //
  10. // History: Jan-06-97 mohamedn Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #pragma hdrstop
  15. #include <eventlog.hxx>
  16. #include <notifyev.hxx>
  17. #include <cievtmsg.h> // CI_SERVICE_CATEGORY
  18. //+------------------------------------------------------
  19. //
  20. // Member: CClientNotifyEvent::CClientNotifyEvent
  21. //
  22. //
  23. // Synopsis: Consturctor encapsulates creating a CEventLogItem object,
  24. // and calls CEventLog::ReportEvent on that event item.
  25. //
  26. // Arguments: [fType ] - Type of event
  27. // [eventId] - Message file event identifier
  28. // [nParams] - Number of substitution arguments being passed
  29. // [aParams] - pointer to PROPVARIANT array of substitution args.
  30. // [cbData ] - number of bytes in supplemental raw data.
  31. // [data ] - pointer to block of supplemental data.
  32. //
  33. // History: Jan-06-97 mohamedn Created
  34. //
  35. //----------------------------------------------------------------------------
  36. CClientNotifyEvent::CClientNotifyEvent( WORD fType,
  37. DWORD eventId,
  38. ULONG nParams,
  39. const PROPVARIANT *aParams,
  40. ULONG cbData,
  41. void* data )
  42. {
  43. CEventLog eventLog(NULL,wcsCiEventSource);
  44. CEventItem item(fType, CI_SERVICE_CATEGORY, eventId, (WORD) nParams, cbData, data);
  45. for (WORD i = 0; i < nParams ; i++)
  46. {
  47. switch (aParams[i].vt)
  48. {
  49. case VT_LPSTR:
  50. Win4Assert( FALSE );
  51. break;
  52. case VT_LPWSTR:
  53. item.AddArg(aParams[i].pwszVal);
  54. break;
  55. case VT_UI4:
  56. item.AddArg(aParams[i].ulVal);
  57. break;
  58. default:
  59. Win4Assert( !"Default case hit in CClientNotifyEvent" );
  60. THROW (CException(E_INVALIDARG));
  61. } // switch
  62. } // for
  63. eventLog.ReportEvent(item);
  64. }