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.

1876 lines
62 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. compliance.c
  5. Abstract:
  6. compliance checking routines.
  7. Author:
  8. Vijayachandran Jayaseelan (vijayj) - 31 Aug 1999
  9. Revision History:
  10. none
  11. Notes:
  12. These routines are used for compliance checking. CCMedia abstracts the
  13. install media and the already existing COMPLIANCE_DATA structure is
  14. used to abstract installation details.
  15. The current compliance checking design uses factory design pattern
  16. (Eric Gamma et.al.) to allow extensibility. Polymorphic behavior of
  17. compliance check is implemented using a function pointer.
  18. CCMediaCreate(...) creates the correct media object and binds the
  19. appropriate compliance checking method to the object. To support a new media
  20. type one needs to write a compliance check function for that
  21. media and change CCMediaCreate(...) function to create the appropriate
  22. media object bound to the new check function.
  23. The compliance matrix is a multidimensional matrix i.e. type,
  24. variation, suite, version (version in turn is made up of major,
  25. minor and build# elements). Since changing a the multi-dimensional
  26. compliance matrix can be error prone and not extensible in terms of
  27. index management, a static global compliance matrix data structure was avoided.
  28. --*/
  29. #ifdef KERNEL_MODE
  30. #include "textmode.h"
  31. #define assert(x) ASSERT(x)
  32. #else // KERNEL_MODE
  33. #if DBG
  34. #define assert(x) if (!(x)) DebugBreak();
  35. #else
  36. #define assert(x)
  37. #endif // DBG
  38. #include "winnt32.h"
  39. #include <stdio.h>
  40. #include <compliance.h>
  41. #endif // for KERNEL_MODE
  42. //
  43. // macros
  44. //
  45. //
  46. // indicates whether a given suite is installed
  47. //
  48. #define SUITE_INSTALLED(X, Y) \
  49. (((X) & (Y)) ? TRUE : FALSE)
  50. #define DEFAULT_MINIMUM_VALIDBUILD_WKS 2428
  51. #define DEFAULT_MINIMUM_VALIDBUILD_SRV 3505
  52. #define DOTNET_BUILD_LE 3505
  53. #define DOTNET_BUILD_BETA3 3590
  54. #define DOTNET_BUILD_RC1 3663
  55. #define DOTNET_BUILD_RC2 3718
  56. static BOOL bDisableBuildCheck = FALSE;
  57. VOID
  58. CCDisableBuildCheck(
  59. VOID )
  60. {
  61. bDisableBuildCheck = TRUE;
  62. }
  63. //
  64. // indicates whether the build is allowed to upgrade
  65. //
  66. __inline
  67. BOOL
  68. IsValidBuild(
  69. IN DWORD InstallVersion,
  70. IN DWORD SourceInstallVersion,
  71. IN DWORD MinimumBuild )
  72. {
  73. BOOL Result = TRUE;
  74. if (bDisableBuildCheck) {
  75. Result = TRUE;
  76. } else if ((InstallVersion > 1381 && InstallVersion < 2031) ||
  77. (InstallVersion > 2195 && InstallVersion < MinimumBuild) ||
  78. (InstallVersion > SourceInstallVersion)) {
  79. Result = FALSE;
  80. }
  81. return Result;
  82. }
  83. BOOLEAN
  84. CCProfessionalCheck(
  85. IN PCCMEDIA This,
  86. IN PCOMPLIANCE_DATA CompData,
  87. OUT PUINT FailureReason,
  88. OUT PBOOL UpgradeAllowed )
  89. /*++
  90. Routine Description:
  91. This routine checks whether the an installation is compliant with the
  92. professional media.
  93. Arguments:
  94. This : professional media object pointer
  95. CompData : compliance data describing details for an installation
  96. FailureReason : receives the reason for failure, if any.
  97. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  98. or not
  99. Return Value:
  100. TRUE if the given install is compliant for installing using the
  101. professional media, otherwise FALSE
  102. --*/
  103. {
  104. switch (CompData->InstallType) {
  105. case COMPLIANCE_INSTALLTYPE_NTWP:
  106. case COMPLIANCE_INSTALLTYPE_NTW:
  107. if (CompData->MinimumVersion < 400) {
  108. *FailureReason = COMPLIANCEERR_VERSION;
  109. *UpgradeAllowed = FALSE;
  110. } else {
  111. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_WKS)) {
  112. *FailureReason = COMPLIANCEERR_NONE;
  113. *UpgradeAllowed = TRUE;
  114. } else {
  115. *FailureReason = COMPLIANCEERR_VERSION;
  116. *UpgradeAllowed = FALSE;
  117. }
  118. }
  119. break;
  120. case COMPLIANCE_INSTALLTYPE_WIN9X:
  121. // note: 401 is 4.1
  122. if (CompData->MinimumVersion < 401) {
  123. *FailureReason = COMPLIANCEERR_VERSION;
  124. *UpgradeAllowed = FALSE;
  125. } else {
  126. *FailureReason = COMPLIANCEERR_NONE;
  127. *UpgradeAllowed = TRUE;
  128. }
  129. break;
  130. case COMPLIANCE_INSTALLTYPE_WIN31:
  131. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  132. case COMPLIANCE_INSTALLTYPE_NTS:
  133. case COMPLIANCE_INSTALLTYPE_NTSB:
  134. case COMPLIANCE_INSTALLTYPE_NTSE:
  135. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  136. case COMPLIANCE_INSTALLTYPE_NTSBS:
  137. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  138. *FailureReason = COMPLIANCEERR_TYPE;
  139. *UpgradeAllowed = FALSE;
  140. break;
  141. default:
  142. *UpgradeAllowed = FALSE;
  143. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  144. break;
  145. }
  146. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  147. }
  148. BOOLEAN
  149. CCFullProfessionalCheck(
  150. IN PCCMEDIA This,
  151. IN PCOMPLIANCE_DATA CompData,
  152. OUT PUINT FailureReason,
  153. OUT PBOOL UpgradeAllowed )
  154. /*++
  155. Routine Description:
  156. This routine checks whether the an installation is compliant with the
  157. professional full media.
  158. Arguments:
  159. This : professional media object pointer
  160. CompData : compliance data describing details for an installation
  161. FailureReason : receives the reason for failure, if any.
  162. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  163. or not
  164. Return Value:
  165. TRUE if the given install is compliant for installing using the
  166. professional full media, otherwise FALSE
  167. --*/
  168. {
  169. #if defined _IA64_
  170. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) &&
  171. (CompData->BuildNumberNt <= DOTNET_BUILD_RC2) ){
  172. *FailureReason = COMPLIANCEERR_VERSION;
  173. *UpgradeAllowed = FALSE;
  174. return TRUE;
  175. }
  176. switch (This->SourceVariation) {
  177. case COMPLIANCE_INSTALLVAR_OEM:
  178. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) &&
  179. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ){
  180. *FailureReason = COMPLIANCEERR_VERSION;
  181. *UpgradeAllowed = FALSE;
  182. return TRUE;
  183. }
  184. break;
  185. case COMPLIANCE_INSTALLVAR_EVAL:
  186. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) &&
  187. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL)) {
  188. *FailureReason = COMPLIANCEERR_VERSION;
  189. *UpgradeAllowed = FALSE;
  190. return TRUE;
  191. }
  192. break;
  193. default:
  194. break;
  195. }
  196. #endif
  197. switch (This->SourceVariation) {
  198. case COMPLIANCE_INSTALLVAR_OEM:
  199. if ( ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_WIN9X) && (CompData->MinimumVersion > 400) && (CompData->MinimumVersion <= 490)) ||
  200. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 400)) ||
  201. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 500)) ||
  202. (((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) || (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) )
  203. && (CompData->MinimumVersion == 501)
  204. && (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) ){
  205. *FailureReason = COMPLIANCEERR_VARIATION;
  206. *UpgradeAllowed = FALSE;
  207. } else {
  208. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  209. }
  210. break;
  211. case COMPLIANCE_INSTALLVAR_EVAL:
  212. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) &&
  213. (CompData->MinimumVersion >= 501) &&
  214. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL)) {
  215. *FailureReason = COMPLIANCEERR_VARIATION;
  216. *UpgradeAllowed = FALSE;
  217. }
  218. else {
  219. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  220. }
  221. break;
  222. default:
  223. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  224. break;
  225. }
  226. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  227. }
  228. BOOLEAN
  229. CCProfessionalUpgCheck(
  230. IN PCCMEDIA This,
  231. IN PCOMPLIANCE_DATA CompData,
  232. OUT PUINT FailureReason,
  233. OUT PBOOL UpgradeAllowed )
  234. /*++
  235. Routine Description:
  236. This routine checks whether the an installation is compliant with the
  237. professional upgrade media.
  238. Arguments:
  239. This : professional media object pointer
  240. CompData : compliance data describing details for an installation
  241. FailureReason : receives the reason for failure, if any.
  242. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  243. or not
  244. Return Value:
  245. TRUE if the given install is compliant for installing using the
  246. professional upgrade media, otherwise FALSE
  247. --*/
  248. {
  249. if (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_NFR) {
  250. *FailureReason = COMPLIANCEERR_VARIATION;
  251. *UpgradeAllowed = FALSE;
  252. } else {
  253. switch (This->SourceVariation) {
  254. case COMPLIANCE_INSTALLVAR_OEM:
  255. if ( ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_WIN9X) && (CompData->MinimumVersion > 400) && (CompData->MinimumVersion <= 490)) ||
  256. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 400)) ||
  257. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 500) && (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) ||
  258. (((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) || (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) )
  259. && (CompData->MinimumVersion == 501)
  260. && (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) ){
  261. *FailureReason = COMPLIANCEERR_VARIATION;
  262. *UpgradeAllowed = FALSE;
  263. } else {
  264. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  265. }
  266. break;
  267. default:
  268. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  269. break;
  270. }
  271. }
  272. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  273. }
  274. BOOLEAN
  275. CCPersonalCheck(
  276. IN PCCMEDIA This,
  277. IN PCOMPLIANCE_DATA CompData,
  278. OUT PUINT FailureReason,
  279. OUT PBOOL UpgradeAllowed )
  280. /*++
  281. Routine Description:
  282. This routine checks whether the an installation is compliant with the
  283. personal media.
  284. Arguments:
  285. This : personal media object pointer
  286. CompData : compliance data describing details for an installation
  287. FailureReason : receives the reason for failure, if any.
  288. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  289. or not
  290. Return Value:
  291. TRUE if the given install is compliant for installing using the
  292. personal media, otherwise FALSE
  293. --*/
  294. {
  295. switch (CompData->InstallType) {
  296. case COMPLIANCE_INSTALLTYPE_WIN9X:
  297. // note: 401 is version 4.1
  298. if (CompData->MinimumVersion < 401) {
  299. *FailureReason = COMPLIANCEERR_VERSION;
  300. *UpgradeAllowed = FALSE;
  301. } else {
  302. *FailureReason = COMPLIANCEERR_NONE;
  303. *UpgradeAllowed = TRUE;
  304. }
  305. break;
  306. case COMPLIANCE_INSTALLTYPE_NTWP:
  307. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_WKS)) {
  308. *FailureReason = COMPLIANCEERR_NONE;
  309. *UpgradeAllowed = TRUE;
  310. } else {
  311. *FailureReason = COMPLIANCEERR_VERSION;
  312. *UpgradeAllowed = FALSE;
  313. }
  314. break;
  315. case COMPLIANCE_INSTALLTYPE_WIN31:
  316. case COMPLIANCE_INSTALLTYPE_NTW:
  317. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  318. case COMPLIANCE_INSTALLTYPE_NTS:
  319. case COMPLIANCE_INSTALLTYPE_NTSB:
  320. case COMPLIANCE_INSTALLTYPE_NTSE:
  321. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  322. case COMPLIANCE_INSTALLTYPE_NTSBS:
  323. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  324. *FailureReason = COMPLIANCEERR_TYPE;
  325. *UpgradeAllowed = FALSE;
  326. break;
  327. default:
  328. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  329. *UpgradeAllowed = FALSE;
  330. break;
  331. }
  332. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  333. }
  334. BOOLEAN
  335. CCFullPersonalCheck(
  336. IN PCCMEDIA This,
  337. IN PCOMPLIANCE_DATA CompData,
  338. OUT PUINT FailureReason,
  339. OUT PBOOL UpgradeAllowed )
  340. /*++
  341. Routine Description:
  342. This routine checks whether the an installation is compliant with the
  343. personal full media.
  344. Arguments:
  345. This : personal media object pointer
  346. CompData : compliance data describing details for an installation
  347. FailureReason : receives the reason for failure, if any.
  348. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  349. or not
  350. Return Value:
  351. TRUE if the given install is compliant for installing using the
  352. personal full media, otherwise FALSE
  353. --*/
  354. {
  355. switch (This->SourceVariation) {
  356. case COMPLIANCE_INSTALLVAR_OEM:
  357. if ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_WIN9X) && (CompData->MinimumVersion > 400) && (CompData->MinimumVersion <= 490)) {
  358. *FailureReason = COMPLIANCEERR_VARIATION;
  359. *UpgradeAllowed = FALSE;
  360. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) &&
  361. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) {
  362. *FailureReason = COMPLIANCEERR_VARIATION;
  363. *UpgradeAllowed = FALSE;
  364. }
  365. else {
  366. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  367. }
  368. break;
  369. case COMPLIANCE_INSTALLVAR_EVAL:
  370. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) &&
  371. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL)) {
  372. *FailureReason = COMPLIANCEERR_VARIATION;
  373. *UpgradeAllowed = FALSE;
  374. }
  375. else {
  376. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  377. }
  378. break;
  379. default:
  380. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  381. break;
  382. }
  383. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  384. }
  385. BOOLEAN
  386. CCPersonalUpgCheck(
  387. IN PCCMEDIA This,
  388. IN PCOMPLIANCE_DATA CompData,
  389. OUT PUINT FailureReason,
  390. OUT PBOOL UpgradeAllowed )
  391. /*++
  392. Routine Description:
  393. This routine checks whether the an installation is compliant with the
  394. personal upgrade media.
  395. Arguments:
  396. This : personal media object pointer
  397. CompData : compliance data describing details for an installation
  398. FailureReason : receives the reason for failure, if any.
  399. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  400. or not
  401. Return Value:
  402. TRUE if the given install is compliant for installing using the
  403. personal upgrade media, otherwise FALSE
  404. --*/
  405. {
  406. if (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_NFR) {
  407. *FailureReason = COMPLIANCEERR_VARIATION;
  408. *UpgradeAllowed = FALSE;
  409. } else {
  410. switch (This->SourceVariation) {
  411. case COMPLIANCE_INSTALLVAR_OEM:
  412. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) &&
  413. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) {
  414. *FailureReason = COMPLIANCEERR_VARIATION;
  415. *UpgradeAllowed = FALSE;
  416. }
  417. else {
  418. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  419. }
  420. break;
  421. default:
  422. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  423. break;
  424. }
  425. }
  426. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  427. }
  428. BOOLEAN
  429. CCBladeServerCheck(
  430. IN PCCMEDIA This,
  431. IN PCOMPLIANCE_DATA CompData,
  432. OUT PUINT FailureReason,
  433. OUT PBOOL UpgradeAllowed )
  434. /*++
  435. Routine Description:
  436. This routine checks whether the an installation is compliant with the
  437. blade server media. Policy is to allow blade server to be installed on
  438. older version of blade or on Windows Powered boxes (ADS w/EMBED suite).
  439. Arguments:
  440. This : server media object pointer
  441. CompData : compliance data describing details for an installation
  442. FailureReason : receives the reason for failure, if any.
  443. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  444. or not
  445. Return Value:
  446. TRUE if the given install is compliant for installing using the
  447. blade server media, otherwise FALSE
  448. --*/
  449. {
  450. DWORD SuitesToCheck = 0;
  451. switch (CompData->InstallType) {
  452. case COMPLIANCE_INSTALLTYPE_NTSB:
  453. if (CompData->MinimumVersion < 501) {
  454. *UpgradeAllowed = FALSE;
  455. *FailureReason = COMPLIANCEERR_TYPE;
  456. } else {
  457. if (!IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_SRV) ||
  458. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM &&
  459. CompData->BuildNumberNt <= DOTNET_BUILD_RC2)
  460. ) {
  461. *FailureReason = COMPLIANCEERR_VERSION;
  462. *UpgradeAllowed = FALSE;
  463. } else {
  464. *FailureReason = COMPLIANCEERR_NONE;
  465. *UpgradeAllowed = TRUE;
  466. }
  467. }
  468. break;
  469. case COMPLIANCE_INSTALLTYPE_NTSE:
  470. case COMPLIANCE_INSTALLTYPE_WIN9X:
  471. case COMPLIANCE_INSTALLTYPE_WIN31:
  472. case COMPLIANCE_INSTALLTYPE_NTWP:
  473. case COMPLIANCE_INSTALLTYPE_NTW:
  474. case COMPLIANCE_INSTALLTYPE_NTS:
  475. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  476. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  477. case COMPLIANCE_INSTALLTYPE_NTSBS:
  478. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  479. *FailureReason = COMPLIANCEERR_TYPE;
  480. *UpgradeAllowed = FALSE;
  481. break;
  482. default:
  483. *UpgradeAllowed = FALSE;
  484. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  485. break;
  486. }
  487. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  488. }
  489. BOOLEAN
  490. CCFullBladeServerCheck(
  491. IN PCCMEDIA This,
  492. IN PCOMPLIANCE_DATA CompData,
  493. OUT PUINT FailureReason,
  494. OUT PBOOL UpgradeAllowed )
  495. /*++
  496. Routine Description:
  497. This routine checks whether the an installation is compliant with the
  498. blade server full media.
  499. Arguments:
  500. This : server media object pointer
  501. CompData : compliance data describing details for an installation
  502. FailureReason : receives the reason for failure, if any.
  503. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  504. or not
  505. Return Value:
  506. TRUE if the given install is compliant for installing using the
  507. blade server media, otherwise FALSE
  508. --*/
  509. {
  510. switch (This->SourceVariation) {
  511. case COMPLIANCE_INSTALLVAR_OEM:
  512. if ( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSB) &&
  513. ((CompData->MinimumVersion == 501) || (CompData->MinimumVersion == 502)) &&
  514. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ){
  515. *FailureReason = COMPLIANCEERR_VERSION;
  516. *UpgradeAllowed = FALSE;
  517. } else {
  518. CCBladeServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  519. }
  520. break;
  521. case COMPLIANCE_INSTALLVAR_EVAL:
  522. if ( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSB) &&
  523. (CompData->BuildNumberNt > DOTNET_BUILD_RC2) &&
  524. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL) ){
  525. *FailureReason = COMPLIANCEERR_VERSION;
  526. *UpgradeAllowed = FALSE;
  527. } else {
  528. CCBladeServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  529. }
  530. break;
  531. default:
  532. CCBladeServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  533. break;
  534. }
  535. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  536. }
  537. BOOLEAN
  538. CCBladeServerUpgCheck(
  539. IN PCCMEDIA This,
  540. IN PCOMPLIANCE_DATA CompData,
  541. OUT PUINT FailureReason,
  542. OUT PBOOL UpgradeAllowed )
  543. /*++
  544. Routine Description:
  545. This routine checks whether the an installation is compliant with the
  546. blade server upgrade media.
  547. Arguments:
  548. This : server media object pointer
  549. CompData : compliance data describing details for an installation
  550. FailureReason : receives the reason for failure, if any.
  551. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  552. or not
  553. Return Value:
  554. TRUE if the given install is compliant for installing using the
  555. blade server upgrade media, otherwise FALSE
  556. --*/
  557. {
  558. switch (CompData->InstallVariation) {
  559. case COMPLIANCE_INSTALLVAR_NFR:
  560. case COMPLIANCE_INSTALLVAR_EVAL:
  561. *FailureReason = COMPLIANCEERR_VARIATION;
  562. *UpgradeAllowed = FALSE;
  563. break;
  564. default:
  565. CCBladeServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  566. break;
  567. }
  568. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  569. }
  570. BOOLEAN
  571. CCSmallBusinessServerCheck(
  572. IN PCCMEDIA This,
  573. IN PCOMPLIANCE_DATA CompData,
  574. OUT PUINT FailureReason,
  575. OUT PBOOL UpgradeAllowed )
  576. /*++
  577. Routine Description:
  578. This routine checks whether the an installation is compliant with the
  579. blade server media. Policy is to only allow Whistler SBS to upgrade Win2k Server,
  580. Whistler Server, and SBS 2k.
  581. Arguments:
  582. This : server media object pointer
  583. CompData : compliance data describing details for an installation
  584. FailureReason : receives the reason for failure, if any.
  585. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  586. or not
  587. Return Value:
  588. TRUE if the given install is compliant for installing using the
  589. blade server media, otherwise FALSE
  590. --*/
  591. {
  592. switch (CompData->InstallType) {
  593. case COMPLIANCE_INSTALLTYPE_NTS:
  594. case COMPLIANCE_INSTALLTYPE_NTSBS:
  595. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  596. if ((CompData->BuildNumberNt >= 2195) &&
  597. (CompData->BuildNumberNt <= This->BuildNumber)) {
  598. *FailureReason = COMPLIANCEERR_NONE;
  599. *UpgradeAllowed = TRUE;
  600. } else {
  601. *FailureReason = COMPLIANCEERR_VERSION;
  602. *UpgradeAllowed = FALSE;
  603. }
  604. break;
  605. case COMPLIANCE_INSTALLTYPE_WIN9X:
  606. case COMPLIANCE_INSTALLTYPE_WIN31:
  607. case COMPLIANCE_INSTALLTYPE_NTWP:
  608. case COMPLIANCE_INSTALLTYPE_NTW:
  609. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  610. case COMPLIANCE_INSTALLTYPE_NTSB:
  611. case COMPLIANCE_INSTALLTYPE_NTSE:
  612. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  613. *FailureReason = COMPLIANCEERR_TYPE;
  614. *UpgradeAllowed = FALSE;
  615. break;
  616. default:
  617. *UpgradeAllowed = FALSE;
  618. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  619. break;
  620. }
  621. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  622. }
  623. BOOLEAN
  624. CCFullSmallBusinessServerCheck(
  625. IN PCCMEDIA This,
  626. IN PCOMPLIANCE_DATA CompData,
  627. OUT PUINT FailureReason,
  628. OUT PBOOL UpgradeAllowed )
  629. /*++
  630. Routine Description:
  631. This routine checks whether the an installation is compliant with the
  632. blade server full media.
  633. Arguments:
  634. This : server media object pointer
  635. CompData : compliance data describing details for an installation
  636. FailureReason : receives the reason for failure, if any.
  637. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  638. or not
  639. Return Value:
  640. TRUE if the given install is compliant for installing using the
  641. blade server media, otherwise FALSE
  642. --*/
  643. {
  644. CCSmallBusinessServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  645. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  646. }
  647. BOOLEAN
  648. CCSmallBusinessServerUpgCheck(
  649. IN PCCMEDIA This,
  650. IN PCOMPLIANCE_DATA CompData,
  651. OUT PUINT FailureReason,
  652. OUT PBOOL UpgradeAllowed )
  653. /*++
  654. Routine Description:
  655. This routine checks whether the an installation is compliant with the
  656. sbs upgrade media.
  657. Arguments:
  658. This : server media object pointer
  659. CompData : compliance data describing details for an installation
  660. FailureReason : receives the reason for failure, if any.
  661. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  662. or not
  663. Return Value:
  664. TRUE if the given install is compliant for installing using the
  665. blade server upgrade media, otherwise FALSE
  666. --*/
  667. {
  668. switch (CompData->InstallVariation) {
  669. case COMPLIANCE_INSTALLVAR_NFR:
  670. case COMPLIANCE_INSTALLVAR_EVAL:
  671. *FailureReason = COMPLIANCEERR_VARIATION;
  672. *UpgradeAllowed = FALSE;
  673. break;
  674. default:
  675. CCSmallBusinessServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  676. break;
  677. }
  678. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  679. }
  680. BOOLEAN
  681. CCServerCheck(
  682. IN PCCMEDIA This,
  683. IN PCOMPLIANCE_DATA CompData,
  684. OUT PUINT FailureReason,
  685. OUT PBOOL UpgradeAllowed )
  686. /*++
  687. Routine Description:
  688. This routine checks whether the an installation is compliant with the
  689. server media.
  690. Arguments:
  691. This : server media object pointer
  692. CompData : compliance data describing details for an installation
  693. FailureReason : receives the reason for failure, if any.
  694. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  695. or not
  696. Return Value:
  697. TRUE if the given install is compliant for installing using the
  698. server media, otherwise FALSE
  699. --*/
  700. {
  701. DWORD SuitesToCheck = 0;
  702. switch (CompData->InstallType) {
  703. case COMPLIANCE_INSTALLTYPE_NTS:
  704. SuitesToCheck = (COMPLIANCE_INSTALLSUITE_ENT |
  705. COMPLIANCE_INSTALLSUITE_SBSR |
  706. COMPLIANCE_INSTALLSUITE_BACK);
  707. if (SUITE_INSTALLED(CompData->InstallSuite, SuitesToCheck)) {
  708. *FailureReason = COMPLIANCEERR_SUITE;
  709. *UpgradeAllowed = FALSE;
  710. } else {
  711. if (CompData->MinimumVersion < 400) {
  712. *FailureReason = COMPLIANCEERR_VERSION;
  713. *UpgradeAllowed = FALSE;
  714. } else {
  715. if (!IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_SRV) ||
  716. ( (CompData->MinimumVersion >= 501) &&
  717. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM) &&
  718. (CompData->BuildNumberNt >= DOTNET_BUILD_BETA3) &&
  719. (CompData->BuildNumberNt <= DOTNET_BUILD_RC2)) ) {
  720. *FailureReason = COMPLIANCEERR_VERSION;
  721. *UpgradeAllowed = FALSE;
  722. } else {
  723. *FailureReason = COMPLIANCEERR_NONE;
  724. *UpgradeAllowed = TRUE;
  725. }
  726. }
  727. }
  728. break;
  729. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  730. if (CompData->BuildNumberNt < 1381) {
  731. *FailureReason = COMPLIANCEERR_VERSION;
  732. *UpgradeAllowed = FALSE;
  733. } else {
  734. *FailureReason = COMPLIANCEERR_NONE;
  735. *UpgradeAllowed = TRUE;
  736. }
  737. break;
  738. case COMPLIANCE_INSTALLTYPE_NTSBS:
  739. case COMPLIANCE_INSTALLTYPE_WIN9X:
  740. case COMPLIANCE_INSTALLTYPE_WIN31:
  741. case COMPLIANCE_INSTALLTYPE_NTWP:
  742. case COMPLIANCE_INSTALLTYPE_NTW:
  743. case COMPLIANCE_INSTALLTYPE_NTSB:
  744. case COMPLIANCE_INSTALLTYPE_NTSE:
  745. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  746. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  747. *FailureReason = COMPLIANCEERR_TYPE;
  748. *UpgradeAllowed = FALSE;
  749. break;
  750. default:
  751. *UpgradeAllowed = FALSE;
  752. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  753. break;
  754. }
  755. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  756. }
  757. BOOLEAN
  758. CCFullServerCheck(
  759. IN PCCMEDIA This,
  760. IN PCOMPLIANCE_DATA CompData,
  761. OUT PUINT FailureReason,
  762. OUT PBOOL UpgradeAllowed )
  763. /*++
  764. Routine Description:
  765. This routine checks whether the an installation is compliant with the
  766. server full media.
  767. Arguments:
  768. This : server media object pointer
  769. CompData : compliance data describing details for an installation
  770. FailureReason : receives the reason for failure, if any.
  771. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  772. or not
  773. Return Value:
  774. TRUE if the given install is compliant for installing using the
  775. server media, otherwise FALSE
  776. --*/
  777. {
  778. switch (This->SourceVariation) {
  779. case COMPLIANCE_INSTALLVAR_OEM:
  780. if ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTS) &&
  781. (CompData->MinimumVersion == 400) ) {
  782. *FailureReason = COMPLIANCEERR_VERSION;
  783. *UpgradeAllowed = FALSE;
  784. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSTSE) &&
  785. (CompData->MinimumVersion == 400) ) {
  786. *FailureReason = COMPLIANCEERR_VERSION;
  787. *UpgradeAllowed = FALSE;
  788. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTS) &&
  789. (CompData->MinimumVersion == 500) &&
  790. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ) {
  791. *FailureReason = COMPLIANCEERR_VERSION;
  792. *UpgradeAllowed = FALSE;
  793. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTS) &&
  794. ((CompData->MinimumVersion == 501) || (CompData->MinimumVersion == 502))&&
  795. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ) {
  796. *FailureReason = COMPLIANCEERR_VERSION;
  797. *UpgradeAllowed = FALSE;
  798. } else {
  799. CCServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  800. }
  801. break;
  802. case COMPLIANCE_INSTALLVAR_EVAL:
  803. if ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTS) &&
  804. (CompData->BuildNumberNt > DOTNET_BUILD_RC2) &&
  805. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL) ) {
  806. *FailureReason = COMPLIANCEERR_VERSION;
  807. *UpgradeAllowed = FALSE;
  808. } else {
  809. CCServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  810. }
  811. break;
  812. default:
  813. CCServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  814. break;
  815. }
  816. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  817. }
  818. BOOLEAN
  819. CCServerUpgCheck(
  820. IN PCCMEDIA This,
  821. IN PCOMPLIANCE_DATA CompData,
  822. OUT PUINT FailureReason,
  823. OUT PBOOL UpgradeAllowed )
  824. /*++
  825. Routine Description:
  826. This routine checks whether the an installation is compliant with the
  827. server upgrade media.
  828. Arguments:
  829. This : server media object pointer
  830. CompData : compliance data describing details for an installation
  831. FailureReason : receives the reason for failure, if any.
  832. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  833. or not
  834. Return Value:
  835. TRUE if the given install is compliant for installing using the
  836. server upgrade media, otherwise FALSE
  837. --*/
  838. {
  839. switch (CompData->InstallVariation) {
  840. case COMPLIANCE_INSTALLVAR_NFR:
  841. case COMPLIANCE_INSTALLVAR_EVAL:
  842. *FailureReason = COMPLIANCEERR_VARIATION;
  843. *UpgradeAllowed = FALSE;
  844. break;
  845. default:
  846. CCServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  847. break;
  848. }
  849. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  850. }
  851. #if defined _IA64_
  852. BOOLEAN
  853. CCAdvancedServerCheck(
  854. IN PCCMEDIA This,
  855. IN PCOMPLIANCE_DATA CompData,
  856. OUT PUINT FailureReason,
  857. OUT PBOOL UpgradeAllowed )
  858. /*++
  859. Routine Description:
  860. This routine checks whether the an installation is compliant with the
  861. advanced server media.
  862. Arguments:
  863. This : advanced server media object pointer
  864. CompData : compliance data describing details for an installation
  865. FailureReason : receives the reason for failure, if any.
  866. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  867. or not
  868. Return Value:
  869. TRUE if the given install is compliant for installing using the
  870. advanced server media, otherwise FALSE
  871. --*/
  872. {
  873. DWORD SuitesToCheck = 0;
  874. switch (CompData->InstallType) {
  875. case COMPLIANCE_INSTALLTYPE_NTSE:
  876. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DOTNET_BUILD_RC1)) {
  877. *FailureReason = COMPLIANCEERR_NONE;
  878. *UpgradeAllowed = TRUE;
  879. } else {
  880. *FailureReason = COMPLIANCEERR_VERSION;
  881. *UpgradeAllowed = FALSE;
  882. }
  883. break;
  884. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  885. case COMPLIANCE_INSTALLTYPE_NTS:
  886. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  887. case COMPLIANCE_INSTALLTYPE_WIN9X:
  888. case COMPLIANCE_INSTALLTYPE_WIN31:
  889. case COMPLIANCE_INSTALLTYPE_NTWP:
  890. case COMPLIANCE_INSTALLTYPE_NTW:
  891. case COMPLIANCE_INSTALLTYPE_NTSB:
  892. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  893. case COMPLIANCE_INSTALLTYPE_NTSBS:
  894. *FailureReason = COMPLIANCEERR_TYPE;
  895. *UpgradeAllowed = FALSE;
  896. break;
  897. default:
  898. *UpgradeAllowed = FALSE;
  899. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  900. break;
  901. }
  902. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  903. }
  904. BOOLEAN
  905. CCFullAdvancedServerCheck(
  906. IN PCCMEDIA This,
  907. IN PCOMPLIANCE_DATA CompData,
  908. OUT PUINT FailureReason,
  909. OUT PBOOL UpgradeAllowed )
  910. /*++
  911. Routine Description:
  912. This routine checks whether the an installation is compliant with the
  913. advanced server full media.
  914. Arguments:
  915. This : advanced server media object pointer
  916. CompData : compliance data describing details for an installation
  917. FailureReason : receives the reason for failure, if any.
  918. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  919. or not
  920. Return Value:
  921. TRUE if the given install is compliant for installing using the
  922. advanced server full media, otherwise FALSE
  923. --*/
  924. {
  925. switch (This->SourceVariation) {
  926. case COMPLIANCE_INSTALLVAR_OEM:
  927. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSE) &&
  928. (CompData->BuildNumberNt <= DOTNET_BUILD_RC2) &&
  929. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_EVAL) ){
  930. *FailureReason = COMPLIANCEERR_VERSION;
  931. *UpgradeAllowed = FALSE;
  932. return TRUE;
  933. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSE) &&
  934. (CompData->BuildNumberNt > DOTNET_BUILD_RC2) &&
  935. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ){
  936. *FailureReason = COMPLIANCEERR_VERSION;
  937. *UpgradeAllowed = FALSE;
  938. return TRUE;
  939. }
  940. break;
  941. case COMPLIANCE_INSTALLVAR_EVAL:
  942. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSE) &&
  943. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL) ){
  944. *FailureReason = COMPLIANCEERR_VERSION;
  945. *UpgradeAllowed = FALSE;
  946. return TRUE;
  947. }
  948. break;
  949. default:
  950. break;
  951. }
  952. CCAdvancedServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  953. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  954. }
  955. #else // !ia64
  956. BOOLEAN
  957. CCAdvancedServerCheck(
  958. IN PCCMEDIA This,
  959. IN PCOMPLIANCE_DATA CompData,
  960. OUT PUINT FailureReason,
  961. OUT PBOOL UpgradeAllowed )
  962. /*++
  963. Routine Description:
  964. This routine checks whether the an installation is compliant with the
  965. advanced server media.
  966. Arguments:
  967. This : advanced server media object pointer
  968. CompData : compliance data describing details for an installation
  969. FailureReason : receives the reason for failure, if any.
  970. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  971. or not
  972. Return Value:
  973. TRUE if the given install is compliant for installing using the
  974. advanced server media, otherwise FALSE
  975. --*/
  976. {
  977. DWORD SuitesToCheck = 0;
  978. switch (CompData->InstallType) {
  979. case COMPLIANCE_INSTALLTYPE_NTS:
  980. // note: 502 is version 5.2 because of calculation major*100 + minor
  981. if (CompData->MinimumVersion <= 502 && CompData->MinimumVersion > 351) {
  982. SuitesToCheck = (COMPLIANCE_INSTALLSUITE_SBSR |
  983. COMPLIANCE_INSTALLSUITE_BACK);
  984. if (SUITE_INSTALLED(CompData->InstallSuite, SuitesToCheck)) {
  985. *FailureReason = COMPLIANCEERR_SUITE;
  986. *UpgradeAllowed = FALSE;
  987. } else {
  988. if (!IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_SRV) ||
  989. ((CompData->MinimumVersion >= 501) &&
  990. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM) &&
  991. (CompData->BuildNumberNt >= DOTNET_BUILD_BETA3) &&
  992. (CompData->BuildNumberNt <= DOTNET_BUILD_RC2)) ) {
  993. *FailureReason = COMPLIANCEERR_VERSION;
  994. *UpgradeAllowed = FALSE;
  995. } else {
  996. *FailureReason = COMPLIANCEERR_NONE;
  997. *UpgradeAllowed = TRUE;
  998. }
  999. }
  1000. } else {
  1001. *FailureReason = COMPLIANCEERR_VERSION;
  1002. *UpgradeAllowed = FALSE;
  1003. }
  1004. break;
  1005. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  1006. if (CompData->BuildNumberNt < 1381) {
  1007. *FailureReason = COMPLIANCEERR_VERSION;
  1008. *UpgradeAllowed = FALSE;
  1009. } else {
  1010. *FailureReason = COMPLIANCEERR_NONE;
  1011. *UpgradeAllowed = TRUE;
  1012. }
  1013. break;
  1014. case COMPLIANCE_INSTALLTYPE_NTSE:
  1015. if (!IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_SRV) ||
  1016. ((CompData->MinimumVersion >= 501) &&
  1017. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM) &&
  1018. (CompData->BuildNumberNt >= DOTNET_BUILD_BETA3) &&
  1019. (CompData->BuildNumberNt <= DOTNET_BUILD_RC2)) ) {
  1020. *FailureReason = COMPLIANCEERR_VERSION;
  1021. *UpgradeAllowed = FALSE;
  1022. } else {
  1023. *FailureReason = COMPLIANCEERR_NONE;
  1024. *UpgradeAllowed = TRUE;
  1025. }
  1026. break;
  1027. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  1028. case COMPLIANCE_INSTALLTYPE_WIN9X:
  1029. case COMPLIANCE_INSTALLTYPE_WIN31:
  1030. case COMPLIANCE_INSTALLTYPE_NTWP:
  1031. case COMPLIANCE_INSTALLTYPE_NTW:
  1032. case COMPLIANCE_INSTALLTYPE_NTSB:
  1033. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  1034. case COMPLIANCE_INSTALLTYPE_NTSBS:
  1035. *FailureReason = COMPLIANCEERR_TYPE;
  1036. *UpgradeAllowed = FALSE;
  1037. break;
  1038. default:
  1039. *UpgradeAllowed = FALSE;
  1040. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  1041. break;
  1042. }
  1043. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  1044. }
  1045. BOOLEAN
  1046. CCFullAdvancedServerCheck(
  1047. IN PCCMEDIA This,
  1048. IN PCOMPLIANCE_DATA CompData,
  1049. OUT PUINT FailureReason,
  1050. OUT PBOOL UpgradeAllowed )
  1051. /*++
  1052. Routine Description:
  1053. This routine checks whether the an installation is compliant with the
  1054. advanced server full media.
  1055. Arguments:
  1056. This : advanced server media object pointer
  1057. CompData : compliance data describing details for an installation
  1058. FailureReason : receives the reason for failure, if any.
  1059. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  1060. or not
  1061. Return Value:
  1062. TRUE if the given install is compliant for installing using the
  1063. advanced server full media, otherwise FALSE
  1064. --*/
  1065. {
  1066. switch (This->SourceVariation) {
  1067. case COMPLIANCE_INSTALLVAR_OEM:
  1068. if ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTS) &&
  1069. (CompData->MinimumVersion == 400) ) {
  1070. *FailureReason = COMPLIANCEERR_VERSION;
  1071. *UpgradeAllowed = FALSE;
  1072. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSTSE) &&
  1073. (CompData->MinimumVersion == 400) ) {
  1074. *FailureReason = COMPLIANCEERR_VERSION;
  1075. *UpgradeAllowed = FALSE;
  1076. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSE) &&
  1077. (CompData->MinimumVersion == 400) ) {
  1078. *FailureReason = COMPLIANCEERR_VERSION;
  1079. *UpgradeAllowed = FALSE;
  1080. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTS) &&
  1081. (CompData->MinimumVersion == 500) &&
  1082. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ) {
  1083. *FailureReason = COMPLIANCEERR_VERSION;
  1084. *UpgradeAllowed = FALSE;
  1085. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSE) &&
  1086. (CompData->MinimumVersion == 500) &&
  1087. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ) {
  1088. *FailureReason = COMPLIANCEERR_VERSION;
  1089. *UpgradeAllowed = FALSE;
  1090. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTS) &&
  1091. ((CompData->MinimumVersion == 501) || (CompData->MinimumVersion == 502))&&
  1092. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ) {
  1093. *FailureReason = COMPLIANCEERR_VERSION;
  1094. *UpgradeAllowed = FALSE;
  1095. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSE) &&
  1096. ((CompData->MinimumVersion == 501) || (CompData->MinimumVersion == 502))&&
  1097. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM) ) {
  1098. *FailureReason = COMPLIANCEERR_VERSION;
  1099. *UpgradeAllowed = FALSE;
  1100. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSPOW) &&
  1101. (CompData->MinimumVersion == 500) &&
  1102. (CompData->BuildNumberNt == 2195) &&
  1103. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM) ) {
  1104. *FailureReason = COMPLIANCEERR_NONE;
  1105. *UpgradeAllowed = TRUE;
  1106. } else {
  1107. CCAdvancedServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  1108. }
  1109. break;
  1110. case COMPLIANCE_INSTALLVAR_EVAL:
  1111. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSE) &&
  1112. (CompData->BuildNumberNt > DOTNET_BUILD_RC2) &&
  1113. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL) ) {
  1114. *FailureReason = COMPLIANCEERR_VERSION;
  1115. *UpgradeAllowed = FALSE;
  1116. } else {
  1117. CCAdvancedServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  1118. }
  1119. break;
  1120. default:
  1121. CCAdvancedServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  1122. break;
  1123. }
  1124. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  1125. }
  1126. #endif
  1127. BOOLEAN
  1128. CCAdvancedServerUpgCheck(
  1129. IN PCCMEDIA This,
  1130. IN PCOMPLIANCE_DATA CompData,
  1131. OUT PUINT FailureReason,
  1132. OUT PBOOL UpgradeAllowed )
  1133. /*++
  1134. Routine Description:
  1135. This routine checks whether the an installation is compliant with the
  1136. advanced server upgrade media.
  1137. Arguments:
  1138. This : advanced server media object pointer
  1139. CompData : compliance data describing details for an installation
  1140. FailureReason : receives the reason for failure, if any.
  1141. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  1142. or not
  1143. Return Value:
  1144. TRUE if the given install is compliant for installing using the
  1145. advanced server upgrade media, otherwise FALSE
  1146. --*/
  1147. {
  1148. DWORD CurrentSuite = 0;
  1149. DWORD SuitesToCheck = 0;
  1150. switch (CompData->InstallVariation) {
  1151. case COMPLIANCE_INSTALLVAR_NFR:
  1152. case COMPLIANCE_INSTALLVAR_EVAL:
  1153. *FailureReason = COMPLIANCEERR_VARIATION;
  1154. *UpgradeAllowed = FALSE;
  1155. break;
  1156. default:
  1157. switch (CompData->InstallType) {
  1158. case COMPLIANCE_INSTALLTYPE_NTS:
  1159. CurrentSuite = CompData->InstallSuite;
  1160. if (SUITE_INSTALLED(CurrentSuite, COMPLIANCE_INSTALLSUITE_ENT)) {
  1161. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_SRV)) {
  1162. *FailureReason = COMPLIANCEERR_NONE;
  1163. *UpgradeAllowed = TRUE;
  1164. } else {
  1165. *FailureReason = COMPLIANCEERR_VERSION;
  1166. *UpgradeAllowed = FALSE;
  1167. }
  1168. } else {
  1169. if (SUITE_INSTALLED(CurrentSuite, COMPLIANCE_INSTALLSUITE_NONE)) {
  1170. *FailureReason = COMPLIANCEERR_TYPE;
  1171. *UpgradeAllowed = FALSE;
  1172. } else {
  1173. *FailureReason = COMPLIANCEERR_SUITE;
  1174. *UpgradeAllowed = FALSE;
  1175. }
  1176. }
  1177. break;
  1178. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  1179. *FailureReason = COMPLIANCEERR_SUITE;
  1180. *UpgradeAllowed = FALSE;
  1181. break;
  1182. default:
  1183. CCAdvancedServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  1184. break;
  1185. }
  1186. break;
  1187. }
  1188. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  1189. }
  1190. BOOLEAN
  1191. CCDataCenterCheck(
  1192. IN PCCMEDIA This,
  1193. IN PCOMPLIANCE_DATA CompData,
  1194. OUT PUINT FailureReason,
  1195. OUT PBOOL UpgradeAllowed )
  1196. /*++
  1197. Routine Description:
  1198. This routine checks whether the an installation is compliant with the
  1199. datacenter media.
  1200. Arguments:
  1201. This : datacenter media object pointer
  1202. CompData : compliance data describing details for an installation
  1203. FailureReason : receives the reason for failure, if any.
  1204. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  1205. or not
  1206. Return Value:
  1207. TRUE if the given install is compliant for installing using the
  1208. datacenter media, otherwise FALSE
  1209. --*/
  1210. {
  1211. DWORD SuitesToCheck = 0;
  1212. switch (CompData->InstallType) {
  1213. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  1214. if (CompData->MinimumVersion < 500) {
  1215. *UpgradeAllowed = FALSE;
  1216. *FailureReason = COMPLIANCEERR_VERSION;
  1217. } else if (CompData->MinimumVersion == 500) {
  1218. if( (CompData->BuildNumberNt == 2195) &&
  1219. ((CompData->InstallVariation == COMPLIANCE_INSTALLVAR_CDRETAIL) ||
  1220. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM))) {
  1221. *UpgradeAllowed = TRUE;
  1222. if( (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM)) {
  1223. *FailureReason = COMPLIANCEERR_DTCWARNING;
  1224. } else {
  1225. *FailureReason = COMPLIANCEERR_NONE;
  1226. }
  1227. } else {
  1228. *UpgradeAllowed = FALSE;
  1229. *FailureReason = COMPLIANCEERR_VERSION;
  1230. }
  1231. } else {
  1232. switch (CompData->InstallVariation) {
  1233. case COMPLIANCE_INSTALLVAR_CDRETAIL:
  1234. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DOTNET_BUILD_RC1)) {
  1235. *FailureReason = COMPLIANCEERR_NONE;
  1236. *UpgradeAllowed = TRUE;
  1237. } else {
  1238. *FailureReason = COMPLIANCEERR_VERSION;
  1239. *UpgradeAllowed = FALSE;
  1240. }
  1241. break;
  1242. default:
  1243. *FailureReason = COMPLIANCEERR_VERSION;
  1244. *UpgradeAllowed = FALSE;
  1245. break;
  1246. }
  1247. }
  1248. break;
  1249. case COMPLIANCE_INSTALLTYPE_NTS:
  1250. case COMPLIANCE_INSTALLTYPE_NTSB:
  1251. case COMPLIANCE_INSTALLTYPE_NTSE:
  1252. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  1253. case COMPLIANCE_INSTALLTYPE_WIN9X:
  1254. case COMPLIANCE_INSTALLTYPE_WIN31:
  1255. case COMPLIANCE_INSTALLTYPE_NTWP:
  1256. case COMPLIANCE_INSTALLTYPE_NTW:
  1257. case COMPLIANCE_INSTALLTYPE_NTSBS:
  1258. case COMPLIANCE_INSTALLTYPE_NTSPOW:
  1259. *FailureReason = COMPLIANCEERR_TYPE;
  1260. *UpgradeAllowed = FALSE;
  1261. break;
  1262. default:
  1263. *UpgradeAllowed = FALSE;
  1264. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  1265. break;
  1266. }
  1267. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  1268. }
  1269. BOOLEAN
  1270. CCFullDataCenterCheck(
  1271. IN PCCMEDIA This,
  1272. IN PCOMPLIANCE_DATA CompData,
  1273. OUT PUINT FailureReason,
  1274. OUT PBOOL UpgradeAllowed )
  1275. /*++
  1276. Routine Description:
  1277. This routine checks whether the an installation is compliant with the
  1278. datacenter full media.
  1279. Arguments:
  1280. This : datacenter media object pointer
  1281. CompData : compliance data describing details for an installation
  1282. FailureReason : receives the reason for failure, if any.
  1283. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  1284. or not
  1285. Return Value:
  1286. TRUE if the given install is compliant for installing using the
  1287. datacenter full media, otherwise FALSE
  1288. --*/
  1289. {
  1290. switch (This->SourceVariation) {
  1291. case COMPLIANCE_INSTALLVAR_OEM:
  1292. if ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSDTC) &&
  1293. (CompData->MinimumVersion == 500) &&
  1294. (CompData->BuildNumberNt == 2195) &&
  1295. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM) ) {
  1296. *FailureReason = COMPLIANCEERR_NONE;
  1297. *UpgradeAllowed = TRUE;
  1298. } else if ( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSDTC) &&
  1299. (CompData->MinimumVersion == 500) &&
  1300. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_CDRETAIL) ) {
  1301. *FailureReason = COMPLIANCEERR_VERSION;
  1302. *UpgradeAllowed = FALSE;
  1303. } else if ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSDTC) &&
  1304. ((CompData->MinimumVersion == 501) || (CompData->MinimumVersion == 502)) &&
  1305. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_OEM) ) {
  1306. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber, DEFAULT_MINIMUM_VALIDBUILD_SRV)) {
  1307. *FailureReason = COMPLIANCEERR_NONE;
  1308. *UpgradeAllowed = TRUE;
  1309. } else {
  1310. *FailureReason = COMPLIANCEERR_VERSION;
  1311. *UpgradeAllowed = FALSE;
  1312. }
  1313. } else if ( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTSDTC) &&
  1314. ((CompData->MinimumVersion == 501) || (CompData->MinimumVersion == 502)) &&
  1315. (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_CDRETAIL) ) {
  1316. *FailureReason = COMPLIANCEERR_VERSION;
  1317. *UpgradeAllowed = FALSE;
  1318. } else{
  1319. CCDataCenterCheck(This, CompData, FailureReason, UpgradeAllowed);
  1320. }
  1321. break;
  1322. case COMPLIANCE_INSTALLVAR_EVAL:
  1323. *FailureReason = COMPLIANCEERR_TYPE;
  1324. *UpgradeAllowed = FALSE;
  1325. break;
  1326. default:
  1327. CCDataCenterCheck(This, CompData, FailureReason, UpgradeAllowed);
  1328. break;
  1329. }
  1330. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  1331. }
  1332. PCCMEDIA
  1333. CCMediaCreate(
  1334. IN DWORD SourceSKU,
  1335. IN DWORD SourceVariation,
  1336. IN OPTIONAL DWORD Version,
  1337. IN OPTIONAL DWORD BuildNumber )
  1338. /*++
  1339. Routine Description:
  1340. This routine creates a media object and binds the appropriate compliance
  1341. checking function to the media object.
  1342. Arguments:
  1343. SourceSKU : the kind of SKU
  1344. SourceVariation : the kind of variation (oem, msdn, retail etc)
  1345. Version : the version ((major ver + minor ver) * 100)
  1346. BuildNumber : the build number
  1347. Return Value:
  1348. A new allocated and initialized media object of the appropriate type if
  1349. the media type is supported otherwise NULL.
  1350. NOTE:
  1351. Once you are done with the object, free the media object using CCMemFree()
  1352. macro. This function uses factory design pattern.
  1353. --*/
  1354. {
  1355. PCCMEDIA SourceMedia = CCMemAlloc(sizeof(CCMEDIA));
  1356. if( !SourceMedia ) {
  1357. return SourceMedia;
  1358. }
  1359. SourceMedia->SourceVariation = SourceVariation;
  1360. SourceMedia->Version = Version;
  1361. SourceMedia->BuildNumber = BuildNumber;
  1362. switch (SourceSKU) {
  1363. case COMPLIANCE_SKU_NTWFULL:
  1364. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTW;
  1365. SourceMedia->StepUpMedia = FALSE;
  1366. SourceMedia->CheckInstall = CCFullProfessionalCheck;
  1367. break;
  1368. case COMPLIANCE_SKU_NTW32U:
  1369. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTW;
  1370. SourceMedia->StepUpMedia = TRUE;
  1371. SourceMedia->CheckInstall = CCProfessionalUpgCheck;
  1372. break;
  1373. case COMPLIANCE_SKU_NTWPFULL:
  1374. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTWP;
  1375. SourceMedia->StepUpMedia = FALSE;
  1376. SourceMedia->CheckInstall = CCFullPersonalCheck;
  1377. break;
  1378. case COMPLIANCE_SKU_NTWPU:
  1379. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTWP;
  1380. SourceMedia->StepUpMedia = TRUE;
  1381. SourceMedia->CheckInstall = CCPersonalUpgCheck;
  1382. break;
  1383. case COMPLIANCE_SKU_NTSB:
  1384. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSB;
  1385. SourceMedia->StepUpMedia = FALSE;
  1386. SourceMedia->CheckInstall = CCFullBladeServerCheck;
  1387. break;
  1388. case COMPLIANCE_SKU_NTSBU:
  1389. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSB;
  1390. SourceMedia->StepUpMedia = TRUE;
  1391. SourceMedia->CheckInstall = CCBladeServerUpgCheck;
  1392. break;
  1393. case COMPLIANCE_SKU_NTSBS:
  1394. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSBS;
  1395. SourceMedia->StepUpMedia = FALSE;
  1396. SourceMedia->CheckInstall = CCFullSmallBusinessServerCheck;
  1397. break;
  1398. case COMPLIANCE_SKU_NTSBSU:
  1399. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSBS;
  1400. SourceMedia->StepUpMedia = TRUE;
  1401. SourceMedia->CheckInstall = CCSmallBusinessServerUpgCheck;
  1402. break;
  1403. case COMPLIANCE_SKU_NTSFULL:
  1404. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTS;
  1405. SourceMedia->StepUpMedia = FALSE;
  1406. SourceMedia->CheckInstall = CCFullServerCheck;
  1407. break;
  1408. case COMPLIANCE_SKU_NTSU:
  1409. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTS;
  1410. SourceMedia->StepUpMedia = TRUE;
  1411. SourceMedia->CheckInstall = CCServerUpgCheck;
  1412. break;
  1413. case COMPLIANCE_SKU_NTSEFULL:
  1414. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSE;
  1415. SourceMedia->StepUpMedia = FALSE;
  1416. SourceMedia->CheckInstall = CCFullAdvancedServerCheck;
  1417. break;
  1418. case COMPLIANCE_SKU_NTSEU:
  1419. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSE;
  1420. SourceMedia->StepUpMedia = TRUE;
  1421. SourceMedia->CheckInstall = CCAdvancedServerUpgCheck;
  1422. break;
  1423. case COMPLIANCE_SKU_NTSDTC:
  1424. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSDTC;
  1425. SourceMedia->StepUpMedia = FALSE;
  1426. SourceMedia->CheckInstall = CCFullDataCenterCheck;
  1427. break;
  1428. default:
  1429. CCMemFree(SourceMedia);
  1430. SourceMedia = 0;
  1431. break;
  1432. }
  1433. return SourceMedia;
  1434. }
  1435. BOOLEAN
  1436. CCMediaInitialize(
  1437. OUT PCCMEDIA DestMedia,
  1438. IN DWORD Type,
  1439. IN DWORD Variation,
  1440. IN BOOLEAN StepupMedia,
  1441. IN OPTIONAL DWORD Version,
  1442. IN OPTIONAL DWORD BuildNumber)
  1443. /*++
  1444. Routine Description:
  1445. The routine initializes a CCMEDIA structure with the given values
  1446. particularly the binding of "CheckInstall" method based on "Type"
  1447. and "StepupMedia".
  1448. Arguments:
  1449. DestMedia - The media object which needs to be initialized
  1450. Type - The type of media object (eg. COMPLIANCE_INSTALLTYPE_NTS)
  1451. Variation - The variation of the media object (eg. COMPLIANCE_INSTALLVAR_CDRETAIL)
  1452. StepupMedia - TRUE if the media is a stepup media or FALSE otherwise
  1453. Version - Optional OS Version (major * 100 + minor)
  1454. BuildNumber - Optinal Build number of OS (eg. 2172)
  1455. Return Value:
  1456. TRUE if the given media object could be initialized otherwise FALSE.
  1457. --*/
  1458. {
  1459. BOOLEAN Result = FALSE;
  1460. if (DestMedia) {
  1461. Result = TRUE;
  1462. DestMedia->SourceType = Type;
  1463. DestMedia->SourceVariation = Variation;
  1464. DestMedia->StepUpMedia = StepupMedia;
  1465. DestMedia->Version = Version;
  1466. DestMedia->BuildNumber = BuildNumber;
  1467. DestMedia->CheckInstall = 0;
  1468. switch (Type) {
  1469. case COMPLIANCE_INSTALLTYPE_NTW:
  1470. DestMedia->CheckInstall = StepupMedia ?
  1471. CCProfessionalUpgCheck : CCFullProfessionalCheck;
  1472. break;
  1473. case COMPLIANCE_INSTALLTYPE_NTWP:
  1474. DestMedia->CheckInstall = StepupMedia ?
  1475. CCPersonalUpgCheck : CCFullPersonalCheck;
  1476. break;
  1477. case COMPLIANCE_INSTALLTYPE_NTSB:
  1478. DestMedia->CheckInstall = StepupMedia ?
  1479. CCBladeServerUpgCheck : CCFullBladeServerCheck;
  1480. break;
  1481. case COMPLIANCE_INSTALLTYPE_NTS:
  1482. DestMedia->CheckInstall = StepupMedia ?
  1483. CCServerUpgCheck : CCFullServerCheck;
  1484. break;
  1485. case COMPLIANCE_INSTALLTYPE_NTSE:
  1486. DestMedia->CheckInstall = StepupMedia ?
  1487. CCAdvancedServerUpgCheck : CCFullAdvancedServerCheck;
  1488. break;
  1489. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  1490. if (!StepupMedia) {
  1491. DestMedia->CheckInstall = CCFullDataCenterCheck;
  1492. } else {
  1493. Result = FALSE;
  1494. }
  1495. break;
  1496. default:
  1497. assert(FALSE);
  1498. Result = FALSE;
  1499. break;
  1500. }
  1501. }
  1502. return Result;
  1503. }