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.

125 lines
4.3 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: cht.c
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * FEMGRATE, CHT speciific functions
  7. *
  8. \***************************************************************************/
  9. #include "femgrate.h"
  10. #include "resource.h"
  11. BOOL UpgradeCHTPerUserIMEData()
  12. {
  13. TABLELIST IMETableListCHT[] = {
  14. {IDS_CHT_TABLE1,TEXT("")},
  15. {IDS_CHT_TABLE2,TEXT("")},
  16. {IDS_CHT_TABLE3,TEXT("")},
  17. {IDS_CHT_TABLE4,TEXT("")},
  18. {IDS_CHT_TABLE5,TEXT("")}
  19. };
  20. TCHAR szRegPath[MAX_PATH];
  21. TCHAR szClassPath[MAX_PATH];
  22. int i;
  23. LPTSTR lpszRegPathPtr,lpszClassPtr;
  24. for (i=0; i<sizeof(IMETableListCHT) / sizeof(TABLELIST); i++) {
  25. if (!LoadString(ghInst,IMETableListCHT[i].nResID,IMETableListCHT[i].szIMEName,MAX_PATH)) {
  26. DebugMsg((DM_VERBOSE,TEXT("UpgradeCHTPerUserIMEData, load string failed!\r\n")));
  27. return FALSE;
  28. }
  29. else {
  30. DebugMsg((DM_VERBOSE,TEXT("UpgradeCHTPerUserIMEData, MigrateImeEUDCTables, load string [%s] !\r\n"),IMETableListCHT[i].szIMEName));
  31. }
  32. }
  33. lstrcpy(szRegPath,TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\"));
  34. lpszRegPathPtr = szRegPath+lstrlen(szRegPath);
  35. lstrcpy(szClassPath,TEXT("Microsoft\\IME\\"));
  36. lpszClassPtr = szClassPath+lstrlen(szClassPath);
  37. for (i=0; i<sizeof(IMETableListCHT) / sizeof(TABLELIST); i++) {
  38. lstrcat (szRegPath,IMETableListCHT[i].szIMEName);
  39. lstrcat (szClassPath,IMETableListCHT[i].szIMEName);
  40. if (!MovePerUserIMEData(HKEY_CURRENT_USER,szRegPath,TEXT("User Dictionary"),szClassPath,TEXT(""),TRUE)) {
  41. DebugMsg((DM_VERBOSE,TEXT("[UpgradeCHTPerUserIMEData] MovePerUserIMEData failed ! %s ,%s !\n"),szRegPath,szClassPath));
  42. }
  43. *lpszRegPathPtr = TEXT('\0');
  44. *lpszClassPtr = TEXT('\0');
  45. }
  46. lstrcpy(szRegPath,TEXT("Control Panel\\Input Method"));
  47. lstrcpy(szClassPath,TEXT("Microsoft\\Lctool"));
  48. if (!MovePerUserIMEData(HKEY_CURRENT_USER,szRegPath,TEXT("Phrase Prediction Dictionary"),szClassPath,TEXT(""),TRUE)) {
  49. DebugMsg((DM_VERBOSE,TEXT("[UpgradeCHTPerUserIMEData] MovePerUserIMEData failed ! %s ,%s !\n"),szRegPath,szClassPath));
  50. }
  51. if (!MovePerUserIMEData(HKEY_CURRENT_USER,szRegPath,TEXT("Phrase Prediction Pointer"),szClassPath,TEXT(""),TRUE)) {
  52. DebugMsg((DM_VERBOSE,TEXT("[UpgradeCHTPerUserIMEData] MovePerUserIMEData failed ! %s ,%s !\n"),szRegPath,szClassPath));
  53. }
  54. return TRUE;
  55. }
  56. int WINAPI WinMainCHT(
  57. int nCmd,
  58. HINF hMigrateInf)
  59. {
  60. const UINT nLocale = LOCALE_CHT;
  61. switch(nCmd) {
  62. case FUNC_PatchFEUIFont:
  63. if (FixSchemeProblem(FALSE,hMigrateInf)) {
  64. DebugMsg((DM_VERBOSE,TEXT("FixSchemeProblem OK ! \n")));
  65. }
  66. else {
  67. DebugMsg((DM_VERBOSE,TEXT("FixSchemeProblem Fail ! \n")));
  68. }
  69. break;
  70. case FUNC_PatchInSetup:
  71. if (FixTimeZone(nLocale)) {
  72. DebugMsg((DM_VERBOSE,TEXT("FixTimeZone OK ! \n")));
  73. }
  74. else {
  75. DebugMsg((DM_VERBOSE,TEXT("FixTimeZone failed ! \n")));
  76. }
  77. break;
  78. case FUNC_PatchPreload:
  79. if (PatchPreloadKeyboard(TRUE)) {
  80. DebugMsg((DM_VERBOSE,TEXT("PatchPreloadKeyboard OK ! \n")));
  81. } else {
  82. DebugMsg((DM_VERBOSE,TEXT("PatchPreloadKeyboard Failed ! \n")));
  83. }
  84. break;
  85. case FUNC_PatchInLogon:
  86. if (UpgradeCHTPerUserIMEData()) {
  87. DebugMsg((DM_VERBOSE,TEXT("UpgradeCHTPerUserIMEData OK ! \n")));
  88. } else {
  89. DebugMsg((DM_VERBOSE,TEXT("UpgradeCHTPerUserIMEData Failed ! \n")));
  90. }
  91. if (RenameRegValueName(hMigrateInf,TRUE)) {
  92. DebugMsg((DM_VERBOSE,TEXT("RenameRegValueName OK ! \n")));
  93. } else {
  94. DebugMsg((DM_VERBOSE,TEXT("RenameRegValueName failed ! \n")));
  95. }
  96. break;
  97. case FUNC_PatchTest:
  98. break;
  99. default:
  100. DebugMsg((DM_VERBOSE,TEXT("No such function\n")));
  101. }
  102. return (0);
  103. }