Source code of Windows XP (NT5)
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.

95 lines
2.0 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. WBEMNTFY.H
  5. Abstract:
  6. History:
  7. --*/
  8. #ifndef _WBEMNOTFY_H_
  9. #define _WBEMNOTFY_H_
  10. #include <wbemidl.h>
  11. //#include <arena.h>
  12. #include <WT_flexarry.h>
  13. DWORD WINAPI WbemWaitForSingleObject(
  14. HANDLE hHandle, // handle of object to wait for
  15. DWORD dwMilliseconds // time-out interval in milliseconds
  16. );
  17. class CStatusMonitor
  18. {
  19. private:
  20. BOOL m_bOpen;
  21. HWND m_hDlg;
  22. HWND m_hList;
  23. BOOL m_bVisible;
  24. public:
  25. CStatusMonitor();
  26. ~CStatusMonitor();
  27. void Hide();
  28. void Add(long lFlags, HRESULT hRes, BSTR bstr);
  29. static BOOL CALLBACK DlgProc(
  30. HWND hDlg,
  31. UINT uMsg,
  32. WPARAM wParam,
  33. LPARAM lParam
  34. );
  35. };
  36. class CTestNotify : public IWbemObjectSinkEx
  37. {
  38. CFlexArray m_aObjects;
  39. LONG m_lRefCount;
  40. CRITICAL_SECTION m_cs;
  41. HANDLE m_hEvent;
  42. HRESULT m_hres;
  43. IWbemClassObject* m_pErrorObj;
  44. IID m_pInterfaceID;
  45. IUnknown *m_pInterface;
  46. public:
  47. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj);
  48. STDMETHOD_(ULONG, AddRef)(THIS);
  49. STDMETHOD_(ULONG, Release)(THIS);
  50. STDMETHOD(Indicate)(long lObjectCount, IWbemClassObject** pObjArray);
  51. STDMETHOD(SetStatus)(long lFlags, HRESULT hResult, BSTR strParam,
  52. IWbemClassObject* pObjPAram);
  53. STDMETHOD(Set)(long lFlags, REFIID riid, void *pComObject);
  54. // Private to implementation.
  55. // ==========================
  56. CTestNotify(LONG lStartingRefCount = 1);
  57. ~CTestNotify();
  58. UINT WaitForSignal(DWORD dwMSec) { return ::WbemWaitForSingleObject(m_hEvent, dwMSec); }
  59. CFlexArray* GetObjectArray() { return &m_aObjects; }
  60. IUnknown *GetInterface() { return m_pInterface; }
  61. HRESULT GetStatusCode(IWbemClassObject** ppErrorObj = NULL)
  62. {
  63. if(ppErrorObj)
  64. {
  65. *ppErrorObj = m_pErrorObj;
  66. if(m_pErrorObj) m_pErrorObj->AddRef();
  67. }
  68. return m_hres;
  69. }
  70. void Lock() { EnterCriticalSection(&m_cs); }
  71. void Unlock() { LeaveCriticalSection(&m_cs); }
  72. };
  73. #endif