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.

67 lines
2.6 KiB

  1. // Copyright (c) 2000 Microsoft Corporation. All rights reserved.
  2. //
  3. // Declaration of CSourceText.
  4. //
  5. // This is a DirectMusic object whose sole purpose is to load a plain text file and return the text.
  6. // It is used by the CDirectMusicScript object to read its source code from a separate non-riff text file.
  7. #pragma once
  8. //////////////////////////////////////////////////////////////////////
  9. // Interface for getting the text
  10. extern const GUID CLSID_DirectMusicSourceText;
  11. extern const GUID IID_IDirectMusicSourceText;
  12. #undef INTERFACE
  13. #define INTERFACE IDirectMusicSourceText
  14. DECLARE_INTERFACE_(IDirectMusicSourceText, IUnknown)
  15. {
  16. STDMETHOD_(void, GetTextLength)(DWORD *pcwchRequiredBufferSize); // size of buffer to allocate (includes a space for the terminator)
  17. STDMETHOD_(void, GetText)(WCHAR *pwszText); // buffer must be of size from GetTextLength
  18. };
  19. //////////////////////////////////////////////////////////////////////
  20. // The object iteself
  21. // �� Does this object need a critical section? GetObject should serialize access and nobody but the
  22. // script can hold onto it.
  23. class CSourceText
  24. : public IDirectMusicSourceText,
  25. public IPersistStream,
  26. public IDirectMusicObject
  27. {
  28. public:
  29. static HRESULT CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv);
  30. // IUnknown
  31. STDMETHOD(QueryInterface)(const IID &iid, void **ppv);
  32. STDMETHOD_(ULONG, AddRef)();
  33. STDMETHOD_(ULONG, Release)();
  34. // IPersistStream functions (only Load is implemented)
  35. STDMETHOD(GetClassID)(CLSID* pClassID) {return E_NOTIMPL;}
  36. STDMETHOD(IsDirty)() {return S_FALSE;}
  37. STDMETHOD(Load)(IStream* pStream);
  38. STDMETHOD(Save)(IStream* pStream, BOOL fClearDirty) {return E_NOTIMPL;}
  39. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pcbSize) {return E_NOTIMPL;}
  40. // IDirectMusicObject
  41. // (This interface must exist in order for the object to be loaded, but the methods aren't actually
  42. // implemented to provide/save any information.)
  43. STDMETHOD(GetDescriptor)(LPDMUS_OBJECTDESC pDesc) { pDesc->dwValidData = 0; return S_OK; }
  44. STDMETHOD(SetDescriptor)(LPDMUS_OBJECTDESC pDesc) { return S_OK; }
  45. STDMETHOD(ParseDescriptor)(LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) { pDesc->dwValidData = 0; return S_OK; }
  46. // IDirectMusicSourceText
  47. STDMETHOD_(void, GetTextLength)(DWORD *pcwchRequiredBufferSize); // size of buffer to allocate (includes a space for the terminator)
  48. STDMETHOD_(void, GetText)(WCHAR *pwszText); // buffer must be of size from GetTextLength
  49. private:
  50. CSourceText();
  51. long m_cRef;
  52. SmartRef::WString m_wstrText;
  53. DWORD m_cwchText;
  54. };