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.

217 lines
5.1 KiB

  1. //
  2. // internat.h
  3. //
  4. #ifndef INTERNAT_H
  5. #define INTERNAT_H
  6. #include "private.h"
  7. #include "commctrl.h"
  8. #include "regsvr.h"
  9. #include "inatlib.h"
  10. #include "cregkey.h"
  11. void UninitINAT();
  12. //-----------------------------------------------------------------------------
  13. //
  14. // INTERNAT Icon APIs
  15. //
  16. //-----------------------------------------------------------------------------
  17. //
  18. // For Keyboard Layout info. NT4
  19. //
  20. typedef struct
  21. {
  22. DWORD dwID; // numeric id
  23. UINT iSpecialID; // i.e. 0xf001 for dvorak etc
  24. WCHAR wszText[64];
  25. } LAYOUT, *LPLAYOUT;
  26. typedef struct
  27. {
  28. UINT idx ;
  29. char chars[4];
  30. } INATSYMBOL;
  31. int GetLocaleInfoString(LCID lcid, LCTYPE lcType, char *psz, int cch);
  32. ULONG GetLocaleInfoString(HKL hKL, WCHAR *pszRegText, int nSize);
  33. int GetHKLDesctription(HKL hKL, WCHAR *pszDesc, int cchDesc, WCHAR *pszIMEFile, int cchIMEFile);
  34. HICON InatCreateIcon(WORD langID );
  35. HICON InatCreateIconBySize(WORD langID, int cxSmIcon, int cySmIcon, LOGFONT *plf);
  36. HICON GetIconFromFile(int cx, int cy, WCHAR *lpszFileName, UINT uIconIndex);
  37. HICON GetIconFromFileA(int cx, int cy, char *lpszFileName, UINT uIconIndex);
  38. //-----------------------------------------------------------------------------
  39. //
  40. // MLNGINFO APIs
  41. //
  42. //-----------------------------------------------------------------------------
  43. typedef struct
  44. {
  45. HKL hKL;
  46. BOOL fInitDesc;
  47. BOOL fInitIcon;
  48. void SetDesc(WCHAR *psz)
  49. {
  50. StringCchCopyW(szDesc, ARRAYSIZE(szDesc), psz);
  51. }
  52. WCHAR *GetDesc()
  53. {
  54. if (!fInitDesc)
  55. InitDesc();
  56. return szDesc;
  57. }
  58. int GetIconIndex()
  59. {
  60. if (!fInitIcon)
  61. InitIcon();
  62. return nIconIndex;
  63. }
  64. void ClearIconIndex()
  65. {
  66. fInitIcon = FALSE;
  67. nIconIndex = -1;
  68. }
  69. void InitDesc();
  70. void InitIcon();
  71. private:
  72. int nIconIndex;
  73. WCHAR szDesc[128];
  74. } MLNGINFO;
  75. HIMAGELIST GetMlngImageList();
  76. BOOL GetMlngInfo(int n, MLNGINFO *pmlInfo);
  77. int GetMlngInfoByhKL(HKL hKL, MLNGINFO *pmlInfo);
  78. void ClearMlngIconIndex();
  79. //-----------------------------------------------------------------------------
  80. //
  81. // IconList APIs
  82. //
  83. //-----------------------------------------------------------------------------
  84. BOOL EnsureIconImageList();
  85. UINT InatAddIcon(HICON hIcon);
  86. BOOL InatGetIconSize(int *pcx, int *pcy);
  87. BOOL InatGetImageCount();
  88. void InatRemoveAll();
  89. //-----------------------------------------------------------------------------
  90. //
  91. // HKLAPIs
  92. //
  93. //-----------------------------------------------------------------------------
  94. HKL GetSystemDefaultHKL();
  95. BOOL SetSystemDefaultHKL(HKL hKL);
  96. UINT GetPreloadListForNT(DWORD *pdw, UINT uBufSize);
  97. DWORD GetSubstitute(HKL hKL);
  98. #ifdef LATER_TO_CHECK_DUMMYHKL
  99. void RemoveFEDummyHKLFromPreloadReg(HKL hkl, BOOL fDefaultUser);
  100. void RemoveFEDummyHKLs();
  101. #endif LATER_TO_CHECK_DUMMYHKL
  102. /////////////////////////////////////////////////////////////////////////////
  103. //
  104. // CRegUIName
  105. //
  106. /////////////////////////////////////////////////////////////////////////////
  107. class CRegKeyMUI : public CMyRegKey
  108. {
  109. public:
  110. LONG QueryValueCch(LPTSTR szValue, LPCTSTR lpszValueName, ULONG cchValue)
  111. {
  112. LONG lRes;
  113. LPTSTR lpValue;
  114. DWORD index;
  115. WCHAR szTmpW[MAX_PATH];
  116. lRes = CMyRegKey::QueryValueCch(szValue, lpszValueName, cchValue);
  117. if (lRes != S_OK || szValue[0] != '@')
  118. return lRes;
  119. lpValue = szValue;
  120. index = 0;
  121. while (*lpValue != '\0' && index < cchValue)
  122. {
  123. if (*lpValue == ',')
  124. {
  125. lRes = SHLoadRegUIStringW(m_hKey, AtoW(lpszValueName), szTmpW, ARRAYSIZE(szTmpW));
  126. StringCchCopy(szValue, cchValue, WtoA(szTmpW, ARRAYSIZE(szTmpW)));
  127. break;
  128. }
  129. lpValue++;
  130. index++;
  131. }
  132. return lRes;
  133. }
  134. LONG QueryValueCchW(WCHAR *szValue, const WCHAR *lpszValueName, ULONG cchValue)
  135. {
  136. LONG lRes;
  137. LPWSTR lpValue;
  138. DWORD index;
  139. lRes = CMyRegKey::QueryValueCchW(szValue, lpszValueName, cchValue);
  140. if (lRes != S_OK || szValue[0] != L'@')
  141. return lRes;
  142. lpValue = szValue;
  143. index = 0;
  144. while (*lpValue && index < cchValue)
  145. {
  146. if (*lpValue == L',')
  147. {
  148. lRes = SHLoadRegUIStringW(m_hKey, lpszValueName, szValue, cchValue);
  149. break;
  150. }
  151. lpValue++;
  152. index++;
  153. }
  154. return lRes;
  155. }
  156. LONG QueryMUIValueW(WCHAR *szValue, const WCHAR *lpszValueName, const WCHAR *lpszMUIName, ULONG cchValue)
  157. {
  158. LONG lRes;
  159. lRes = SHLoadRegUIStringW(m_hKey, lpszMUIName, szValue, cchValue);
  160. if (lRes == S_OK)
  161. {
  162. return lRes;
  163. }
  164. else
  165. {
  166. return CMyRegKey::QueryValueCchW(szValue, lpszValueName, cchValue);
  167. }
  168. }
  169. };
  170. #endif // INTERNAT_H