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.

105 lines
4.9 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. // MDSPStorage.h : Declaration of the CMDSPStorage
  22. #ifndef __MDSPSTORAGE_H_
  23. #define __MDSPSTORAGE_H_
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CMDSPStorage
  26. class ATL_NO_VTABLE CMDSPStorage :
  27. public CComObjectRootEx<CComSingleThreadModel>,
  28. public CComCoClass<CMDSPStorage, &CLSID_MDSPStorage>,
  29. public IMDSPStorage2, IMDSPObjectInfo, IMDSPObject
  30. {
  31. public:
  32. CMDSPStorage();
  33. ~CMDSPStorage();
  34. DECLARE_REGISTRY_RESOURCEID(IDR_MDSPSTORAGE)
  35. BEGIN_COM_MAP(CMDSPStorage)
  36. COM_INTERFACE_ENTRY(IMDSPStorage)
  37. COM_INTERFACE_ENTRY(IMDSPStorage2)
  38. COM_INTERFACE_ENTRY(IMDSPObjectInfo)
  39. COM_INTERFACE_ENTRY(IMDSPObject)
  40. END_COM_MAP()
  41. // IMDSPStorage
  42. public:
  43. WCHAR m_wcsName[MAX_PATH];
  44. char m_szTmp[MAX_PATH];
  45. HANDLE m_hFile;
  46. STDMETHOD(SetAttributes)(/*[out]*/ DWORD dwAttributes,/*[in]*/ _WAVEFORMATEX *pFormat);
  47. STDMETHOD(EnumStorage)(/*[out]*/ IMDSPEnumStorage **ppEnumStorage);
  48. STDMETHOD(CreateStorage)(/*[in]*/ DWORD dwAttributes, /*[in]*/ _WAVEFORMATEX *pFormat, /*[in]*/ LPWSTR pwszName, /*[out]*/ IMDSPStorage **ppNewStorage);
  49. STDMETHOD(GetRights)(PWMDMRIGHTS *ppRights, UINT *pnRightsCount, /*[in, out]*/BYTE abMac[WMDM_MAC_LENGTH]);
  50. STDMETHOD(GetSize)(/*[out]*/ DWORD *pdwSizeLow, /*[out]*/ DWORD *pdwSizeHigh);
  51. STDMETHOD(GetDate)(PWMDMDATETIME pDateTimeUTC);
  52. STDMETHOD(GetName)(/*[out,string,size_is(nMaxChars)]*/ LPWSTR pwszName, /*[in]*/ UINT nMaxChars);
  53. STDMETHOD(GetAttributes)(/*[out]*/ DWORD *pdwAttributes, /*[out]*/ _WAVEFORMATEX *pFormat);
  54. STDMETHOD(GetStorageGlobals)(/*[out]*/ IMDSPStorageGlobals **ppStorageGlobals);
  55. STDMETHOD(SendOpaqueCommand)(OPAQUECOMMAND *pCommand);
  56. // IMDSPStorage2
  57. STDMETHOD(GetStorage)( LPCWSTR pszStorageName, IMDSPStorage** ppStorage );
  58. STDMETHOD(CreateStorage2)( DWORD dwAttributes,
  59. DWORD dwAttributesEx,
  60. _WAVEFORMATEX *pAudioFormat,
  61. _VIDEOINFOHEADER *pVideoFormat,
  62. LPWSTR pwszName,
  63. ULONGLONG qwFileSize,
  64. IMDSPStorage **ppNewStorage);
  65. STDMETHOD(SetAttributes2)( DWORD dwAttributes,
  66. DWORD dwAttributesEx,
  67. _WAVEFORMATEX *pAudioFormat,
  68. _VIDEOINFOHEADER* pVideoFormat );
  69. STDMETHOD(GetAttributes2)( DWORD *pdwAttributes,
  70. DWORD *pdwAttributesEx,
  71. _WAVEFORMATEX *pAudioFormat,
  72. _VIDEOINFOHEADER* pVideoFormat );
  73. // IMDSPObjectInfo
  74. STDMETHOD(GetPlayLength)(/*[out]*/ DWORD *pdwLength);
  75. STDMETHOD(SetPlayLength)(/*[in]*/ DWORD dwLength);
  76. STDMETHOD(GetPlayOffset)(/*[out]*/ DWORD *pdwOffset);
  77. STDMETHOD(SetPlayOffset)(/*[in]*/ DWORD dwOffset);
  78. STDMETHOD(GetTotalLength)(/*[out]*/ DWORD *pdwLength);
  79. STDMETHOD(GetLastPlayPosition)(/*[out]*/ DWORD *pdwLastPos);
  80. STDMETHOD(GetLongestPlayPosition)(/*[out]*/ DWORD *pdwLongestPos);
  81. // IMDSPObject
  82. STDMETHOD(Open)(/*[in]*/ UINT fuMode);
  83. STDMETHOD(Read)(/*[out,size_is(*pdwSize)]*/ BYTE *pData, /*[in,out]*/ DWORD *pdwSize, /*[in, out]*/BYTE abMac[WMDM_MAC_LENGTH]);
  84. STDMETHOD(Write)(/*[in, size_is(dwSize)]*/ BYTE *pData, /*[in]*/ DWORD *pdwSize, /*[in, out]*/BYTE abMac[WMDM_MAC_LENGTH]);
  85. STDMETHOD(Delete)(/* [in] */ UINT fuMode, /*[in]*/ IWMDMProgress *pProgress);
  86. STDMETHOD(Seek)(/*[in]*/ UINT fuFlags, /*[in]*/ DWORD dwOffset);
  87. STDMETHOD(Rename)(/*[in]*/ LPWSTR pwszNewName, /*[in]*/ IWMDMProgress *pProgress);
  88. STDMETHOD(Move)(/*[in]*/ UINT fuMode, /*[in]*/ IWMDMProgress *pProgress, /*[in]*/ IMDSPStorage *pTarget);
  89. STDMETHOD(Close)();
  90. };
  91. #endif //__MDSPSTORAGE_H_