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.

504 lines
15 KiB

  1. /*++
  2. Copyright (c) 1994-2000, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. intl.h
  5. Abstract:
  6. This module contains the header information for the Regional Options
  7. applet.
  8. Revision History:
  9. --*/
  10. #ifndef _INTL_H_
  11. #define _INTL_H_
  12. //
  13. // Include Files.
  14. //
  15. #include <windows.h>
  16. #include <prsht.h>
  17. #include <prshtp.h>
  18. #include <shellapi.h>
  19. #include <setupapi.h>
  20. #include <winnls.h>
  21. #include "intlid.h"
  22. #include "util.h"
  23. #include <shlwapi.h>
  24. //
  25. // Enumeration
  26. //
  27. enum LANGCOLLECTION{
  28. BASIC_COLLECTION,
  29. COMPLEX_COLLECTION,
  30. CJK_COLLECTION,
  31. };
  32. //
  33. // Constant Declarations.
  34. //
  35. #define RMI_PRIMARY (0x1) // this should win in event of conflict
  36. #define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0]))
  37. #define US_LOCALE (MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US))
  38. #define LANG_SPANISH_TRADITIONAL (MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH))
  39. #define LANG_SPANISH_INTL (MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN))
  40. #define LCID_SPANISH_TRADITIONAL (MAKELCID(LANG_SPANISH_TRADITIONAL, SORT_DEFAULT))
  41. #define LCID_SPANISH_INTL (MAKELCID(LANG_SPANISH_INTL, SORT_DEFAULT))
  42. #define ML_ORIG_INSTALLED 0x0001
  43. #define ML_PERMANENT 0x0002
  44. #define ML_INSTALL 0x0004
  45. #define ML_REMOVE 0x0008
  46. #define ML_DEFAULT 0x0010
  47. #define ML_DISABLE 0x0020
  48. #define ML_STATIC (ML_PERMANENT | ML_DEFAULT | ML_DISABLE)
  49. //
  50. // Used in string and other array declarations.
  51. //
  52. #define cInt_Str 10 // length of the array of int strings
  53. #define SIZE_64 64 // frequently used buffer size
  54. #define SIZE_128 128 // frequently used buffer size
  55. #define SIZE_300 300 // frequently used buffer size
  56. #define MAX_SAMPLE_SIZE 100 // limit on Sample text for display
  57. //
  58. // For the indicator on the tray.
  59. //
  60. #define IDM_NEWSHELL 249
  61. //
  62. // Character constants.
  63. //
  64. #define CHAR_SML_D TEXT('d')
  65. #define CHAR_CAP_M TEXT('M')
  66. #define CHAR_SML_Y TEXT('y')
  67. #define CHAR_SML_G TEXT('g')
  68. #define CHAR_SML_H TEXT('h')
  69. #define CHAR_CAP_H TEXT('H')
  70. #define CHAR_SML_M TEXT('m')
  71. #define CHAR_SML_S TEXT('s')
  72. #define CHAR_SML_T TEXT('t')
  73. #define CHAR_NULL TEXT('\0')
  74. #define CHAR_QUOTE TEXT('\'')
  75. #define CHAR_SPACE TEXT(' ')
  76. #define CHAR_COMMA TEXT(',')
  77. #define CHAR_SEMICOLON TEXT(';')
  78. #define CHAR_COLON TEXT(':')
  79. #define CHAR_STAR TEXT('*')
  80. #define CHAR_HYPHEN TEXT('-')
  81. #define CHAR_DECIMAL TEXT('.')
  82. #define CHAR_INTL_CURRENCY TEXT('�')
  83. #define CHAR_GRAVE TEXT('`')
  84. #define CHAR_ZERO TEXT('0')
  85. #define CHAR_NINE TEXT('9')
  86. //
  87. // Setup command line switch values.
  88. //
  89. #define SETUP_SWITCH_NONE 0x0000
  90. #define SETUP_SWITCH_R 0x0001
  91. #define SETUP_SWITCH_I 0x0002
  92. #define SETUP_SWITCH_S 0x0004
  93. //
  94. // Flags to assist in updating property sheet pages once the regional locale
  95. // setting has changed. As pages are updated, their process flag value is
  96. // deleted from the Verified_Regional_Chg variable.
  97. //
  98. #define INTL_ALL_CHG 0x00ff // change affects all pages
  99. #define INTL_CHG 0x001f // change affects customize pages
  100. #define Process_Num 0x0001 // number page not yet updated
  101. #define Process_Curr 0x0002 // currency page not yet updated
  102. #define Process_Time 0x0004 // time page not yet updated
  103. #define Process_Date 0x0008 // date page not yet updated
  104. #define Process_Sorting 0x0010 // sorting page not yet updated
  105. #define Process_Regional 0x0020 // regional options page not yet updated
  106. #define Process_Advanced 0x0040 // advanced page not yet updated
  107. #define Process_Languages 0x0080 // languages page not yet updated
  108. //
  109. // Each of these change flags will be used to update the appropriate property
  110. // sheet pages change word when their associated combobox notifies the
  111. // property sheet of a change. The change values are used to determine which
  112. // locale settings must be updated.
  113. //
  114. //
  115. // Region Change.
  116. //
  117. #define RC_EverChg 0x0001
  118. #define RC_UserRegion 0x0002
  119. #define RC_UserLocale 0x0004
  120. //
  121. // Advanced Change
  122. //
  123. #define AD_EverChg 0x0001
  124. #define AD_SystemLocale 0x0002
  125. #define AD_CodePages 0x0004
  126. #define AD_DefaultUser 0x0008
  127. //
  128. // Number Change.
  129. //
  130. #define NC_EverChg 0x0001
  131. #define NC_DSymbol 0x0002
  132. #define NC_NSign 0x0004
  133. #define NC_SList 0x0008
  134. #define NC_SThousand 0x0010
  135. #define NC_IDigits 0x0020
  136. #define NC_DGroup 0x0040
  137. #define NC_LZero 0x0080
  138. #define NC_NegFmt 0x0100
  139. #define NC_Measure 0x0200
  140. #define NC_NativeDigits 0x0400
  141. #define NC_DigitSubst 0x0800
  142. //
  143. // Currency Change.
  144. //
  145. #define CC_EverChg 0x0001
  146. #define CC_SCurrency 0x0002
  147. #define CC_CurrSymPos 0x0004
  148. #define CC_NegCurrFmt 0x0008
  149. #define CC_SMonDec 0x0010
  150. #define CC_ICurrDigits 0x0020
  151. #define CC_SMonThousand 0x0040
  152. #define CC_DMonGroup 0x0080
  153. //
  154. // Time Change.
  155. //
  156. #define TC_EverChg 0x0001
  157. #define TC_1159 0x0002
  158. #define TC_2359 0x0004
  159. #define TC_STime 0x0008
  160. #define TC_TimeFmt 0x0010
  161. #define TC_AllChg 0x001F
  162. #define TC_FullTime 0x0031
  163. //
  164. // Date Change.
  165. //
  166. #define DC_EverChg 0x0001
  167. #define DC_ShortFmt 0x0002
  168. #define DC_LongFmt 0x0004
  169. #define DC_SDate 0x0008
  170. #define DC_Calendar 0x0010
  171. #define DC_Arabic_Calendar 0x0020
  172. #define DC_TwoDigitYearMax 0x0040
  173. //
  174. // Sorting Change.
  175. //
  176. #define SC_EverChg 0x0001
  177. #define SC_Sorting 0x0002
  178. //
  179. // Language Change
  180. //
  181. #define LG_EverChg 0x0001
  182. #define LG_UILanguage 0x0002
  183. #define LG_Change 0x0004
  184. #define LG_Complex 0x0008
  185. #define LG_CJK 0x0010
  186. //
  187. // Global Variables.
  188. // Data that is shared betweeen the property sheets.
  189. //
  190. extern BOOL g_bCDROM; // if setup from a CD-ROM
  191. extern BOOL g_bAdmin_Privileges; // Admin privileges
  192. extern DWORD g_dwLastSorting; // index of last sorting setting in combo box
  193. extern DWORD g_dwCurSorting; // index of current sorting setting in combo box
  194. extern BOOL g_bCustomize; // in customize mode or second level tabs
  195. extern DWORD g_dwCustChange; // change made at the second level
  196. extern BOOL g_bDefaultUser; // in default user settings
  197. extern BOOL g_bShowSortingTab; // show the sorting tab or not
  198. extern BOOL g_bInstallComplex; // Complex scripts language groups installation requested
  199. extern BOOL g_bInstallCJK; // CJK language groups installation requested
  200. extern TCHAR aInt_Str[cInt_Str][3]; // cInt_Str # of elements of int strings
  201. extern TCHAR szSample_Number[]; // used for currency and number samples
  202. extern TCHAR szNegSample_Number[]; // used for currency and number samples
  203. extern TCHAR szTimeChars[]; // valid time characters
  204. extern TCHAR szTCaseSwap[]; // invalid time chars to change case => valid
  205. extern TCHAR szTLetters[]; // time NLS chars
  206. extern TCHAR szSDateChars[]; // valid short date characters
  207. extern TCHAR szSDCaseSwap[]; // invalid SDate chars to change case => valid
  208. extern TCHAR szSDLetters[]; // short date NLS chars
  209. extern TCHAR szLDateChars[]; // valid long date characters
  210. extern TCHAR szLDCaseSwap[]; // invalid LDate chars to change case => valid
  211. extern TCHAR szLDLetters[]; // long date NLS chars
  212. extern TCHAR szStyleH[]; // date and time style H equivalent
  213. extern TCHAR szStyleh[]; // date and time style h equivalent
  214. extern TCHAR szStyleM[]; // date and time style M equivalent
  215. extern TCHAR szStylem[]; // date and time style m equivalent
  216. extern TCHAR szStyles[]; // date and time style s equivalent
  217. extern TCHAR szStylet[]; // date and time style t equivalent
  218. extern TCHAR szStyled[]; // date and time style d equivalent
  219. extern TCHAR szStyley[]; // date and time style y equivalent
  220. extern TCHAR szLocaleGetError[]; // shared locale info get error
  221. extern TCHAR szIntl[]; // intl string
  222. extern TCHAR szInvalidSDate[]; // invalid chars for date separator
  223. extern TCHAR szInvalidSTime[]; // invalid chars for time separator
  224. extern HINSTANCE hInstance; // library instance
  225. extern int Verified_Regional_Chg; // used to determine when to verify
  226. // regional changes in all prop sheet pgs
  227. extern int RegionalChgState; // used to determine when a page have changed
  228. extern BOOL Styles_Localized; // indicate whether or not style must be
  229. // translated between NLS and local formats
  230. extern LCID UserLocaleID; // user locale
  231. extern LCID SysLocaleID; // system locale
  232. extern LCID RegUserLocaleID; // user locale stored in the registry
  233. extern LCID RegSysLocaleID; // system locale stored in the registry
  234. extern BOOL bShowRtL; // indicate if RTL date samples should be shown
  235. extern BOOL bShowArabic; // indicate if the other Arabic specific stuff should be shown
  236. extern BOOL bHebrewUI; // indicate if the UI language is Hebrew
  237. extern BOOL bLPKInstalled; // if LPK is installed
  238. extern TCHAR szSetupSourcePath[]; // buffer to hold setup source string
  239. extern LPTSTR pSetupSourcePath; // pointer to setup source string buffer
  240. extern TCHAR szSetupSourcePathWithArchitecture[]; // buffer to hold setup source string with architecture-specific extension.
  241. extern LPTSTR pSetupSourcePathWithArchitecture; // pointer to setup source string buffer with architecture-specific extension.
  242. //
  243. // Global Variables.
  244. //
  245. static TCHAR szLayoutPath[] = TEXT("SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts");
  246. static TCHAR szKbdPreloadKey[] = TEXT("Keyboard Layout\\Preload");
  247. static TCHAR szKbdSubstKey[] = TEXT("Keyboard Layout\\Substitutes");
  248. static TCHAR szKbdToggleKey[] = TEXT("Keyboard Layout\\Toggle");
  249. static TCHAR szKbdPreloadKey_DefUser[] = TEXT(".DEFAULT\\Keyboard Layout\\Preload");
  250. static TCHAR szKbdSubstKey_DefUser[] = TEXT(".DEFAULT\\Keyboard Layout\\Substitutes");
  251. static TCHAR szKbdToggleKey_DefUser[] = TEXT(".DEFAULT\\Keyboard Layout\\Toggle");
  252. static TCHAR szInternat[] = TEXT("internat.exe");
  253. static char szInternatA[] = "internat.exe";
  254. extern int g_bSetupCase; // See Intl_IsSetupMode for info on possible values
  255. extern BOOL g_bLog;
  256. extern BOOL g_bProgressBarDisplay;
  257. extern BOOL g_bDisableSetupDialog;
  258. extern BOOL g_bSettingsChanged;
  259. extern BOOL g_bUnttendMode;
  260. extern BOOL g_bMatchUIFont;
  261. extern const TCHAR c_szInstalledLocales[];
  262. extern const TCHAR c_szLanguageGroups[];
  263. extern const TCHAR c_szLIPInstalled[];
  264. extern const TCHAR c_szMUILanguages[];
  265. extern const TCHAR c_szFontSubstitute[];
  266. extern const TCHAR c_szGreFontInitialize[];
  267. extern const TCHAR c_szSetupKey[];
  268. extern const TCHAR c_szCPanelIntl[];
  269. extern const TCHAR c_szCPanelIntl_DefUser[];
  270. extern const TCHAR c_szCtfmon[];
  271. extern const TCHAR c_szCtfmon_DefUser[];
  272. extern const TCHAR c_szCPanelDesktop[];
  273. extern const TCHAR c_szCPanelDesktop_DefUser[];
  274. extern const TCHAR c_szKbdLayouts[];
  275. extern const TCHAR c_szKbdLayouts_DefUser[];
  276. extern const TCHAR c_szInputMethod[];
  277. extern const TCHAR c_szInputMethod_DefUser[];
  278. extern const TCHAR c_szInputTips[];
  279. extern const TCHAR c_szInputTips_DefUser[];
  280. extern const TCHAR c_szMUIPolicyKeyPath[];
  281. extern const TCHAR c_szMUIValue[];
  282. extern const TCHAR c_szIntlRun[];
  283. extern const TCHAR c_szSysocmgr[];
  284. extern TCHAR szIntlInf[];
  285. extern TCHAR szHelpFile[];
  286. extern TCHAR szFontSubstitute[];
  287. extern TCHAR szLocaleListPrefix[];
  288. extern TCHAR szLGBasicInstall[];
  289. extern TCHAR szLGComplexInstall[];
  290. extern TCHAR szLGComplexRemove[];
  291. extern TCHAR szLGExtInstall[];
  292. extern TCHAR szLGExtRemove[];
  293. extern TCHAR szCPInstallPrefix[];
  294. extern TCHAR szCPRemovePrefix[];
  295. extern TCHAR szKbdLayoutIds[];
  296. extern TCHAR szInputLibrary[]; // Name of the library that contain the text input dlg
  297. extern TCHAR szUIFontSubstitute[];
  298. extern TCHAR szSetupInProgress[];
  299. extern TCHAR szMiniSetupInProgress[];
  300. extern TCHAR szSetupUpgrade[];
  301. extern TCHAR szMultiUILanguageId[];
  302. extern TCHAR szMUILangPending[];
  303. extern TCHAR szCtfmonValue[];
  304. extern TCHAR szRegionalSettings[];
  305. extern TCHAR szLanguageGroup[];
  306. extern TCHAR szLanguage[];
  307. extern TCHAR szSystemLocale[];
  308. extern TCHAR szUserLocale[];
  309. extern TCHAR szInputLocale[];
  310. extern TCHAR szMUILanguage[];
  311. extern TCHAR szUserLocale_DefUser[];
  312. extern TCHAR szInputLocale_DefUser[];
  313. extern TCHAR szMUILanguage_DefUSer[];
  314. extern HINF g_hIntlInf;
  315. extern LPLANGUAGEGROUP pLanguageGroups;
  316. extern LPCODEPAGE pCodePages;
  317. extern int g_NumAltSorts;
  318. extern HANDLE hAltSorts;
  319. extern LPDWORD pAltSorts;
  320. extern HINSTANCE hInputDLL;
  321. extern BOOL (*pfnInstallInputLayout)(LCID, DWORD, BOOL, HKL, BOOL, BOOL);
  322. extern BOOL (*pfnUninstallInputLayout)(LCID, DWORD, BOOL);
  323. //
  324. // Language group of UI languages.
  325. //
  326. extern UILANGUAGEGROUP UILangGroup;
  327. //
  328. // Function Prototypes.
  329. //
  330. //
  331. // Callback functions for each of the propety sheet pages.
  332. //
  333. INT_PTR CALLBACK
  334. GeneralDlgProc(
  335. HWND hDlg,
  336. UINT message,
  337. WPARAM wParam,
  338. LPARAM lParam);
  339. INT_PTR CALLBACK
  340. InputLocaleDlgProc(
  341. HWND hDlg,
  342. UINT message,
  343. WPARAM wParam,
  344. LPARAM lParam);
  345. INT_PTR CALLBACK
  346. LanguageDlgProc(
  347. HWND hDlg,
  348. UINT message,
  349. WPARAM wParam,
  350. LPARAM lParam);
  351. INT_PTR CALLBACK
  352. AdvancedDlgProc(
  353. HWND hDlg,
  354. UINT message,
  355. WPARAM wParam,
  356. LPARAM lParam);
  357. INT_PTR CALLBACK
  358. NumberDlgProc(
  359. HWND hDlg,
  360. UINT message,
  361. WPARAM wParam,
  362. LPARAM lParam);
  363. INT_PTR CALLBACK
  364. CurrencyDlgProc(
  365. HWND hDlg,
  366. UINT message,
  367. WPARAM wParam,
  368. LPARAM lParam);
  369. INT_PTR CALLBACK
  370. TimeDlgProc(
  371. HWND hDlg,
  372. UINT message,
  373. WPARAM wParam,
  374. LPARAM lParam);
  375. INT_PTR CALLBACK
  376. DateDlgProc(
  377. HWND hDlg,
  378. UINT message,
  379. WPARAM wParam,
  380. LPARAM lParam);
  381. INT_PTR CALLBACK
  382. SortingDlgProc(
  383. HWND hDlg,
  384. UINT message,
  385. WPARAM wParam,
  386. LPARAM lParam);
  387. //
  388. // In regdlg.c.
  389. //
  390. void
  391. Region_UpdateShortDate(VOID);
  392. void
  393. Region_DoUnattendModeSetup(
  394. LPCTSTR pUnattendFile);
  395. //
  396. // In intl.c.
  397. //
  398. BOOL
  399. IsRtLLocale(
  400. LCID iLCID);
  401. //
  402. // Restore functions.
  403. //
  404. void
  405. Date_RestoreValues();
  406. void
  407. Currency_RestoreValues();
  408. void
  409. Time_RestoreValues();
  410. void
  411. Number_RestoreValues();
  412. void
  413. Sorting_RestoreValues();
  414. #endif //_INTL_H_