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.

151 lines
3.8 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: cmakver.cpp
  4. //
  5. // Module: CMSETUP.LIB
  6. //
  7. // Synopsis: Implementation of CmakVersion, a utility class that is used to
  8. // detect the version of the Connection Mananger Administration Kit
  9. // that is installed.
  10. //
  11. // Copyright (c) 1998-1999 Microsoft Corporation
  12. //
  13. // Author: quintinb Created 09/14/98
  14. //
  15. //+----------------------------------------------------------------------------
  16. #include "cmsetup.h"
  17. #include "cmakreg.h"
  18. #include "reg_str.h"
  19. CmakVersion::CmakVersion()
  20. {
  21. HKEY hKey;
  22. LONG lResult;
  23. m_szCmakPath[0] = TEXT('\0');
  24. lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, c_pszCmakAppPath, 0, KEY_READ, &hKey);
  25. if (ERROR_SUCCESS == lResult)
  26. {
  27. //
  28. // Check to see if we have a path to work from.
  29. //
  30. DWORD dwSize = MAX_PATH;
  31. DWORD dwType = REG_SZ;
  32. if (ERROR_SUCCESS == RegQueryValueEx(hKey, c_pszRegPath, NULL, &dwType,
  33. (LPBYTE)m_szCmakPath, &dwSize))
  34. {
  35. //
  36. // Now construct the base object
  37. //
  38. MYVERIFY(CELEMS(m_szPath) > (UINT)wsprintf(m_szPath, TEXT("%s\\cmak.exe"), m_szCmakPath));
  39. Init();
  40. }
  41. }
  42. }
  43. CmakVersion::~CmakVersion()
  44. {
  45. // nothing to do really
  46. }
  47. BOOL CmakVersion::GetInstallLocation(LPTSTR szStr)
  48. {
  49. if ((m_bIsPresent) && (TEXT('\0') != m_szCmakPath[0]) && (NULL != szStr))
  50. {
  51. lstrcpy(szStr, m_szCmakPath);
  52. }
  53. return m_bIsPresent;
  54. }
  55. BOOL CmakVersion::Is10Cmak()
  56. {
  57. if (m_bIsPresent)
  58. {
  59. if ((c_dwVersionSix == m_dwVersion) && (c_dwCmak10BuildNumber == m_dwBuild))
  60. {
  61. return TRUE;
  62. }
  63. }
  64. return FALSE;
  65. }
  66. BOOL CmakVersion::Is11or12Cmak()
  67. {
  68. //
  69. // 1.1 and 1.2 CMAK had the 1.1 file format (cm32\enu to get to the support files). This
  70. // version never shipped in production but was beta-ed
  71. //
  72. if (m_bIsPresent)
  73. {
  74. if ((c_dwVersionSix == m_dwVersion) && (c_dwCmak10BuildNumber < m_dwBuild)
  75. && (c_dwFirst121BuildNumber > m_dwBuild))
  76. {
  77. return TRUE;
  78. }
  79. }
  80. return FALSE;
  81. }
  82. BOOL CmakVersion::Is121Cmak()
  83. {
  84. //
  85. // CMAK 1.21 was the version that shipped in IEAK5 and in NT5 Beta3. This was the CMAK 1.2 with
  86. // the updated directory structure (since cm16 was never shipped, the cm16/cm32 directory structure
  87. // of CMAK was unnecessary). Thus we have the current support directory structure.
  88. //
  89. if (m_bIsPresent)
  90. {
  91. if (((c_dwVersionSeven == m_dwVersion) || (c_dwVersionSix == m_dwVersion))
  92. && (c_dwFirst121BuildNumber < m_dwBuild))
  93. {
  94. return TRUE;
  95. }
  96. }
  97. return FALSE;
  98. }
  99. //
  100. // Cmak 1.22 was the same as CMAK 1.21 except that by this time CM was Unicode enabled and required
  101. // CMUTOA.DLL to run on Win9x. Versions of CMAK prior to this one knew nothing of CMUTOA.DLL and
  102. // thus would not bundle it. Cmak 1.22 shipped in Win2k.
  103. //
  104. BOOL CmakVersion::Is122Cmak()
  105. {
  106. if (m_bIsPresent)
  107. {
  108. if ((c_dwVersionSevenPointOne == m_dwVersion) &&
  109. (c_dwFirstUnicodeBuildNumber <= m_dwBuild) &&
  110. (c_dwWin2kRTMBuildNumber >= m_dwBuild))
  111. {
  112. return TRUE;
  113. }
  114. }
  115. return FALSE;
  116. }
  117. //
  118. // Cmak 1.3 was the version we shipped in Whistler. This version of CMAK bundled the CM
  119. // bins from a cab instead of scooping them from the system dir and used the CM exception
  120. // inf to install CM bins on Win2k.
  121. //
  122. BOOL CmakVersion::Is13Cmak()
  123. {
  124. if (m_bIsPresent)
  125. {
  126. if (((c_dwCurrentCmakVersionNumber == m_dwVersion)) && (c_dwWin2kRTMBuildNumber <= m_dwBuild))
  127. {
  128. return TRUE;
  129. }
  130. }
  131. return FALSE;
  132. }
  133. DWORD CmakVersion::GetNativeCmakLCID()
  134. {
  135. return m_dwLCID;
  136. }