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.

98 lines
4.4 KiB

  1. //
  2. // Microsoft Windows Media Technologies
  3. // � 1999 Microsoft Corporation. All rights reserved.
  4. //
  5. // Refer to your End User License Agreement for details on your rights/restrictions to use these sample files.
  6. //
  7. // MSHDSP.DLL is a sample WMDM Service Provider(SP) that enumerates fixed drives.
  8. // This sample shows you how to implement an SP according to the WMDM documentation.
  9. // This sample uses fixed drives on your PC to emulate portable media, and
  10. // shows the relationship between different interfaces and objects. Each hard disk
  11. // volume is enumerated as a device and directories and files are enumerated as
  12. // Storage objects under respective devices. You can copy non-SDMI compliant content
  13. // to any device that this SP enumerates. To copy an SDMI compliant content to a
  14. // device, the device must be able to report a hardware embedded serial number.
  15. // Hard disks do not have such serial numbers.
  16. //
  17. // To build this SP, you are recommended to use the MSHDSP.DSP file under Microsoft
  18. // Visual C++ 6.0 and run REGSVR32.EXE to register the resulting MSHDSP.DLL. You can
  19. // then build the sample application from the WMDMAPP directory to see how it gets
  20. // loaded by the application. However, you need to obtain a certificate from
  21. // Microsoft to actually run this SP. This certificate would be in the KEY.C file
  22. // under the INCLUDE directory for one level up.
  23. // MDSPStorage.h : Declaration of the CMDSPStorage
  24. #ifndef __MDSPSTORAGE_H_
  25. #define __MDSPSTORAGE_H_
  26. #define LYRA_BUFFER_BLOCK_SIZE 10240
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CMDSPStorage
  29. class ATL_NO_VTABLE CMDSPStorage :
  30. public CComObjectRootEx<CComSingleThreadModel>,
  31. public CComCoClass<CMDSPStorage, &CLSID_MDSPStorage>,
  32. public IMDSPStorage, IMDSPObjectInfo, IMDSPObject
  33. {
  34. public:
  35. CMDSPStorage();
  36. ~CMDSPStorage();
  37. DECLARE_REGISTRY_RESOURCEID(IDR_MDSPSTORAGE)
  38. BEGIN_COM_MAP(CMDSPStorage)
  39. COM_INTERFACE_ENTRY(IMDSPStorage)
  40. COM_INTERFACE_ENTRY(IMDSPObjectInfo)
  41. COM_INTERFACE_ENTRY(IMDSPObject)
  42. END_COM_MAP()
  43. // IMDSPStorage
  44. public:
  45. WCHAR m_wcsName[MAX_PATH];
  46. char m_szTmp[MAX_PATH];
  47. HANDLE m_hFile;
  48. //
  49. // Lyra encryption goo
  50. //
  51. BOOL m_fEncryptToMPX;
  52. BOOL m_fCreatedHeader;
  53. unsigned int m_LyraHeader[26];
  54. unsigned int m_rgEncryptionData[LYRA_BUFFER_BLOCK_SIZE];
  55. char m_LyraKeystore[33];
  56. unsigned int m_cUsedData;
  57. STDMETHOD(SetAttributes)(/*[out]*/ DWORD dwAttributes,/*[in]*/ _WAVEFORMATEX *pFormat);
  58. STDMETHOD(EnumStorage)(/*[out]*/ IMDSPEnumStorage **ppEnumStorage);
  59. STDMETHOD(CreateStorage)(/*[in]*/ DWORD dwAttributes, /*[in]*/ _WAVEFORMATEX *pFormat, /*[in]*/ LPWSTR pwszName, /*[out]*/ IMDSPStorage **ppNewStorage);
  60. STDMETHOD(GetRights)(PWMDMRIGHTS *ppRights, UINT *pnRightsCount, /*[in, out]*/BYTE abMac[WMDM_MAC_LENGTH]);
  61. STDMETHOD(GetSize)(/*[out]*/ DWORD *pdwSizeLow, /*[out]*/ DWORD *pdwSizeHigh);
  62. STDMETHOD(GetDate)(PWMDMDATETIME pDateTimeUTC);
  63. STDMETHOD(GetName)(/*[out,string,size_is(nMaxChars)]*/ LPWSTR pwszName, /*[in]*/ UINT nMaxChars);
  64. STDMETHOD(GetAttributes)(/*[out]*/ DWORD *pdwAttributes, /*[out]*/ _WAVEFORMATEX *pFormat);
  65. STDMETHOD(GetStorageGlobals)(/*[out]*/ IMDSPStorageGlobals **ppStorageGlobals);
  66. STDMETHOD(SendOpaqueCommand)(OPAQUECOMMAND *pCommand);
  67. // IMDSPObjectInfo
  68. STDMETHOD(GetPlayLength)(/*[out]*/ DWORD *pdwLength);
  69. STDMETHOD(SetPlayLength)(/*[in]*/ DWORD dwLength);
  70. STDMETHOD(GetPlayOffset)(/*[out]*/ DWORD *pdwOffset);
  71. STDMETHOD(SetPlayOffset)(/*[in]*/ DWORD dwOffset);
  72. STDMETHOD(GetTotalLength)(/*[out]*/ DWORD *pdwLength);
  73. STDMETHOD(GetLastPlayPosition)(/*[out]*/ DWORD *pdwLastPos);
  74. STDMETHOD(GetLongestPlayPosition)(/*[out]*/ DWORD *pdwLongestPos);
  75. // IMDSPObject
  76. STDMETHOD(Open)(/*[in]*/ UINT fuMode);
  77. STDMETHOD(Read)(/*[out,size_is(*pdwSize)]*/ BYTE *pData, /*[in,out]*/ DWORD *pdwSize, /*[in, out]*/BYTE abMac[WMDM_MAC_LENGTH]);
  78. STDMETHOD(Write)(/*[in, size_is(dwSize)]*/ BYTE *pData, /*[in]*/ DWORD *pdwSize, /*[in, out]*/BYTE abMac[WMDM_MAC_LENGTH]);
  79. STDMETHOD(Delete)(/* [in] */ UINT fuMode, /*[in]*/ IWMDMProgress *pProgress);
  80. STDMETHOD(Seek)(/*[in]*/ UINT fuFlags, /*[in]*/ DWORD dwOffset);
  81. STDMETHOD(Rename)(/*[in]*/ LPWSTR pwszNewName, /*[in]*/ IWMDMProgress *pProgress);
  82. STDMETHOD(Move)(/*[in]*/ UINT fuMode, /*[in]*/ IWMDMProgress *pProgress, /*[in]*/ IMDSPStorage *pTarget);
  83. STDMETHOD(Close)();
  84. };
  85. #endif //__MDSPSTORAGE_H_