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.

85 lines
1.4 KiB

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