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.

85 lines
2.6 KiB

  1. //-------------------------------------------------------------------------
  2. //
  3. // Microsoft OLE
  4. // Copyright (C) Microsoft Corporation, 1995 - 1997.
  5. //
  6. // File: dbcs.hxx
  7. //
  8. // Contents: Contains DBCS string generator definition and identifiers
  9. //
  10. // History: 03-Nov-97 BogdanT Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #ifndef __DBCS_HXX__
  14. #define __DBCS_HXX__
  15. #include <locale.h>
  16. //+--------------------------------------------------------------------------
  17. //
  18. // Class: CDBCSStringGen
  19. //
  20. // Synopsis: DBCS string generator
  21. //
  22. // History: 03-Nov-97 BogdanT Created
  23. //
  24. //---------------------------------------------------------------------------
  25. #define MAX_LINE_SIZE 5*_MAX_FNAME+10 // names are represented in hex, each
  26. // character is separated by ",", ie
  27. // maximum 5 chars per character plus
  28. // some extra space for \n and \0
  29. #define CP_JPN 932
  30. #define CP_CHS 936
  31. #define CP_KOR 949
  32. #define CP_CHT 950
  33. #define NAMEFILE_JPN TEXT("namelist.jpn")
  34. #define NAMEFILE_CHS TEXT("namelist.chs")
  35. #define NAMEFILE_KOR TEXT("namelist.kor")
  36. #define NAMEFILE_CHT TEXT("namelist.cht")
  37. class CDBCSStringGen
  38. {
  39. public:
  40. CDBCSStringGen();
  41. ~CDBCSStringGen();
  42. HRESULT Init(DWORD dwSeed);
  43. UINT GetNameCount() {return m_cFileNames;};
  44. HRESULT GenerateRandomFileName(LPTSTR *pptszName);
  45. HRESULT GenerateRandomFileName(LPTSTR *,
  46. UINT, //minlen
  47. UINT) //maxlen
  48. { return E_NOTIMPL; }
  49. BOOL SystemIsDBCS() {return m_fSystemIsDBCS;};
  50. protected:
  51. UINT CountNamesInFile();
  52. HRESULT GetFileNameFromFile(UINT nIndex, LPSTR lpDest);
  53. protected:
  54. UINT m_uCodePage; // current ANSI code page
  55. //
  56. // DBCS possible values: 932: Japanese
  57. // 936: Chinese (Rep. of China)
  58. // 949: Korean
  59. // 936: Chinese (Taiwan)
  60. LPTSTR m_ptszDataFile; // file containing DBCS filenames
  61. FILE *m_hDataFile;
  62. BOOL m_fSystemIsDBCS; // true if we're in a DBCS environment
  63. UINT m_cFileNames; // number of filenames in the data file
  64. DG_INTEGER *m_pdgi;
  65. };
  66. #endif //__DBCS_HXX__