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.

526 lines
8.6 KiB

  1. /*++
  2. Copyright (c) 1994-2000, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. util.h
  5. Abstract:
  6. This module contains the header information for the utility functions
  7. of the Regional Options applet.
  8. Revision History:
  9. --*/
  10. #ifndef _UTIL_H_
  11. #define _UTIL_H_
  12. //
  13. // Include Files.
  14. //
  15. #include "intl.h"
  16. //
  17. // Constant Declarations.
  18. //
  19. #define MB_OK_OOPS (MB_OK | MB_ICONEXCLAMATION) // msg box flags
  20. #define MB_YN_OOPS (MB_YESNO | MB_ICONEXCLAMATION) // msg box flags
  21. #define MAX_UI_LANG_GROUPS 64
  22. //
  23. // Global Variables.
  24. //
  25. //
  26. // Typedef Declarations.
  27. //
  28. typedef struct
  29. {
  30. LPARAM Changes; // flags to denote changes
  31. DWORD dwCurUserLocale; // index of current user locale setting in combo box
  32. DWORD dwCurUserRegion; // index of current user region setting in combo box
  33. DWORD dwCurUILang; // index of current UI Language setting in combo box
  34. DWORD dwLastUserLocale; // index of the last user locale setting in combo box
  35. } REGDLGDATA, *LPREGDLGDATA;
  36. typedef struct languagegroup_s
  37. {
  38. WORD wStatus; // status flags
  39. UINT LanguageGroup; // language group value
  40. DWORD LanguageCollection; // collection which belong the language group
  41. HANDLE hLanguageGroup; // handle to free for this structure
  42. TCHAR pszName[MAX_PATH]; // name of language group
  43. UINT NumLocales; // number of locales in pLocaleList
  44. LCID pLocaleList[MAX_PATH]; // ptr to locale list for this group
  45. UINT NumAltSorts; // number of alternate sorts in pAltSortList
  46. LCID pAltSortList[MAX_PATH]; // ptr to alternate sorts for this group
  47. struct languagegroup_s *pNext; // ptr to next language group node
  48. } LANGUAGEGROUP, *LPLANGUAGEGROUP;
  49. typedef struct codepage_s
  50. {
  51. WORD wStatus; // status flags
  52. UINT CodePage; // code page value
  53. HANDLE hCodePage; // handle to free for this structure
  54. TCHAR pszName[MAX_PATH]; // name of code page
  55. struct codepage_s *pNext; // ptr to next code page node
  56. } CODEPAGE, *LPCODEPAGE;
  57. //
  58. // Language group of UI languages.
  59. //
  60. typedef struct
  61. {
  62. int iCount;
  63. LGRPID lgrp[MAX_UI_LANG_GROUPS];
  64. } UILANGUAGEGROUP, *PUILANGUAGEGROUP;
  65. //
  66. // Functions Prototypes.
  67. //
  68. LONG
  69. Intl_StrToLong(
  70. LPTSTR szNum);
  71. DWORD
  72. TransNum(
  73. LPTSTR lpsz);
  74. BOOL
  75. Item_Has_Digits(
  76. HWND hDlg,
  77. int nItemId,
  78. BOOL Allow_Empty);
  79. BOOL
  80. Item_Has_Digits_Or_Invalid_Chars(
  81. HWND hDlg,
  82. int nItemId,
  83. BOOL Allow_Empty,
  84. LPTSTR pInvalid);
  85. BOOL
  86. Item_Check_Invalid_Chars(
  87. HWND hDlg,
  88. LPTSTR lpszBuf,
  89. LPTSTR lpCkChars,
  90. int nCkIdStr,
  91. BOOL Allow_Empty,
  92. LPTSTR lpChgCase,
  93. int nItemId);
  94. void
  95. No_Numerals_Error(
  96. HWND hDlg,
  97. int nItemId,
  98. int iStrId);
  99. void
  100. Invalid_Chars_Error(
  101. HWND hDlg,
  102. int nItemId,
  103. int iStrId);
  104. void
  105. Localize_Combobox_Styles(
  106. HWND hDlg,
  107. int nItemId,
  108. LCTYPE LCType);
  109. BOOL
  110. NLSize_Style(
  111. HWND hDlg,
  112. int nItemId,
  113. LPTSTR lpszOutBuf,
  114. LCTYPE LCType);
  115. BOOL
  116. Set_Locale_Values(
  117. HWND hDlg,
  118. LCTYPE LCType,
  119. int nItemId,
  120. LPTSTR lpIniStr,
  121. BOOL bValue,
  122. int Ordinal_Offset,
  123. LPTSTR Append_Str,
  124. LPTSTR NLS_Str);
  125. BOOL
  126. Set_List_Values(
  127. HWND hDlg,
  128. int nItemId,
  129. LPTSTR lpValueString);
  130. void
  131. DropDown_Use_Locale_Values(
  132. HWND hDlg,
  133. LCTYPE LCType,
  134. int nItemId);
  135. BOOL CALLBACK
  136. EnumProc(
  137. LPTSTR lpValueString);
  138. BOOL CALLBACK
  139. EnumProcEx(
  140. LPTSTR lpValueString,
  141. LPTSTR lpDecimalString,
  142. LPTSTR lpNegativeString,
  143. LPTSTR lpSymbolString);
  144. typedef BOOL (CALLBACK* LEADINGZEROS_ENUMPROC)(LPTSTR, LPTSTR, LPTSTR, LPTSTR);
  145. typedef BOOL (CALLBACK* NEGNUMFMT_ENUMPROC)(LPTSTR, LPTSTR, LPTSTR, LPTSTR);
  146. typedef BOOL (CALLBACK* MEASURESYSTEM_ENUMPROC)(LPTSTR);
  147. typedef BOOL (CALLBACK* POSCURRENCY_ENUMPROC)(LPTSTR, LPTSTR, LPTSTR, LPTSTR);
  148. typedef BOOL (CALLBACK* NEGCURRENCY_ENUMPROC)(LPTSTR, LPTSTR, LPTSTR, LPTSTR);
  149. BOOL
  150. EnumLeadingZeros(
  151. LEADINGZEROS_ENUMPROC lpLeadingZerosEnumProc,
  152. LCID LCId,
  153. DWORD dwFlags);
  154. BOOL
  155. EnumNegNumFmt(
  156. NEGNUMFMT_ENUMPROC lpNegNumFmtEnumProc,
  157. LCID LCId,
  158. DWORD dwFlags);
  159. BOOL
  160. EnumMeasureSystem(
  161. MEASURESYSTEM_ENUMPROC lpMeasureSystemEnumProc,
  162. LCID LCId,
  163. DWORD dwFlags);
  164. BOOL
  165. EnumPosCurrency(
  166. POSCURRENCY_ENUMPROC lpPosCurrencyEnumProc,
  167. LCID LCId,
  168. DWORD dwFlags);
  169. BOOL
  170. EnumNegCurrency(
  171. NEGCURRENCY_ENUMPROC lpNegCurrencyEnumProc,
  172. LCID LCId,
  173. DWORD dwFlags);
  174. void
  175. CheckEmptyString(
  176. LPTSTR lpStr);
  177. void
  178. SetDlgItemRTL(
  179. HWND hDlg,
  180. UINT uItem);
  181. int
  182. ShowMsg(
  183. HWND hDlg,
  184. UINT iMsg,
  185. UINT iTitle,
  186. UINT iType,
  187. LPTSTR pString);
  188. void
  189. SetControlReadingOrder(
  190. BOOL bUseRightToLeft,
  191. HWND hwnd);
  192. void
  193. Intl_EnumLocales(
  194. HWND hDlg,
  195. HWND hLocale,
  196. BOOL EnumSystemLocales);
  197. BOOL CALLBACK
  198. Intl_EnumInstalledCPProc(
  199. LPTSTR pString);
  200. BOOL
  201. Intl_InstallKeyboardLayout(
  202. HWND hDlg,
  203. LCID Locale,
  204. DWORD Layout,
  205. BOOL bDefaultLayout,
  206. BOOL bDefaultUser,
  207. BOOL bSystemLocale);
  208. BOOL
  209. Intl_InstallKeyboardLayoutList(
  210. PINFCONTEXT pContext,
  211. DWORD dwStartField,
  212. BOOL bDefaultUserCase);
  213. BOOL
  214. Intl_InstallAllKeyboardLayout(
  215. LANGID Language);
  216. BOOL
  217. Intl_UninstallAllKeyboardLayout(
  218. UINT uiLangGp,
  219. BOOL DefaultUserCase);
  220. HKL
  221. Intl_GetHKL(
  222. DWORD dwLocale,
  223. DWORD dwLayout);
  224. BOOL
  225. Intl_GetDefaultLayoutFromInf(
  226. LPDWORD pdwLocale,
  227. LPDWORD pdwLayout);
  228. BOOL
  229. Intl_GetSecondValidLayoutFromInf(
  230. LPDWORD pdwLocale,
  231. LPDWORD pdwLayout);
  232. BOOL
  233. Intl_InitInf(
  234. HWND hDlg,
  235. HINF *phIntlInf,
  236. LPTSTR pszInf,
  237. HSPFILEQ *pFileQueue,
  238. PVOID *pQueueContext);
  239. BOOL
  240. Intl_OpenIntlInfFile(
  241. HINF *phInf);
  242. void
  243. Intl_CloseInf(
  244. HINF hIntlInf,
  245. HSPFILEQ FileQueue,
  246. PVOID QueueContext);
  247. BOOL
  248. Intl_ReadDefaultLayoutFromInf(
  249. LPDWORD pdwLocale,
  250. LPDWORD pdwLayout,
  251. HINF hIntlInf);
  252. BOOL
  253. Intl_ReadSecondValidLayoutFromInf(
  254. LPDWORD pdwLocale,
  255. LPDWORD pdwLayout,
  256. HINF hIntlInf);
  257. BOOL
  258. Intl_CloseInfFile(
  259. HINF *phInf);
  260. BOOL
  261. Intl_IsValidLayout(
  262. DWORD dwLayout);
  263. void
  264. Intl_RunRegApps(
  265. LPCTSTR pszRegKey);
  266. VOID
  267. Intl_RebootTheSystem();
  268. BOOL
  269. Intl_InstallUserLocale(
  270. LCID Locale,
  271. BOOL bDefaultUserCase,
  272. BOOL bChangeLocaleInfo);
  273. void
  274. Intl_SetLocaleInfo(
  275. LCID Locale,
  276. LCTYPE LCType,
  277. LPTSTR lpIniStr,
  278. BOOL bDefaultUserCase);
  279. void
  280. Intl_AddPage(
  281. LPPROPSHEETHEADER ppsh,
  282. UINT id,
  283. DLGPROC pfn,
  284. LPARAM lParam,
  285. UINT iMaxPages);
  286. void
  287. Intl_AddExternalPage(
  288. LPPROPSHEETHEADER ppsh,
  289. UINT id,
  290. HINSTANCE hInst,
  291. LPSTR ProcName,
  292. UINT iMaxPages);
  293. int
  294. Intl_SetDefaultUserLocaleInfo(
  295. LPCTSTR lpKeyName,
  296. LPCTSTR lpString);
  297. void
  298. Intl_DeleteRegKeyValues(
  299. HKEY hKey);
  300. DWORD
  301. Intl_DeleteRegTree(
  302. HKEY hStartKey,
  303. LPTSTR pKeyName);
  304. void
  305. Intl_DeleteRegSubKeys(
  306. HKEY hKey);
  307. DWORD
  308. Intl_CopyRegKeyValues(
  309. HKEY hSrc,
  310. HKEY hDest);
  311. DWORD
  312. Intl_CreateRegTree(
  313. HKEY hSrc,
  314. HKEY hDest);
  315. HKEY
  316. Intl_LoadNtUserHive(
  317. LPCTSTR lpRoot,
  318. LPCTSTR lpKeyName,
  319. BOOLEAN *lpWasEnabled);
  320. void
  321. Intl_UnloadNtUserHive(
  322. LPCTSTR lpRoot,
  323. BOOLEAN *lpWasEnabled);
  324. BOOL
  325. Intl_ChangeUILangForAllUsers(
  326. LANGID UILanguageId);
  327. BOOL
  328. Intl_LoadLanguageGroups(
  329. HWND hDlg);
  330. BOOL
  331. Intl_GetSupportedLanguageGroups();
  332. BOOL
  333. Intl_EnumInstalledLanguageGroups();
  334. BOOL
  335. Intl_LanguageGroupDirExist(
  336. PTSTR pszLangDir);
  337. BOOL
  338. Intl_LanguageGroupFilesExist();
  339. BOOL
  340. Intl_GetLocaleList(
  341. LPLANGUAGEGROUP pLG);
  342. DWORD
  343. Intl_GetLanguageGroup(
  344. LCID lcid);
  345. BOOL
  346. Intl_GetUILanguageGroups(
  347. PUILANGUAGEGROUP pUILanguageGroup);
  348. BOOL
  349. CALLBACK
  350. Intl_EnumUILanguagesProc(
  351. LPWSTR pwszUILanguage,
  352. LONG_PTR lParam);
  353. void
  354. Intl_SaveValuesToDefault(
  355. LPCTSTR srcKey,
  356. LPCTSTR destKey);
  357. void
  358. Intl_SaveValuesToNtUserFile(
  359. HKEY hSourceRegKey,
  360. LPCTSTR srcKey,
  361. LPCTSTR destKey);
  362. DWORD
  363. Intl_DefaultKeyboardLayout();
  364. BOOL
  365. Intl_IsLIP();
  366. BOOL
  367. Intl_IsMUISetupVersionSameAsOS();
  368. BOOL
  369. Intl_IsSetupMode();
  370. BOOL
  371. Intl_IsWinntUpgrade();
  372. BOOL
  373. Intl_IsUIFontSubstitute();
  374. VOID
  375. Intl_ApplyFontSubstitute(LCID SystemLocale);
  376. HANDLE
  377. Intl_OpenLogFile();
  378. BOOL
  379. Intl_LogMessage(
  380. LPCTSTR lpMessage);
  381. void
  382. Intl_LogUnattendFile(
  383. LPCTSTR pFileName);
  384. void
  385. Intl_LogSimpleMessage(
  386. UINT LogId,
  387. LPCTSTR pAppend);
  388. void
  389. Intl_LogFormatMessage(
  390. UINT LogId);
  391. void
  392. Intl_SaveDefaultUserSettings();
  393. BOOL
  394. Intl_SaveDefaultUserInputSettings();
  395. void
  396. Intl_RemoveMUIFile();
  397. void
  398. Intl_CallTextServices();
  399. LANGID
  400. Intl_GetPendingUILanguage();
  401. LANGID
  402. Intl_GetDotDefaultUILanguage();
  403. #endif //_UTIL_H_