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.

73 lines
2.0 KiB

  1. // Base64Coder.h: interface for the Base64Coder class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_BASE64CODER_H__B2E45717_0625_11D2_A80A_00C04FB6794C__INCLUDED_)
  5. #define AFX_BASE64CODER_H__B2E45717_0625_11D2_A80A_00C04FB6794C__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. ////////////////////////////////////////////////////////////////////////
  10. // Standard foo for file name aliasing. This code block must be after
  11. // all includes of VSS header files.
  12. //
  13. #ifdef VSS_FILE_ALIAS
  14. #undef VSS_FILE_ALIAS
  15. #endif
  16. #define VSS_FILE_ALIAS "BUEB64CH"
  17. //
  18. ////////////////////////////////////////////////////////////////////////
  19. class Base64Coder
  20. {
  21. // Internal bucket class.
  22. class TempBucket
  23. {
  24. public:
  25. BYTE nData[4];
  26. BYTE nSize;
  27. void Clear()
  28. {
  29. ::ZeroMemory(nData, sizeof(nData));
  30. nSize = 0;
  31. }
  32. };
  33. PBYTE m_pDBuffer;
  34. LPWSTR m_pEBuffer;
  35. UINT m_nDBufLen;
  36. UINT m_nEBufLen;
  37. UINT m_nDDataLen;
  38. UINT m_nEDataLen;
  39. public:
  40. Base64Coder();
  41. virtual ~Base64Coder();
  42. public:
  43. virtual void Encode(const BYTE *, UINT);
  44. virtual void Decode(LPCWSTR);
  45. virtual BYTE * DecodedMessage() const;
  46. virtual LPCWSTR EncodedMessage() const;
  47. virtual void AllocEncode(UINT);
  48. virtual void AllocDecode(UINT);
  49. virtual void SetEncodeBuffer(LPCWSTR pBuffer, UINT nBufLen);
  50. virtual void SetDecodeBuffer(const BYTE *pBuffer, UINT nBufLen);
  51. protected:
  52. virtual void _EncodeToBuffer(const TempBucket &Decode, LPWSTR pBuffer);
  53. virtual UINT _DecodeToBuffer(const TempBucket &Decode, BYTE *pBuffer);
  54. virtual void _EncodeRaw(TempBucket &, const TempBucket &);
  55. virtual void _DecodeRaw(TempBucket &, const TempBucket &);
  56. virtual BOOL _IsBadMimeChar(WCHAR);
  57. static char m_DecodeTable[256];
  58. static BOOL m_Init;
  59. void _Init();
  60. };
  61. #endif // !defined(AFX_BASE64CODER_H__B2E45717_0625_11D2_A80A_00C04FB6794C__INCLUDED_)