Source code of Windows XP (NT5)
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.

93 lines
2.7 KiB

  1. // SYSSRT.H: Definition of CITSysSort sort object implementation.
  2. #ifndef __SYSSRT_H__
  3. #define __SYSSRT_H__
  4. #include "verinfo.h"
  5. #define VERSION_SYSSORT (MAKELONG(MAKEWORD(0, rapFile), MAKEWORD(rmmFile, rmjFile)))
  6. // Sort control structure that contains all the information that can
  7. // vary how keys are compared.
  8. typedef struct _srtctl
  9. {
  10. DWORD dwCodePageID;
  11. LCID lcid;
  12. DWORD dwKeyType;
  13. DWORD grfSortFlags;
  14. } SRTCTL;
  15. class CITSysSort :
  16. public IITSortKey,
  17. public IITSortKeyConfig,
  18. public IPersistStreamInit,
  19. public CComObjectRootEx<CComMultiThreadModel>,
  20. public CComCoClass<CITSysSort,&CLSID_ITSysSort>
  21. {
  22. public:
  23. CITSysSort();
  24. virtual ~CITSysSort();
  25. BEGIN_COM_MAP(CITSysSort)
  26. COM_INTERFACE_ENTRY(IITSortKey)
  27. COM_INTERFACE_ENTRY(IITSortKeyConfig)
  28. COM_INTERFACE_ENTRY(IPersistStreamInit)
  29. END_COM_MAP()
  30. DECLARE_REGISTRY(CLSID_ITSysSort, "ITIR.SystemSort.4", "ITIR.SystemSort", 0, THREADFLAGS_BOTH )
  31. // IITSortKey methods
  32. STDMETHOD(GetSize)(LPCVOID lpcvKey, DWORD *pcbSize);
  33. STDMETHOD(Compare)(LPCVOID lpcvKey1, LPCVOID lpcvKey2,
  34. LONG *plResult, DWORD *pgrfReason);
  35. STDMETHOD(IsRelated)(LPCVOID lpcvKey1, LPCVOID lpcvKey2,
  36. DWORD dwKeyRelation, DWORD *pgrfReason);
  37. STDMETHOD(Convert)(DWORD dwKeyTypeIn, LPCVOID lpcvKeyIn,
  38. DWORD dwKeyTypeOut, LPVOID lpvKeyOut,
  39. DWORD *pcbSizeOut);
  40. STDMETHOD(ResolveDuplicates)(LPCVOID lpcvKey1, LPCVOID lpcvKey2,
  41. LPCVOID lpvKeyOut, DWORD *pcbSizeOut);
  42. // IITSortKeyConfig methods
  43. STDMETHOD(SetLocaleInfo)(DWORD dwCodePageID, LCID lcid);
  44. STDMETHOD(GetLocaleInfo)(DWORD *pdwCodePageID, LCID *plcid);
  45. STDMETHOD(SetKeyType)(DWORD dwKeyType);
  46. STDMETHOD(GetKeyType)(DWORD *pdwKeyType);
  47. STDMETHOD(SetControlInfo)(DWORD grfSortFlags, DWORD dwReserved);
  48. STDMETHOD(GetControlInfo)(DWORD *pgrfSortFlags, DWORD *pdwReserved);
  49. STDMETHOD(LoadExternalSortData)(IStream *pStream, DWORD dwExtDataType);
  50. // IPersistStreamInit methods
  51. STDMETHOD(GetClassID)(CLSID *pclsid);
  52. STDMETHOD(IsDirty)(void);
  53. STDMETHOD(Load)(IStream *pStream);
  54. STDMETHOD(Save)(IStream *pStream, BOOL fClearDirty);
  55. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSizeMax);
  56. STDMETHOD(InitNew)(void);
  57. private:
  58. // Private methods
  59. void Close(void);
  60. HRESULT ReallocBuffer(HGLOBAL *phmemBuf, DWORD *cbBufCur, DWORD cbBufNew);
  61. HRESULT CompareSz(LPCVOID lpvSz1, LONG cch1, LPCVOID lpvSz2, LONG cch2,
  62. LONG *plResult, BOOL fUnicode);
  63. // Private data members
  64. BOOL m_fInitialized;
  65. BOOL m_fDirty;
  66. BOOL m_fWinNT;
  67. SRTCTL m_srtctl;
  68. HGLOBAL m_hmemAnsi1, m_hmemAnsi2;
  69. DWORD m_cbBufAnsi1Cur, m_cbBufAnsi2Cur;
  70. _ThreadModel::AutoCriticalSection m_cs; // Critical section obj.
  71. };
  72. // Initial size of Ansi string buffers.
  73. #define cbAnsiBufInit 256
  74. #endif // __SYSSRT_H__