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.

94 lines
2.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1997 **/
  4. /**********************************************************************/
  5. /*
  6. xstream.h
  7. FILE HISTORY:
  8. */
  9. #ifndef _XSTREAM_H
  10. #define _XSTREAM_H
  11. struct ColumnData
  12. {
  13. ColumnData()
  14. {
  15. fmt = LVCFMT_LEFT;
  16. }
  17. // This value may be positive or negative. If >0, then this column
  18. // is visible. If <0 then the column is invisible. In either case
  19. // the absolute value is the relative position of the column (this
  20. // position is used only for the "select columns" dialog.
  21. // If the value is ==0 then it's an error.
  22. LONG m_nPosition;
  23. // Width of the column
  24. DWORD m_dwWidth;
  25. // Format of the column:
  26. // LVCFMT_LEFT Text is left-aligned.
  27. // LVCFMT_RIGHT Text is right-aligned
  28. int fmt;
  29. };
  30. class XferStream
  31. {
  32. public:
  33. enum Mode
  34. {
  35. MODE_READ,
  36. MODE_WRITE,
  37. MODE_SIZE
  38. };
  39. XferStream(IStream *pstm, Mode mode);
  40. HRESULT XferDWORD(ULONG ulId, DWORD *pdwData);
  41. HRESULT XferCString(ULONG ulId, CString *pstData);
  42. HRESULT XferLARGEINTEGER(ULONG ulId, LARGE_INTEGER *pliData);
  43. HRESULT XferRect(ULONG ulId, RECT *prc);
  44. HRESULT XferDWORDArray(ULONG ulId, ULONG *pcArray, DWORD *pdwArray);
  45. HRESULT XferColumnData(ULONG ulId, ULONG *pcData, ColumnData *pdwData);
  46. HRESULT XferDWORDArray(ULONG ulId, CDWordArray * pdwArray);
  47. HRESULT XferCStringArray(ULONG ulId, CStringArray * pstrArray);
  48. DWORD GetSize() { return m_dwSize; };
  49. private:
  50. HRESULT _XferCString(CString * pstData);
  51. HRESULT _XferLONG(LONG *plData);
  52. HRESULT _XferDWORD(DWORD *pdwData);
  53. HRESULT _XferBytes(LPBYTE pData, ULONG cbLength);
  54. HRESULT _XferObjectId(ULONG *pulId);
  55. DWORD m_dwSize;
  56. SPIStream m_spstm;
  57. XferStream::Mode m_mode;
  58. };
  59. #define XFER_DWORD 0x0001
  60. #define XFER_STRING 0x0002
  61. #define XFER_COLUMNDATA 0x0003
  62. #define XFER_LARGEINTEGER 0x0004
  63. #define XFER_RECT 0x0005
  64. #define XFER_ARRAY 0x8000
  65. #define XFER_DWORD_ARRAY (XFER_DWORD | XFER_ARRAY)
  66. #define XFER_COLUMNDATA_ARRAY (XFER_COLUMNDATA | XFER_ARRAY)
  67. #define XFER_STRING_ARRAY (XFER_STRING | XFER_ARRAY)
  68. #define XFER_TAG(id,type) (((id) << 16) | (type))
  69. #define XFER_TYPE_FROM_TAG(x) ( 0x0000FFFF & (x) )
  70. #define XFER_ID_FROM_TAG(x) ( 0x0000FFFF & ( (x) >> 16 ))
  71. #endif _XSTREAM_H