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.

74 lines
2.0 KiB

  1. #ifndef _CPDETECT_H_
  2. #define _CPDETECT_H_
  3. #define MAX_CONFIDENCE 100
  4. #define MIN_CONFIDENCE 86
  5. #define MIN_DOCPERCENT 60
  6. #define MIN_TEXT_SIZE 200
  7. #define HIGHEST_ASCII 127
  8. #define MIN_ACCEPTABLE_CONFIDENCE 60
  9. #define DEFAULT_CPMRU_INIT_HITS 100
  10. #define DEFAULT_CPMRU_FACTOR 20
  11. #define CP_AUTO_MRU_NUM 6
  12. #define DEFAULT_CPMRU_NUM 10
  13. #define MAX_CPMRU_NUM 20
  14. #define MAX_ENTITY_LENTH 10
  15. #define IsNoise(c) ((unsigned)(c) <= 0x20 && (c) != 0 && (c) != 0x1B)
  16. #define IS_ENCODED_ENCODING(cp) ((cp) == CP_ISO_2022_JP || (cp) == CP_CHN_HZ || (cp) == CP_UTF_7 || (cp) == CP_UTF_8 || (cp) == CP_ISO_2022_KR)
  17. typedef struct _CODEPAGE_MRU
  18. {
  19. DWORD dwEncoding;
  20. DWORD dwHistoryHits;
  21. } CODEPAGE_MRU, *PCODEPAGE_MRU;
  22. typedef struct tagCpPatch
  23. {
  24. UINT srcEncoding;
  25. UINT destEncoding;
  26. UINT nSize;
  27. unsigned char *pszUch;
  28. } CPPATCH;
  29. // Dump everything under
  30. // HKCU\\Software\\Microsoft\\Internet Explorer\\International
  31. #define REGSTR_PATH_CPMRU TSZMICROSOFTPATH TEXT("\\Internet Explorer\\International\\CpMRU")
  32. #define REG_KEY_CPMRU TEXT("Cache")
  33. #define REG_KEY_CPMRU_ENABLE TEXT("Enable")
  34. #define REG_KEY_CPMRU_NUM TEXT("Size")
  35. #define REG_KEY_CPMRU_INIT_HITS TEXT("InitHits")
  36. #define REG_KEY_CPMRU_PERCENTAGE_FACTOR TEXT("Factor")
  37. // CCpMRU
  38. class CCpMRU
  39. {
  40. PCODEPAGE_MRU _pCpMRU;
  41. DWORD dwCpMRUNum;
  42. DWORD dwCpMRUInitHits;
  43. DWORD dwCpMRUFactor;
  44. public:
  45. DWORD dwCpMRUEnable;
  46. BOOL bCpUpdated;
  47. CCpMRU::CCpMRU(void)
  48. {
  49. // No update at initial time
  50. bCpUpdated = FALSE;
  51. _pCpMRU = NULL;
  52. }
  53. ~CCpMRU(void);
  54. HRESULT Init(void);
  55. HRESULT GetCpMRU(PCODEPAGE_MRU pCpMRU, UINT *puiCpNum);
  56. void UpdateCPMRU(DWORD dwEncoding);
  57. };
  58. void RemoveHtmlTags (LPSTR pIn, UINT *pnBytes);
  59. UINT PatchCodePage(UINT uiEncoding, unsigned char *pStr, int nSize);
  60. extern class CCpMRU * g_pCpMRU;
  61. #endif // _CPDETECT_H_