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.

153 lines
4.0 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. (VOID)RegCloseKey(hKey);
  42. }
  43. }
  44. CmakVersion::~CmakVersion()
  45. {
  46. // nothing to do really
  47. }
  48. BOOL CmakVersion::GetInstallLocation(LPTSTR szStr)
  49. {
  50. if ((m_bIsPresent) && (TEXT('\0') != m_szCmakPath[0]) && (NULL != szStr))
  51. {
  52. lstrcpy(szStr, m_szCmakPath);
  53. }
  54. return m_bIsPresent;
  55. }
  56. BOOL CmakVersion::Is10Cmak()
  57. {
  58. if (m_bIsPresent)
  59. {
  60. if ((c_dwVersionSix == m_dwVersion) && (c_dwCmak10BuildNumber == m_dwBuild))
  61. {
  62. return TRUE;
  63. }
  64. }
  65. return FALSE;
  66. }
  67. BOOL CmakVersion::Is11or12Cmak()
  68. {
  69. //
  70. // 1.1 and 1.2 CMAK had the 1.1 file format (cm32\enu to get to the support files). This
  71. // version never shipped in production but was beta-ed
  72. //
  73. if (m_bIsPresent)
  74. {
  75. if ((c_dwVersionSix == m_dwVersion) && (c_dwCmak10BuildNumber < m_dwBuild)
  76. && (c_dwFirst121BuildNumber > m_dwBuild))
  77. {
  78. return TRUE;
  79. }
  80. }
  81. return FALSE;
  82. }
  83. BOOL CmakVersion::Is121Cmak()
  84. {
  85. //
  86. // CMAK 1.21 was the version that shipped in IEAK5 and in NT5 Beta3. This was the CMAK 1.2 with
  87. // the updated directory structure (since cm16 was never shipped, the cm16/cm32 directory structure
  88. // of CMAK was unnecessary). Thus we have the current support directory structure.
  89. //
  90. if (m_bIsPresent)
  91. {
  92. if (((c_dwVersionSeven == m_dwVersion) || (c_dwVersionSix == m_dwVersion))
  93. && (c_dwFirst121BuildNumber < m_dwBuild))
  94. {
  95. return TRUE;
  96. }
  97. }
  98. return FALSE;
  99. }
  100. //
  101. // Cmak 1.22 was the same as CMAK 1.21 except that by this time CM was Unicode enabled and required
  102. // CMUTOA.DLL to run on Win9x. Versions of CMAK prior to this one knew nothing of CMUTOA.DLL and
  103. // thus would not bundle it. Cmak 1.22 shipped in Win2k.
  104. //
  105. BOOL CmakVersion::Is122Cmak()
  106. {
  107. if (m_bIsPresent)
  108. {
  109. if ((c_dwVersionSevenPointOne == m_dwVersion) &&
  110. (c_dwFirstUnicodeBuildNumber <= m_dwBuild) &&
  111. (c_dwWin2kRTMBuildNumber >= m_dwBuild))
  112. {
  113. return TRUE;
  114. }
  115. }
  116. return FALSE;
  117. }
  118. //
  119. // Cmak 1.3 was the version we shipped in Whistler. This version of CMAK bundled the CM
  120. // bins from a cab instead of scooping them from the system dir and used the CM exception
  121. // inf to install CM bins on Win2k.
  122. //
  123. BOOL CmakVersion::Is13Cmak()
  124. {
  125. if (m_bIsPresent)
  126. {
  127. if (((c_dwCurrentCmakVersionNumber == m_dwVersion)) && (c_dwWin2kRTMBuildNumber <= m_dwBuild))
  128. {
  129. return TRUE;
  130. }
  131. }
  132. return FALSE;
  133. }
  134. DWORD CmakVersion::GetNativeCmakLCID()
  135. {
  136. return m_dwLCID;
  137. }