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.

87 lines
3.4 KiB

  1. #ifndef ICHRCNV_H_
  2. #define ICHRCNV_H_
  3. #define MAXOVERFLOWCHARS 16
  4. class CICharConverter
  5. {
  6. private:
  7. DWORD _dwWinCodePage;
  8. DWORD _dwInternetEncoding;
  9. DWORD _dwUTFEncoding;
  10. DWORD _dwUTFEncoding2;
  11. DWORD _dwUnicodeEncoding;
  12. DWORD _dwFlag;
  13. WCHAR * _lpFallBack;
  14. BOOL _bConvertDirt;
  15. LPSTR _lpUnicodeStr;
  16. LPSTR _lpInterm1Str;
  17. LPSTR _lpInterm2Str;
  18. HCINS _hcins;
  19. int _hcins_dst;
  20. int _cvt_count;
  21. public:
  22. DWORD _dwConvertType;
  23. LPSTR _lpDstStr;
  24. LPSTR _lpSrcStr;
  25. int _nSrcSize;
  26. CICharConverter();
  27. CICharConverter(DWORD dwFlag, WCHAR *lpFallBack);
  28. CICharConverter(DWORD dwSrcEncoding, DWORD dwDstEncoding);
  29. ~CICharConverter();
  30. HRESULT ConvertSetup(DWORD * pdwSrcEncoding, DWORD dwDstEncoding);
  31. HRESULT DoCodeConvert(LPDWORD lpdwMode, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  32. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  33. BOOL ConvertCleanUp();
  34. private:
  35. HRESULT ConvertUUWI(LPDWORD lpdwMode, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  36. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  37. HRESULT ConvertIWUU(LPDWORD lpdwMode, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  38. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  39. HRESULT UnicodeToMultiByteEncoding(DWORD dwDstEncoding, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  40. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  41. HRESULT UTF78ToUnicode(LPDWORD lpdwMode, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  42. LPSTR lpDstStr, LPINT lpnDstSize);
  43. HRESULT UnicodeToUTF78(LPDWORD lpdwMode, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  44. LPSTR lpDstStr, LPINT lpnDstSize);
  45. HRESULT UnicodeToWindowsCodePage(LPCSTR lpSrcStr, LPINT lpnSrcSize,
  46. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  47. HRESULT UnicodeToInternetEncoding(LPCSTR lpSrcStr, LPINT lpnSrcSize,
  48. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  49. HRESULT WindowsCodePageToUnicode(LPCSTR lpSrcStr, LPINT lpnSrcSize,
  50. LPSTR lpDstStr, LPINT lpnDstSize);
  51. HRESULT InternetEncodingToUnicode(LPCSTR lpSrcStr, LPINT lpnSrcSize,
  52. LPSTR lpDstStr, LPINT lpnDstSize);
  53. HRESULT WindowsCodePageToInternetEncoding(LPDWORD lpdwMode, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  54. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  55. HRESULT InternetEncodingToWindowsCodePage(LPDWORD lpdwMode, LPCSTR lpSrcStr, LPINT lpnSrcSize,
  56. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  57. HRESULT WindowsCodePageToInternetEncodingWrap(LPCSTR lpSrcStr, LPINT lpnSrcSize,
  58. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  59. HRESULT InternetEncodingToWindowsCodePageWrap(LPCSTR lpSrcStr, LPINT lpnSrcSize,
  60. LPSTR lpDstStr, LPINT lpnDstSize, DWORD dwFlag, WCHAR *lpFallBack);
  61. HRESULT CreateINetString(BOOL fInbound, UINT uCodePage, int nCodeSet);
  62. HRESULT DoConvertINetString(LPDWORD lpdwMode, BOOL fInbound, UINT uCodePage, int nCodeSet,
  63. LPCSTR lpSrcStr, LPINT lpnSrcSize, LPSTR lpDestStr, int cchDest, LPINT lpnSize);
  64. HRESULT KSC5601ToEUCKR(LPCSTR lpSrcStr, LPINT lpnSrcSize, LPSTR lpDestStr, int cchDest, LPINT lpnSize);
  65. protected:
  66. };
  67. HRESULT WINAPI _IStreamConvertINetString(CICharConverter * INetConvert, LPDWORD lpdwMode, DWORD dwSrcEncoding, DWORD dwDstEncoding, IStream *pstmIn, IStream *pstmOut, DWORD *pdwProperty);
  68. #endif /* ICHRCNV_H_ */