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.

149 lines
6.3 KiB

  1. #ifndef NEWMLSTR
  2. // MLStrW.h : Declaration of the CMLStrW
  3. #ifndef __MLSTRW_H_
  4. #define __MLSTRW_H_
  5. #include "mlatl.h"
  6. #include "mlstrbuf.h"
  7. class CMLStr;
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CMLStrW
  10. class ATL_NO_VTABLE CMLStrW :
  11. public CComTearOffObjectBase<CMLStr>,
  12. public IMLangStringWStr
  13. {
  14. typedef CComObject<CMLStr>* POWNER;
  15. public:
  16. DECLARE_NO_REGISTRY()
  17. BEGIN_COM_MAP(CMLStrW)
  18. COM_INTERFACE_ENTRY(IMLangString)
  19. COM_INTERFACE_ENTRY(IMLangStringWStr)
  20. END_COM_MAP()
  21. public:
  22. // IMLangString
  23. STDMETHOD(Sync)(/*[in]*/ BOOL fNoAccess);
  24. STDMETHOD(GetLength)(/*[out, retval]*/ long* plLen);
  25. STDMETHOD(SetMLStr)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in]*/ IUnknown* pSrcMLStr, /*[in]*/ long lSrcPos, /*[in]*/ long lSrcLen);
  26. STDMETHOD(GetMLStr)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcLen, /*[in]*/ IUnknown* pUnkOuter, /*[in]*/ DWORD dwClsContext, /*[in]*/ const IID* piid, /*[out]*/ IUnknown** ppDestMLStr, /*[out]*/ long* plDestPos, /*[out]*/ long* plDestLen);
  27. // IMLangStringWStr
  28. STDMETHOD(SetWStr)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in, size_is(cchSrc)]*/ const WCHAR* pszSrc, /*[in]*/ long cchSrc, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  29. STDMETHOD(SetStrBufW)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in]*/ IMLangStringBufW* pSrcBuf, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  30. STDMETHOD(GetWStr)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcLen, /*[out, size_is(cchDest)]*/ WCHAR* pszDest, /*[in]*/ long cchDest, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  31. STDMETHOD(GetStrBufW)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcMaxLen, /*[out]*/ IMLangStringBufW** ppDestBuf, /*[out]*/ long* plDestLen);
  32. STDMETHOD(LockWStr)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcLen, /*[in]*/ long lFlags, /*[in]*/ long cchRequest, /*[out, size_is(,*pcchDest)]*/ WCHAR** ppszDest, /*[out]*/ long* pcchDest, /*[out]*/ long* plDestLen);
  33. STDMETHOD(UnlockWStr)(/*[in, size_is(cchSrc)]*/ const WCHAR* pszSrc, /*[in]*/ long cchSrc, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  34. STDMETHOD(SetLocale)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in]*/ LCID locale);
  35. STDMETHOD(GetLocale)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcMaxLen, /*[out]*/ LCID* plocale, /*[out]*/ long* plLocalePos, /*[out]*/ long* plLocaleLen);
  36. protected:
  37. POWNER GetOwner(void) const {return m_pOwner;}
  38. };
  39. #endif //__MLSTRW_H_
  40. #else // NEWMLSTR
  41. // MLStrW.h : Declaration of the CMLStrW
  42. #ifndef __MLSTRW_H_
  43. #define __MLSTRW_H_
  44. #include "mlatl.h"
  45. class CMLStr;
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CMLStrW
  48. class ATL_NO_VTABLE CMLStrW :
  49. public CComTearOffObjectBase<CMLStr>,
  50. public IMLangStringWStr
  51. {
  52. typedef CComObject<CMLStr>* POWNER;
  53. public:
  54. CMLStrW(void);
  55. DECLARE_NO_REGISTRY()
  56. BEGIN_COM_MAP(CMLStrW)
  57. COM_INTERFACE_ENTRY(IMLangString)
  58. COM_INTERFACE_ENTRY(IMLangStringWStr)
  59. END_COM_MAP()
  60. public:
  61. // IMLangString
  62. STDMETHOD(LockMLStr)(/*[in]*/ long lPos, /*[in]*/ long lLen, /*[in]*/ DWORD dwFlags, /*[out]*/ DWORD* pdwCookie, /*[out]*/ long* plActualPos, /*[out]*/ long* plActualLen);
  63. STDMETHOD(UnlockMLStr)(/*[in]*/ DWORD dwCookie);
  64. STDMETHOD(GetLength)(/*[out, retval]*/ long* plLen);
  65. STDMETHOD(SetMLStr)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in]*/ IUnknown* pSrcMLStr, /*[in]*/ long lSrcPos, /*[in]*/ long lSrcLen);
  66. STDMETHOD(RegisterAttr)(/*[in]*/ IUnknown* pUnk, /*[out]*/ DWORD* pdwCookie);
  67. STDMETHOD(UnregisterAttr)(/*[in]*/ DWORD dwCookie);
  68. STDMETHOD(EnumAttr)(/*[out]*/ IEnumUnknown** ppEnumUnk);
  69. STDMETHOD(FindAttr)(/*[in]*/ REFIID riid, /*[in]*/ LPARAM lParam, /*[out]*/ IUnknown** ppUnk);
  70. // IMLangStringWStr
  71. STDMETHOD(SetWStr)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in, size_is(cchSrc)]*/ const WCHAR* pszSrc, /*[in]*/ long cchSrc, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  72. STDMETHOD(SetStrBufW)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in]*/ IMLangStringBufW* pSrcBuf, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  73. STDMETHOD(GetWStr)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcLen, /*[out, size_is(cchDest)]*/ WCHAR* pszDest, /*[in]*/ long cchDest, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  74. STDMETHOD(GetStrBufW)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcMaxLen, /*[out]*/ IMLangStringBufW** ppDestBuf, /*[out]*/ long* plDestLen);
  75. STDMETHOD(LockWStr)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcLen, /*[in]*/ long lFlags, /*[in]*/ long cchRequest, /*[out, size_is(,*pcchDest)]*/ WCHAR** ppszDest, /*[out]*/ long* pcchDest, /*[out]*/ long* plDestLen);
  76. STDMETHOD(UnlockWStr)(/*[in, size_is(cchSrc)]*/ const WCHAR* pszSrc, /*[in]*/ long cchSrc, /*[out]*/ long* pcchActual, /*[out]*/ long* plActualLen);
  77. STDMETHOD(SetLocale)(/*[in]*/ long lDestPos, /*[in]*/ long lDestLen, /*[in]*/ LCID locale);
  78. STDMETHOD(GetLocale)(/*[in]*/ long lSrcPos, /*[in]*/ long lSrcMaxLen, /*[out]*/ LCID* plocale, /*[out]*/ long* plLocalePos, /*[out]*/ long* plLocaleLen);
  79. protected:
  80. ~CMLStrW(void);
  81. POWNER GetOwner(void) const {return m_pOwner;}
  82. inline HRESULT GetAttrWStr(IMLStrAttrWStr** ppAttr);
  83. inline HRESULT GetAttrLocale(IMLStrAttrLocale** ppAttr);
  84. HRESULT GetAttrWStrReal(IMLStrAttrWStr** ppAttr);
  85. HRESULT GetAttrLocaleReal(IMLStrAttrLocale** ppAttr);
  86. CRITICAL_SECTION m_cs;
  87. IMLStrAttrWStr* m_pAttrWStr;
  88. IMLStrAttrLocale* m_pAttrLocale;
  89. DWORD m_dwAttrWStrCookie; // Returned by RegisterAttr
  90. DWORD m_dwAttrLocaleCookie; // Returned by RegisterAttr
  91. };
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CMLStrW inline-line functions
  94. HRESULT CMLStrW::GetAttrWStr(IMLStrAttrWStr** ppAttr)
  95. {
  96. if (m_pAttrWStr)
  97. {
  98. if (ppAttr)
  99. *ppAttr = m_pAttrWStr;
  100. return S_OK;
  101. }
  102. else
  103. {
  104. return GetAttrWStrReal(ppAttr);
  105. }
  106. }
  107. HRESULT CMLStrW::GetAttrLocale(IMLStrAttrLocale** ppAttr)
  108. {
  109. if (m_pAttrLocale)
  110. {
  111. if (ppAttr)
  112. *ppAttr = m_pAttrLocale;
  113. return S_OK;
  114. }
  115. else
  116. {
  117. return GetAttrLocaleReal(ppAttr);
  118. }
  119. }
  120. #endif //__MLSTRW_H_
  121. #endif // NEWMLSTR