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.

102 lines
4.2 KiB

  1. //
  2. // Microsoft Windows Media Technologies
  3. // Copyright (C) Microsoft Corporation, 1999 - 2001. All rights reserved.
  4. //
  5. // MSHDSP.DLL is a sample WMDM Service Provider(SP) that enumerates fixed drives.
  6. // This sample shows you how to implement an SP according to the WMDM documentation.
  7. // This sample uses fixed drives on your PC to emulate portable media, and
  8. // shows the relationship between different interfaces and objects. Each hard disk
  9. // volume is enumerated as a device and directories and files are enumerated as
  10. // Storage objects under respective devices. You can copy non-SDMI compliant content
  11. // to any device that this SP enumerates. To copy an SDMI compliant content to a
  12. // device, the device must be able to report a hardware embedded serial number.
  13. // Hard disks do not have such serial numbers.
  14. //
  15. // To build this SP, you are recommended to use the MSHDSP.DSP file under Microsoft
  16. // Visual C++ 6.0 and run REGSVR32.EXE to register the resulting MSHDSP.DLL. You can
  17. // then build the sample application from the WMDMAPP directory to see how it gets
  18. // loaded by the application. However, you need to obtain a certificate from
  19. // Microsoft to actually run this SP. This certificate would be in the KEY.C file
  20. // under the INCLUDE directory for one level up.
  21. // MDSPDevice.h : Declaration of the CMDSPDevice
  22. #ifndef __MDSPDEVICE_H_
  23. #define __MDSPDEVICE_H_
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CMDSPDevice
  26. class ATL_NO_VTABLE CMDSPDevice :
  27. public CComObjectRootEx<CComSingleThreadModel>,
  28. public CComCoClass<CMDSPDevice, &CLSID_MDSPDevice>,
  29. public IMDSPDevice2, IMDSPDeviceControl,
  30. public ISpecifyPropertyPages
  31. {
  32. public:
  33. CMDSPDevice();
  34. ~CMDSPDevice();
  35. DECLARE_REGISTRY_RESOURCEID(IDR_MDSPDEVICE)
  36. BEGIN_COM_MAP(CMDSPDevice)
  37. COM_INTERFACE_ENTRY(IMDSPDevice)
  38. COM_INTERFACE_ENTRY(IMDSPDevice2)
  39. COM_INTERFACE_ENTRY(IMDSPDeviceControl)
  40. COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  41. END_COM_MAP()
  42. // IMDSPDevice
  43. public:
  44. HRESULT InitGlobalDeviceInfo();
  45. WCHAR m_wcsName[MAX_PATH];
  46. STDMETHOD(EnumStorage)(/*[out]*/ IMDSPEnumStorage **ppEnumStorage);
  47. STDMETHOD(GetFormatSupport)(_WAVEFORMATEX **pFormatEx,
  48. UINT *pnFormatCount,
  49. LPWSTR **pppwszMimeType,
  50. UINT *pnMimeTypeCount);
  51. STDMETHOD(GetDeviceIcon)(/*[out]*/ ULONG *hIcon);
  52. STDMETHOD(GetStatus)(/*[out]*/ DWORD *pdwStatus);
  53. STDMETHOD(GetPowerSource)(/*[out]*/ DWORD *pdwPowerSource, /*[out]*/ DWORD *pdwPercentRemaining);
  54. STDMETHOD(GetSerialNumber)(/*[out]*/ PWMDMID pSerialNumber, /*[in, out]*/BYTE abMac[WMDM_MAC_LENGTH]);
  55. STDMETHOD(GetType)(/*[out]*/ DWORD *pdwType);
  56. STDMETHOD(GetVersion)(/*[out]*/ DWORD *pdwVersion);
  57. STDMETHOD(GetManufacturer)(/*[out,string,size_is(nMaxChars)]*/ LPWSTR pwszName, /*[in]*/ UINT nMaxChars);
  58. STDMETHOD(GetName)(/*[out,string,size_is(nMaxChars)]*/ LPWSTR pwszName, /*[in]*/ UINT nMaxChars);
  59. STDMETHOD(SendOpaqueCommand)(OPAQUECOMMAND *pCommand);
  60. // IMDSPDevice2
  61. STDMETHOD(GetStorage)( LPCWSTR pszStorageName, IMDSPStorage** ppStorage );
  62. STDMETHOD(GetFormatSupport2)( DWORD dwFlags,
  63. _WAVEFORMATEX **ppAudioFormatEx,
  64. UINT *pnAudioFormatCount,
  65. _VIDEOINFOHEADER **ppVideoFormatEx,
  66. UINT *pnVideoFormatCount,
  67. WMFILECAPABILITIES **ppFileType,
  68. UINT *pnFileTypeCount );
  69. STDMETHOD(GetSpecifyPropertyPages)( ISpecifyPropertyPages** ppSpecifyPropPages,
  70. IUnknown*** pppUnknowns,
  71. ULONG* pcUnks );
  72. STDMETHOD(GetPnPName)( LPWSTR pwszPnPName, UINT nMaxChars );
  73. // IMDSPDeviceControl
  74. STDMETHOD(GetDCStatus)(/*[out]*/ DWORD *pdwStatus);
  75. STDMETHOD(GetCapabilities)(/*[out]*/ DWORD *pdwCapabilitiesMask);
  76. STDMETHOD(Play)();
  77. STDMETHOD(Record)(/*[in]*/ _WAVEFORMATEX *pFormat);
  78. STDMETHOD(Pause)();
  79. STDMETHOD(Resume)();
  80. STDMETHOD(Stop)();
  81. STDMETHOD(Seek)(/*[in]*/ UINT fuMode, /*[in]*/ int nOffset);
  82. // ISpecifyPropertyPages
  83. STDMETHOD(GetPages)(CAUUID *pPages);
  84. };
  85. #endif //__MDSPDEVICE_H_