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.

46 lines
1.2 KiB

  1. #include "namellst.h"
  2. #include "cmmn.h"
  3. #include <dbt.h>
  4. class CHandleNotif : public CNamedElem
  5. {
  6. public:
  7. // CNamedElem
  8. HRESULT Init(LPCWSTR pszElemName);
  9. // CHandleNotif
  10. HRESULT HNHandleEvent(DEV_BROADCAST_HANDLE* pdbh, DWORD dwEventType,
  11. BOOL* pfSurpriseRemoval);
  12. HRESULT InitNotif(CHandleNotifTarget* phnt);
  13. HDEVNOTIFY GetDeviceNotifyHandle();
  14. CHandleNotifTarget* GetHandleNotifTarget();
  15. static HRESULT HandleBroadcastHandleEvent(DEV_BROADCAST_HANDLE* pdbh,
  16. DWORD dwEventType);
  17. static HRESULT _HandleDeviceArrivalRemoval(DEV_BROADCAST_HANDLE* pdbh,
  18. DWORD dwEventType, CNamedElem* pelem);
  19. static HRESULT _HandleDeviceLockUnlock(DEV_BROADCAST_HANDLE* pdbh,
  20. DWORD dwEventType, CNamedElem* pelem);
  21. public:
  22. static HRESULT Create(CNamedElem** ppelem);
  23. public:
  24. CHandleNotif();
  25. ~CHandleNotif();
  26. private:
  27. HRESULT _Register();
  28. HRESULT _Unregister();
  29. HRESULT _CloseDevice();
  30. private:
  31. BOOL _fSurpriseRemoval;
  32. CHandleNotifTarget* _phnt;
  33. HDEVNOTIFY _hdevnotify;
  34. DWORD _cLockAttempts;
  35. };