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.

90 lines
1.6 KiB

  1. //***************************************************************************
  2. //
  3. // File:
  4. //
  5. // Module: MS SNMP Provider
  6. //
  7. // Purpose:
  8. //
  9. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. #include "precomp.h"
  13. #include <provexpt.h>
  14. #include <snmptempl.h>
  15. #include <snmpmt.h>
  16. #include <snmpcont.h>
  17. #include "snmpevt.h"
  18. #include "snmpthrd.h"
  19. SnmpEventObject :: SnmpEventObject ( const wchar_t *globalEventName ) : m_event ( NULL )
  20. {
  21. m_event = CreateEvent (
  22. NULL ,
  23. FALSE ,
  24. FALSE ,
  25. globalEventName
  26. ) ;
  27. if ( m_event == NULL )
  28. {
  29. if ( GetLastError () == ERROR_ALREADY_EXISTS )
  30. {
  31. m_event = OpenEvent (
  32. EVENT_ALL_ACCESS ,
  33. FALSE ,
  34. globalEventName
  35. ) ;
  36. }
  37. }
  38. if( NULL == m_event ) throw Heap_Exception(Heap_Exception::E_ALLOCATION_ERROR);
  39. }
  40. SnmpEventObject :: ~SnmpEventObject ()
  41. {
  42. if ( m_event != NULL )
  43. {
  44. CloseHandle ( m_event ) ;
  45. }
  46. }
  47. HANDLE SnmpEventObject :: GetHandle ()
  48. {
  49. return m_event ;
  50. }
  51. void SnmpEventObject :: Set ()
  52. {
  53. SetEvent ( m_event ) ;
  54. }
  55. void SnmpEventObject :: Clear ()
  56. {
  57. ResetEvent ( m_event ) ;
  58. }
  59. void SnmpEventObject :: Process ()
  60. {
  61. }
  62. BOOL SnmpEventObject :: Wait ()
  63. {
  64. return WaitForSingleObject ( GetHandle () , INFINITE ) == WAIT_OBJECT_0 ;
  65. }
  66. void SnmpEventObject :: Complete ()
  67. {
  68. }