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.

114 lines
3.6 KiB

  1. #ifndef _HWCMMN_H
  2. #define _HWCMMN_H
  3. #define CT_AUTORUNINF 0x00000001
  4. #define CT_CDAUDIO 0x00000002
  5. #define CT_DVDMOVIE 0x00000004
  6. #define CT_UNKNOWNCONTENT 0x00000008
  7. #define CT_BLANKCDR 0x00000010
  8. #define CT_BLANKCDRW 0x00000020
  9. #define CT_BLANKDVDR 0x00000040
  10. #define CT_BLANKDVDRW 0x00000080
  11. #define CT_AUTOPLAYMUSIC 0x00000100
  12. #define CT_AUTOPLAYPIX 0x00000200
  13. #define CT_AUTOPLAYMOVIE 0x00000400
  14. // Will not be returned by CMountPoint::GetContentType
  15. #define CT_AUTOPLAYMIXEDCONTENT 0x00000800
  16. #define CT_ANYCONTENT 0x00000FFF
  17. #define CT_ANYAUTOPLAYCONTENT ( CT_AUTOPLAYMUSIC | \
  18. CT_AUTOPLAYPIX | \
  19. CT_AUTOPLAYMOVIE)
  20. #define CT_BLANKCDWRITABLE ( CT_BLANKCDR | \
  21. CT_BLANKCDRW )
  22. #define CT_BLANKDVDWRITABLE ( CT_BLANKDVDR | \
  23. CT_BLANKDVDRW )
  24. BOOL IsShellServiceRunning();
  25. HRESULT _GetAutoplayHandler(LPCWSTR pszDeviceID, LPCWSTR pszEventType,
  26. LPCWSTR pszContentTypeHandler, IAutoplayHandler** ppiah);
  27. HRESULT _GetAutoplayHandlerNoContent(LPCWSTR pszDeviceID, LPCWSTR pszEventType,
  28. IAutoplayHandler** ppiah);
  29. HRESULT _GetHWDevice(LPCWSTR pszDeviceID, IHWDevice** ppihwdevice);
  30. STDAPI GetDeviceProperties(LPCWSTR pszDeviceID, IHWDeviceCustomProperties** ppihwdevcp);
  31. HICON _GetIconFromIconLocation(LPCWSTR pszIconLocation, BOOL fBigIcon);
  32. HRESULT _GetDeviceEventFriendlyName(LPCWSTR pszDeviceID, LPWSTR* ppsz);
  33. HRESULT _GetHardwareDevices(IHardwareDevices** ppihwdevices);
  34. HRESULT _GetContentTypeInfo(DWORD dwContentType, LPWSTR pszContentTypeFriendlyName,
  35. DWORD cchContentTypeFriendlyName, LPWSTR pszContentTypeIconLocation,
  36. DWORD cchContentTypeIconLocation);
  37. HRESULT _GetContentTypeHandler(DWORD dwContentType, LPWSTR pszContentTypeHandler,
  38. DWORD cchContentTypeHandler);
  39. HRESULT _GetHandlerInvokeProgIDAndVerb(LPCWSTR pszHandler, LPWSTR pszInvokeProgID,
  40. DWORD cchInvokeProgID, LPWSTR pszInvokeVerb, DWORD cchInvokeVerb);
  41. struct AUTOPLAYPROMPT
  42. {
  43. WCHAR szDriveOrDeviceID[MAX_PATH];
  44. BOOL fDlgWillBeShown;
  45. HWND hwndDlg;
  46. class CCrossThreadFlag* pDeviceGoneFlag;
  47. };
  48. HRESULT DoDeviceNotification(LPCTSTR pszDevice, LPCTSTR pszEventType, CCrossThreadFlag* pDeviceGoneFlag);
  49. BOOL GetGoneFlagForDevice(LPCWSTR pszAltDeviceID, CCrossThreadFlag** ppDeviceGoneFlag);
  50. void AttachGoneFlagForDevice(LPCWSTR pszAltDeviceID, CCrossThreadFlag* pDeviceGoneFlag);
  51. BOOL IsMixedContent(DWORD dwContentType);
  52. class CRefCounted
  53. {
  54. public:
  55. CRefCounted() : _cRCRef(1) {}
  56. virtual ~CRefCounted() {}
  57. ULONG AddRef() { return ::InterlockedIncrement((LONG*)&_cRCRef); }
  58. ULONG Release()
  59. {
  60. ULONG cRef = ::InterlockedDecrement((LONG*)&_cRCRef);
  61. if (!cRef)
  62. {
  63. delete this;
  64. }
  65. return cRef;
  66. }
  67. private:
  68. ULONG _cRCRef; // RC: to avoid name colision
  69. };
  70. // The event is created in the NON-signaled state
  71. // Since it's cross-thread it should always be created on the heap
  72. class CCrossThreadFlag : public CRefCounted
  73. {
  74. public:
  75. BOOL Init();
  76. BOOL Signal();
  77. BOOL IsSignaled();
  78. private:
  79. ~CCrossThreadFlag();
  80. HANDLE _hEvent;
  81. #ifdef DEBUG
  82. BOOL _fInited;
  83. #endif
  84. };
  85. #endif //_HWCMMN_H