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
3.3 KiB

  1. #include "pch.h"
  2. #include "iedetect.h"
  3. DWORD WINAPI DetectPrimaryLang(DETECTION_STRUCT *pDet, UINT cpID);
  4. DWORD WINAPI DetectLCID(DETECTION_STRUCT *pDet, LCID lcid);
  5. BOOL DetectCicero();
  6. DWORD WINAPI DetectKoreanIME(DETECTION_STRUCT *pDet)
  7. {
  8. if(DetectCicero())
  9. return DET_NEWVERSIONINSTALLED;
  10. else
  11. return DetectLCID(pDet, 1042);
  12. }
  13. DWORD WINAPI DetectJapaneseIME(DETECTION_STRUCT *pDet)
  14. {
  15. if (DetectCicero())
  16. return DET_NEWVERSIONINSTALLED;
  17. else
  18. return DetectLCID(pDet, 1041);
  19. }
  20. DWORD WINAPI DetectTraditionalChineseIME(DETECTION_STRUCT *pDet)
  21. {
  22. if (DetectCicero())
  23. return DET_NEWVERSIONINSTALLED;
  24. else
  25. return DetectLCID(pDet, 1028);
  26. }
  27. DWORD WINAPI DetectSimplifiedChineseIME(DETECTION_STRUCT *pDet)
  28. {
  29. if (DetectCicero())
  30. return DET_NEWVERSIONINSTALLED;
  31. else
  32. return DetectLCID(pDet, 2052);
  33. }
  34. // Returns true if msctf.dll is installed on system
  35. BOOL DetectCicero()
  36. {
  37. char szFile[MAX_PATH] = {0};
  38. char szRenameFile[MAX_PATH] = {0};
  39. DWORD dwInstalledVer, dwInstalledBuild;
  40. GetSystemDirectory(szFile, sizeof(szFile));
  41. AddPath(szFile, "msctf.dll");
  42. ReadFromWininitOrPFRO(szFile, szRenameFile);
  43. if (*szRenameFile != '\0')
  44. GetVersionFromFile(szRenameFile, &dwInstalledVer, &dwInstalledBuild, TRUE);
  45. else
  46. GetVersionFromFile(szFile, &dwInstalledVer, &dwInstalledBuild, TRUE);
  47. return (dwInstalledVer != 0);
  48. }
  49. DWORD WINAPI DetectLCID(DETECTION_STRUCT *pDet, LCID lcid)
  50. {
  51. DWORD dwRet = DET_NOTINSTALLED;
  52. DWORD dwInstalledVer, dwInstalledBuild;
  53. dwInstalledVer = dwInstalledBuild = (DWORD)-1;
  54. if (GetSystemDefaultLCID() == lcid)
  55. {
  56. dwRet = DET_NEWVERSIONINSTALLED;
  57. }
  58. else
  59. {
  60. if (GetVersionFromGuid(pDet->pszGUID, &dwInstalledVer, &dwInstalledBuild))
  61. dwRet = CompareVersions(pDet->dwAskVer, pDet->dwAskBuild, dwInstalledVer, dwInstalledBuild);
  62. }
  63. if (pDet->pdwInstalledVer && pDet->pdwInstalledBuild)
  64. {
  65. *(pDet->pdwInstalledVer) = dwInstalledVer;
  66. *(pDet->pdwInstalledBuild) = dwInstalledBuild;
  67. }
  68. return dwRet;
  69. }
  70. DWORD WINAPI DetectKoreanLangPack(DETECTION_STRUCT *pDet)
  71. {
  72. return DetectPrimaryLang(pDet, 949);
  73. }
  74. DWORD WINAPI DetectJapaneseLangPack(DETECTION_STRUCT *pDet)
  75. {
  76. return DetectPrimaryLang(pDet, 932);
  77. }
  78. DWORD WINAPI DetectSimpChineseLangPack(DETECTION_STRUCT *pDet)
  79. {
  80. return DetectPrimaryLang(pDet, 936);
  81. }
  82. DWORD WINAPI DetectTradChineseLangPack(DETECTION_STRUCT *pDet)
  83. {
  84. return DetectPrimaryLang(pDet, 950);
  85. }
  86. DWORD WINAPI DetectPrimaryLang(DETECTION_STRUCT *pDet, UINT cpID)
  87. {
  88. DWORD dwRet = DET_NOTINSTALLED;
  89. DWORD dwInstalledVer, dwInstalledBuild;
  90. dwInstalledVer = dwInstalledBuild = (DWORD)-1;
  91. if (GetACP() == cpID)
  92. {
  93. dwRet = DET_NEWVERSIONINSTALLED;
  94. }
  95. else
  96. {
  97. if (GetVersionFromGuid(pDet->pszGUID, &dwInstalledVer, &dwInstalledBuild))
  98. dwRet = CompareVersions(pDet->dwAskVer, pDet->dwAskBuild, dwInstalledVer, dwInstalledBuild);
  99. }
  100. if (pDet->pdwInstalledVer && pDet->pdwInstalledBuild)
  101. {
  102. *(pDet->pdwInstalledVer) = dwInstalledVer;
  103. *(pDet->pdwInstalledBuild) = dwInstalledBuild;
  104. }
  105. return dwRet;
  106. }