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.6 KiB

  1. // --------------------------------------------------------------------------------
  2. // InetStm.h
  3. // Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  4. // Steven J. Bailey
  5. // --------------------------------------------------------------------------------
  6. #ifndef __INETTEXT_H
  7. #define __INETTEXT_H
  8. // --------------------------------------------------------------------------------
  9. // Depends
  10. // --------------------------------------------------------------------------------
  11. #include "variantx.h"
  12. // --------------------------------------------------------------------------------
  13. // Forward Decls
  14. // --------------------------------------------------------------------------------
  15. class CStreamLockBytes;
  16. // --------------------------------------------------------------------------------
  17. // INETSTREAMBUFFER
  18. // --------------------------------------------------------------------------------
  19. typedef struct tagINETSTREAMBUFFER {
  20. ULARGE_INTEGER uliOffset; // Global offset of the start of this cache
  21. BYTE rgb[4096]; // Cached portion of m_pStmLock
  22. ULONG cb; // How many valid bytes in rgbCache
  23. ULONG i; // Current Read Offset into rgb
  24. CHAR chPrev; // Previous character, could be in previous buffer
  25. } INETSTREAMBUFFER, *LPINETSTREAMBUFFER;
  26. // --------------------------------------------------------------------------------
  27. // INETSTREAMLINE
  28. // --------------------------------------------------------------------------------
  29. typedef struct tagINETSTREAMLINE {
  30. BOOL fReset; // Reset to 0 on next call to ReadLine
  31. BYTE rgbScratch[1024]; // Cached portion of m_pStmLock
  32. LPBYTE pb; // Actual line (could be allocated != rgb)
  33. ULONG cb; // How many valid bytes in rgbCache
  34. ULONG cbAlloc; // Size of buffer pointed to by pb
  35. } INETSTREAMLINE, *LPINETSTREAMLINE;
  36. // --------------------------------------------------------------------------------
  37. // CInternetStream
  38. // --------------------------------------------------------------------------------
  39. class CInternetStream : public IUnknown
  40. {
  41. public:
  42. // ----------------------------------------------------------------------------
  43. // Construction
  44. // ----------------------------------------------------------------------------
  45. CInternetStream(void);
  46. ~CInternetStream(void);
  47. // ----------------------------------------------------------------------------
  48. // IUnknown Members
  49. // ----------------------------------------------------------------------------
  50. STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv) {
  51. return TrapError(E_NOTIMPL); }
  52. STDMETHODIMP_(ULONG) AddRef(void);
  53. STDMETHODIMP_(ULONG) Release(void);
  54. // ----------------------------------------------------------------------------
  55. // IInternetStream Members
  56. // ----------------------------------------------------------------------------
  57. HRESULT HrInitNew(IStream *pStream);
  58. HRESULT HrReadToEnd(void);
  59. HRESULT HrReadLine(LPPROPSTRINGA pLine);
  60. HRESULT HrReadHeaderLine(LPPROPSTRINGA pHeader, LONG *piColonPos);
  61. HRESULT HrGetSize(DWORD *pcbSize);
  62. #ifdef MAC
  63. DWORD DwGetOffset(void) { return m_uliOffset.LowPart; }
  64. #else // !MAC
  65. DWORD DwGetOffset(void) { return (DWORD)m_uliOffset.QuadPart; }
  66. #endif // MAC
  67. void InitNew(DWORD dwOffset, CStreamLockBytes *pStmLock);
  68. void GetLockBytes(CStreamLockBytes **ppStmLock);
  69. void Seek(DWORD dwOffset);
  70. void SetFullyAvailable(BYTE fFullyAvailable) { m_fFullyAvailable = fFullyAvailable; }
  71. private:
  72. // ----------------------------------------------------------------------------
  73. // Private Methods
  74. // ----------------------------------------------------------------------------
  75. HRESULT _HrGetNextBuffer(void);
  76. private:
  77. // ----------------------------------------------------------------------------
  78. // Private Data
  79. // ----------------------------------------------------------------------------
  80. ULONG m_cRef; // Reference Count
  81. BYTE m_fFullyAvailable; // Is all the data available
  82. CStreamLockBytes *m_pStmLock; // Thread Safe Data Source
  83. ULARGE_INTEGER m_uliOffset; // Last Read Postion of m_pStmLock
  84. INETSTREAMBUFFER m_rBuffer; // Current Buffer
  85. INETSTREAMLINE m_rLine; // Current Line
  86. };
  87. #endif // __INETTEXT_H