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.

1546 lines
47 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 2428
  51. static BOOL bDisableBuildCheck = FALSE;
  52. VOID
  53. CCDisableBuildCheck(
  54. VOID )
  55. {
  56. bDisableBuildCheck = TRUE;
  57. }
  58. //
  59. // indicates whether the build is allowed to upgrade
  60. //
  61. __inline
  62. BOOL
  63. IsValidBuild(
  64. IN DWORD InstallVersion,
  65. IN DWORD SourceInstallVersion )
  66. {
  67. BOOL Result = TRUE;
  68. if (bDisableBuildCheck) {
  69. Result = TRUE;
  70. } else if ((InstallVersion > 1381 && InstallVersion < 2031) ||
  71. (InstallVersion > 2195 && InstallVersion < DEFAULT_MINIMUM_VALIDBUILD) ||
  72. (InstallVersion > SourceInstallVersion)) {
  73. Result = FALSE;
  74. }
  75. return Result;
  76. }
  77. BOOLEAN
  78. CCProfessionalCheck(
  79. IN PCCMEDIA This,
  80. IN PCOMPLIANCE_DATA CompData,
  81. OUT PUINT FailureReason,
  82. OUT PBOOL UpgradeAllowed )
  83. /*++
  84. Routine Description:
  85. This routine checks whether the an installation is compliant with the
  86. professional media.
  87. Arguments:
  88. This : professional media object pointer
  89. CompData : compliance data describing details for an installation
  90. FailureReason : receives the reason for failure, if any.
  91. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  92. or not
  93. Return Value:
  94. TRUE if the given install is compliant for installing using the
  95. professional media, otherwise FALSE
  96. --*/
  97. {
  98. switch (CompData->InstallType) {
  99. case COMPLIANCE_INSTALLTYPE_NTWP:
  100. case COMPLIANCE_INSTALLTYPE_NTW:
  101. if (CompData->MinimumVersion < 400) {
  102. *FailureReason = COMPLIANCEERR_VERSION;
  103. *UpgradeAllowed = FALSE;
  104. } else {
  105. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  106. *FailureReason = COMPLIANCEERR_NONE;
  107. *UpgradeAllowed = TRUE;
  108. } else {
  109. *FailureReason = COMPLIANCEERR_VERSION;
  110. *UpgradeAllowed = FALSE;
  111. }
  112. }
  113. break;
  114. case COMPLIANCE_INSTALLTYPE_WIN9X:
  115. // note: 401 is 4.1
  116. if (CompData->MinimumVersion < 401) {
  117. *FailureReason = COMPLIANCEERR_VERSION;
  118. *UpgradeAllowed = FALSE;
  119. } else {
  120. *FailureReason = COMPLIANCEERR_NONE;
  121. *UpgradeAllowed = TRUE;
  122. }
  123. break;
  124. case COMPLIANCE_INSTALLTYPE_WIN31:
  125. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  126. case COMPLIANCE_INSTALLTYPE_NTS:
  127. case COMPLIANCE_INSTALLTYPE_NTSB:
  128. case COMPLIANCE_INSTALLTYPE_NTSE:
  129. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  130. case COMPLIANCE_INSTALLTYPE_NTSBS:
  131. *FailureReason = COMPLIANCEERR_TYPE;
  132. *UpgradeAllowed = FALSE;
  133. break;
  134. default:
  135. *UpgradeAllowed = FALSE;
  136. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  137. break;
  138. }
  139. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  140. }
  141. BOOLEAN
  142. CCFullProfessionalCheck(
  143. IN PCCMEDIA This,
  144. IN PCOMPLIANCE_DATA CompData,
  145. OUT PUINT FailureReason,
  146. OUT PBOOL UpgradeAllowed )
  147. /*++
  148. Routine Description:
  149. This routine checks whether the an installation is compliant with the
  150. professional full media.
  151. Arguments:
  152. This : professional media object pointer
  153. CompData : compliance data describing details for an installation
  154. FailureReason : receives the reason for failure, if any.
  155. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  156. or not
  157. Return Value:
  158. TRUE if the given install is compliant for installing using the
  159. professional full media, otherwise FALSE
  160. --*/
  161. {
  162. switch (This->SourceVariation) {
  163. case COMPLIANCE_INSTALLVAR_OEM:
  164. if ( ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_WIN9X) && (CompData->MinimumVersion > 400) && (CompData->MinimumVersion <= 490)) ||
  165. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 400)) ||
  166. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 500)) ||
  167. (((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) || (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) )
  168. && (CompData->MinimumVersion == 501)
  169. && (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) ){
  170. *FailureReason = COMPLIANCEERR_VARIATION;
  171. *UpgradeAllowed = FALSE;
  172. } else {
  173. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  174. }
  175. break;
  176. case COMPLIANCE_INSTALLVAR_EVAL:
  177. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) &&
  178. (CompData->MinimumVersion >= 501) &&
  179. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL)) {
  180. *FailureReason = COMPLIANCEERR_VARIATION;
  181. *UpgradeAllowed = FALSE;
  182. }
  183. else {
  184. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  185. }
  186. break;
  187. default:
  188. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  189. break;
  190. }
  191. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  192. }
  193. BOOLEAN
  194. CCProfessionalUpgCheck(
  195. IN PCCMEDIA This,
  196. IN PCOMPLIANCE_DATA CompData,
  197. OUT PUINT FailureReason,
  198. OUT PBOOL UpgradeAllowed )
  199. /*++
  200. Routine Description:
  201. This routine checks whether the an installation is compliant with the
  202. professional upgrade media.
  203. Arguments:
  204. This : professional media object pointer
  205. CompData : compliance data describing details for an installation
  206. FailureReason : receives the reason for failure, if any.
  207. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  208. or not
  209. Return Value:
  210. TRUE if the given install is compliant for installing using the
  211. professional upgrade media, otherwise FALSE
  212. --*/
  213. {
  214. if (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_NFR) {
  215. *FailureReason = COMPLIANCEERR_VARIATION;
  216. *UpgradeAllowed = FALSE;
  217. } else {
  218. switch (This->SourceVariation) {
  219. case COMPLIANCE_INSTALLVAR_OEM:
  220. if ( ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_WIN9X) && (CompData->MinimumVersion > 400) && (CompData->MinimumVersion <= 490)) ||
  221. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 400)) ||
  222. ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) && (CompData->MinimumVersion == 500) && (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) ||
  223. (((CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTW) || (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) )
  224. && (CompData->MinimumVersion == 501)
  225. && (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) ){
  226. *FailureReason = COMPLIANCEERR_VARIATION;
  227. *UpgradeAllowed = FALSE;
  228. } else {
  229. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  230. }
  231. break;
  232. default:
  233. CCProfessionalCheck(This, CompData, FailureReason, UpgradeAllowed);
  234. break;
  235. }
  236. }
  237. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  238. }
  239. BOOLEAN
  240. CCPersonalCheck(
  241. IN PCCMEDIA This,
  242. IN PCOMPLIANCE_DATA CompData,
  243. OUT PUINT FailureReason,
  244. OUT PBOOL UpgradeAllowed )
  245. /*++
  246. Routine Description:
  247. This routine checks whether the an installation is compliant with the
  248. personal media.
  249. Arguments:
  250. This : personal media object pointer
  251. CompData : compliance data describing details for an installation
  252. FailureReason : receives the reason for failure, if any.
  253. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  254. or not
  255. Return Value:
  256. TRUE if the given install is compliant for installing using the
  257. personal media, otherwise FALSE
  258. --*/
  259. {
  260. switch (CompData->InstallType) {
  261. case COMPLIANCE_INSTALLTYPE_WIN9X:
  262. // note: 401 is version 4.1
  263. if (CompData->MinimumVersion < 401) {
  264. *FailureReason = COMPLIANCEERR_VERSION;
  265. *UpgradeAllowed = FALSE;
  266. } else {
  267. *FailureReason = COMPLIANCEERR_NONE;
  268. *UpgradeAllowed = TRUE;
  269. }
  270. break;
  271. case COMPLIANCE_INSTALLTYPE_NTWP:
  272. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  273. *FailureReason = COMPLIANCEERR_NONE;
  274. *UpgradeAllowed = TRUE;
  275. } else {
  276. *FailureReason = COMPLIANCEERR_VERSION;
  277. *UpgradeAllowed = FALSE;
  278. }
  279. break;
  280. case COMPLIANCE_INSTALLTYPE_WIN31:
  281. case COMPLIANCE_INSTALLTYPE_NTW:
  282. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  283. case COMPLIANCE_INSTALLTYPE_NTS:
  284. case COMPLIANCE_INSTALLTYPE_NTSB:
  285. case COMPLIANCE_INSTALLTYPE_NTSE:
  286. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  287. case COMPLIANCE_INSTALLTYPE_NTSBS:
  288. *FailureReason = COMPLIANCEERR_TYPE;
  289. *UpgradeAllowed = FALSE;
  290. break;
  291. default:
  292. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  293. *UpgradeAllowed = FALSE;
  294. break;
  295. }
  296. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  297. }
  298. BOOLEAN
  299. CCFullPersonalCheck(
  300. IN PCCMEDIA This,
  301. IN PCOMPLIANCE_DATA CompData,
  302. OUT PUINT FailureReason,
  303. OUT PBOOL UpgradeAllowed )
  304. /*++
  305. Routine Description:
  306. This routine checks whether the an installation is compliant with the
  307. personal full media.
  308. Arguments:
  309. This : personal media object pointer
  310. CompData : compliance data describing details for an installation
  311. FailureReason : receives the reason for failure, if any.
  312. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  313. or not
  314. Return Value:
  315. TRUE if the given install is compliant for installing using the
  316. personal full media, otherwise FALSE
  317. --*/
  318. {
  319. switch (This->SourceVariation) {
  320. case COMPLIANCE_INSTALLVAR_OEM:
  321. if ((CompData->InstallType == COMPLIANCE_INSTALLTYPE_WIN9X) && (CompData->MinimumVersion > 400) && (CompData->MinimumVersion <= 490)) {
  322. *FailureReason = COMPLIANCEERR_VARIATION;
  323. *UpgradeAllowed = FALSE;
  324. } else if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) &&
  325. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) {
  326. *FailureReason = COMPLIANCEERR_VARIATION;
  327. *UpgradeAllowed = FALSE;
  328. }
  329. else {
  330. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  331. }
  332. break;
  333. case COMPLIANCE_INSTALLVAR_EVAL:
  334. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) &&
  335. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_EVAL)) {
  336. *FailureReason = COMPLIANCEERR_VARIATION;
  337. *UpgradeAllowed = FALSE;
  338. }
  339. else {
  340. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  341. }
  342. break;
  343. default:
  344. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  345. break;
  346. }
  347. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  348. }
  349. BOOLEAN
  350. CCPersonalUpgCheck(
  351. IN PCCMEDIA This,
  352. IN PCOMPLIANCE_DATA CompData,
  353. OUT PUINT FailureReason,
  354. OUT PBOOL UpgradeAllowed )
  355. /*++
  356. Routine Description:
  357. This routine checks whether the an installation is compliant with the
  358. personal upgrade media.
  359. Arguments:
  360. This : personal media object pointer
  361. CompData : compliance data describing details for an installation
  362. FailureReason : receives the reason for failure, if any.
  363. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  364. or not
  365. Return Value:
  366. TRUE if the given install is compliant for installing using the
  367. personal upgrade media, otherwise FALSE
  368. --*/
  369. {
  370. if (CompData->InstallVariation == COMPLIANCE_INSTALLVAR_NFR) {
  371. *FailureReason = COMPLIANCEERR_VARIATION;
  372. *UpgradeAllowed = FALSE;
  373. } else {
  374. switch (This->SourceVariation) {
  375. case COMPLIANCE_INSTALLVAR_OEM:
  376. if( (CompData->InstallType == COMPLIANCE_INSTALLTYPE_NTWP) &&
  377. (CompData->InstallVariation != COMPLIANCE_INSTALLVAR_OEM)) {
  378. *FailureReason = COMPLIANCEERR_VARIATION;
  379. *UpgradeAllowed = FALSE;
  380. }
  381. else {
  382. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  383. }
  384. break;
  385. default:
  386. CCPersonalCheck(This, CompData, FailureReason, UpgradeAllowed);
  387. break;
  388. }
  389. }
  390. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  391. }
  392. BOOLEAN
  393. CCBladeServerCheck(
  394. IN PCCMEDIA This,
  395. IN PCOMPLIANCE_DATA CompData,
  396. OUT PUINT FailureReason,
  397. OUT PBOOL UpgradeAllowed )
  398. /*++
  399. Routine Description:
  400. This routine checks whether the an installation is compliant with the
  401. blade server media. Policy is to allow blade server to be installed on
  402. older version of blade or on Windows Powered boxes (ADS w/EMBED suite).
  403. Arguments:
  404. This : server media object pointer
  405. CompData : compliance data describing details for an installation
  406. FailureReason : receives the reason for failure, if any.
  407. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  408. or not
  409. Return Value:
  410. TRUE if the given install is compliant for installing using the
  411. blade server media, otherwise FALSE
  412. --*/
  413. {
  414. DWORD SuitesToCheck = 0;
  415. switch (CompData->InstallType) {
  416. case COMPLIANCE_INSTALLTYPE_NTSB:
  417. if (CompData->MinimumVersion < 500) {
  418. *UpgradeAllowed = FALSE;
  419. *FailureReason = COMPLIANCEERR_VERSION;
  420. } else {
  421. switch (CompData->InstallVariation) {
  422. case COMPLIANCE_INSTALLVAR_CDRETAIL:
  423. case COMPLIANCE_INSTALLVAR_FLOPPYRETAIL:
  424. case COMPLIANCE_INSTALLVAR_OEM:
  425. case COMPLIANCE_INSTALLVAR_SELECT:
  426. case COMPLIANCE_INSTALLVAR_NFR:
  427. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  428. *FailureReason = COMPLIANCEERR_NONE;
  429. *UpgradeAllowed = TRUE;
  430. } else {
  431. *FailureReason = COMPLIANCEERR_VERSION;
  432. *UpgradeAllowed = FALSE;
  433. }
  434. break;
  435. default:
  436. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  437. *UpgradeAllowed = FALSE;
  438. break;
  439. }
  440. }
  441. break;
  442. case COMPLIANCE_INSTALLTYPE_NTSE:
  443. SuitesToCheck = (COMPLIANCE_INSTALLSUITE_EMBED);
  444. if (!SUITE_INSTALLED(CompData->InstallSuite, SuitesToCheck)) {
  445. *FailureReason = COMPLIANCEERR_SUITE;
  446. *UpgradeAllowed = FALSE;
  447. } else {
  448. if (CompData->MinimumVersion < 400) {
  449. *FailureReason = COMPLIANCEERR_VERSION;
  450. *UpgradeAllowed = FALSE;
  451. } else {
  452. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  453. *FailureReason = COMPLIANCEERR_NONE;
  454. *UpgradeAllowed = TRUE;
  455. } else {
  456. *FailureReason = COMPLIANCEERR_VERSION;
  457. *UpgradeAllowed = FALSE;
  458. }
  459. }
  460. }
  461. break;
  462. case COMPLIANCE_INSTALLTYPE_WIN9X:
  463. case COMPLIANCE_INSTALLTYPE_WIN31:
  464. case COMPLIANCE_INSTALLTYPE_NTWP:
  465. case COMPLIANCE_INSTALLTYPE_NTW:
  466. case COMPLIANCE_INSTALLTYPE_NTS:
  467. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  468. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  469. case COMPLIANCE_INSTALLTYPE_NTSBS:
  470. *FailureReason = COMPLIANCEERR_TYPE;
  471. *UpgradeAllowed = FALSE;
  472. break;
  473. default:
  474. *UpgradeAllowed = FALSE;
  475. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  476. break;
  477. }
  478. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  479. }
  480. BOOLEAN
  481. CCFullBladeServerCheck(
  482. IN PCCMEDIA This,
  483. IN PCOMPLIANCE_DATA CompData,
  484. OUT PUINT FailureReason,
  485. OUT PBOOL UpgradeAllowed )
  486. /*++
  487. Routine Description:
  488. This routine checks whether the an installation is compliant with the
  489. blade server full media.
  490. Arguments:
  491. This : server media object pointer
  492. CompData : compliance data describing details for an installation
  493. FailureReason : receives the reason for failure, if any.
  494. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  495. or not
  496. Return Value:
  497. TRUE if the given install is compliant for installing using the
  498. blade server media, otherwise FALSE
  499. --*/
  500. {
  501. CCBladeServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  502. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  503. }
  504. BOOLEAN
  505. CCBladeServerUpgCheck(
  506. IN PCCMEDIA This,
  507. IN PCOMPLIANCE_DATA CompData,
  508. OUT PUINT FailureReason,
  509. OUT PBOOL UpgradeAllowed )
  510. /*++
  511. Routine Description:
  512. This routine checks whether the an installation is compliant with the
  513. blade server upgrade media.
  514. Arguments:
  515. This : server media object pointer
  516. CompData : compliance data describing details for an installation
  517. FailureReason : receives the reason for failure, if any.
  518. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  519. or not
  520. Return Value:
  521. TRUE if the given install is compliant for installing using the
  522. blade server upgrade media, otherwise FALSE
  523. --*/
  524. {
  525. switch (CompData->InstallVariation) {
  526. case COMPLIANCE_INSTALLVAR_NFR:
  527. case COMPLIANCE_INSTALLVAR_EVAL:
  528. *FailureReason = COMPLIANCEERR_VARIATION;
  529. *UpgradeAllowed = FALSE;
  530. break;
  531. default:
  532. CCBladeServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  533. break;
  534. }
  535. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  536. }
  537. BOOLEAN
  538. CCSmallBusinessServerCheck(
  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 media. Policy is to only allow Whistler SBS to upgrade Win2k Server,
  547. Whistler Server, and SBS 2k.
  548. Arguments:
  549. This : server media object pointer
  550. CompData : compliance data describing details for an installation
  551. FailureReason : receives the reason for failure, if any.
  552. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  553. or not
  554. Return Value:
  555. TRUE if the given install is compliant for installing using the
  556. blade server media, otherwise FALSE
  557. --*/
  558. {
  559. DWORD SuitesToCheck = 0;
  560. switch (CompData->InstallType) {
  561. case COMPLIANCE_INSTALLTYPE_NTS:
  562. case COMPLIANCE_INSTALLTYPE_NTSBS:
  563. if (CompData->MinimumVersion < 2195) {
  564. *UpgradeAllowed = FALSE;
  565. *FailureReason = COMPLIANCEERR_VERSION;
  566. } else {
  567. *FailureReason = COMPLIANCEERR_NONE;
  568. *UpgradeAllowed = TRUE;
  569. }
  570. break;
  571. case COMPLIANCE_INSTALLTYPE_WIN9X:
  572. case COMPLIANCE_INSTALLTYPE_WIN31:
  573. case COMPLIANCE_INSTALLTYPE_NTWP:
  574. case COMPLIANCE_INSTALLTYPE_NTW:
  575. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  576. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  577. case COMPLIANCE_INSTALLTYPE_NTSB:
  578. *FailureReason = COMPLIANCEERR_TYPE;
  579. *UpgradeAllowed = FALSE;
  580. break;
  581. default:
  582. *UpgradeAllowed = FALSE;
  583. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  584. break;
  585. }
  586. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  587. }
  588. BOOLEAN
  589. CCFullSmallBusinessServerCheck(
  590. IN PCCMEDIA This,
  591. IN PCOMPLIANCE_DATA CompData,
  592. OUT PUINT FailureReason,
  593. OUT PBOOL UpgradeAllowed )
  594. /*++
  595. Routine Description:
  596. This routine checks whether the an installation is compliant with the
  597. blade server full media.
  598. Arguments:
  599. This : server media object pointer
  600. CompData : compliance data describing details for an installation
  601. FailureReason : receives the reason for failure, if any.
  602. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  603. or not
  604. Return Value:
  605. TRUE if the given install is compliant for installing using the
  606. blade server media, otherwise FALSE
  607. --*/
  608. {
  609. CCSmallBusinessServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  610. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  611. }
  612. BOOLEAN
  613. CCSmallBusinessServerUpgCheck(
  614. IN PCCMEDIA This,
  615. IN PCOMPLIANCE_DATA CompData,
  616. OUT PUINT FailureReason,
  617. OUT PBOOL UpgradeAllowed )
  618. /*++
  619. Routine Description:
  620. This routine checks whether the an installation is compliant with the
  621. blade server upgrade media.
  622. Arguments:
  623. This : server media object pointer
  624. CompData : compliance data describing details for an installation
  625. FailureReason : receives the reason for failure, if any.
  626. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  627. or not
  628. Return Value:
  629. TRUE if the given install is compliant for installing using the
  630. blade server upgrade media, otherwise FALSE
  631. --*/
  632. {
  633. switch (CompData->InstallVariation) {
  634. case COMPLIANCE_INSTALLVAR_NFR:
  635. case COMPLIANCE_INSTALLVAR_EVAL:
  636. *FailureReason = COMPLIANCEERR_VARIATION;
  637. *UpgradeAllowed = FALSE;
  638. break;
  639. default:
  640. CCSmallBusinessServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  641. break;
  642. }
  643. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  644. }
  645. BOOLEAN
  646. CCServerCheck(
  647. IN PCCMEDIA This,
  648. IN PCOMPLIANCE_DATA CompData,
  649. OUT PUINT FailureReason,
  650. OUT PBOOL UpgradeAllowed )
  651. /*++
  652. Routine Description:
  653. This routine checks whether the an installation is compliant with the
  654. server media.
  655. Arguments:
  656. This : server media object pointer
  657. CompData : compliance data describing details for an installation
  658. FailureReason : receives the reason for failure, if any.
  659. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  660. or not
  661. Return Value:
  662. TRUE if the given install is compliant for installing using the
  663. server media, otherwise FALSE
  664. --*/
  665. {
  666. DWORD SuitesToCheck = 0;
  667. switch (CompData->InstallType) {
  668. case COMPLIANCE_INSTALLTYPE_NTS:
  669. SuitesToCheck = (COMPLIANCE_INSTALLSUITE_ENT |
  670. COMPLIANCE_INSTALLSUITE_SBS |
  671. COMPLIANCE_INSTALLSUITE_SBSR |
  672. COMPLIANCE_INSTALLSUITE_BACK);
  673. if (SUITE_INSTALLED(CompData->InstallSuite, SuitesToCheck)) {
  674. *FailureReason = COMPLIANCEERR_SUITE;
  675. *UpgradeAllowed = FALSE;
  676. } else {
  677. if (CompData->MinimumVersion < 400) {
  678. *FailureReason = COMPLIANCEERR_VERSION;
  679. *UpgradeAllowed = FALSE;
  680. } else {
  681. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  682. *FailureReason = COMPLIANCEERR_NONE;
  683. *UpgradeAllowed = TRUE;
  684. } else {
  685. *FailureReason = COMPLIANCEERR_VERSION;
  686. *UpgradeAllowed = FALSE;
  687. }
  688. }
  689. }
  690. break;
  691. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  692. if (CompData->BuildNumberNt < 1381) {
  693. *FailureReason = COMPLIANCEERR_SUITE;
  694. *UpgradeAllowed = FALSE;
  695. } else {
  696. *FailureReason = COMPLIANCEERR_NONE;
  697. *UpgradeAllowed = TRUE;
  698. }
  699. break;
  700. case COMPLIANCE_INSTALLTYPE_WIN9X:
  701. case COMPLIANCE_INSTALLTYPE_WIN31:
  702. case COMPLIANCE_INSTALLTYPE_NTWP:
  703. case COMPLIANCE_INSTALLTYPE_NTW:
  704. case COMPLIANCE_INSTALLTYPE_NTSB:
  705. case COMPLIANCE_INSTALLTYPE_NTSE:
  706. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  707. case COMPLIANCE_INSTALLTYPE_NTSBS:
  708. *FailureReason = COMPLIANCEERR_TYPE;
  709. *UpgradeAllowed = FALSE;
  710. break;
  711. default:
  712. *UpgradeAllowed = FALSE;
  713. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  714. break;
  715. }
  716. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  717. }
  718. BOOLEAN
  719. CCFullServerCheck(
  720. IN PCCMEDIA This,
  721. IN PCOMPLIANCE_DATA CompData,
  722. OUT PUINT FailureReason,
  723. OUT PBOOL UpgradeAllowed )
  724. /*++
  725. Routine Description:
  726. This routine checks whether the an installation is compliant with the
  727. server full media.
  728. Arguments:
  729. This : server media object pointer
  730. CompData : compliance data describing details for an installation
  731. FailureReason : receives the reason for failure, if any.
  732. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  733. or not
  734. Return Value:
  735. TRUE if the given install is compliant for installing using the
  736. server media, otherwise FALSE
  737. --*/
  738. {
  739. CCServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  740. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  741. }
  742. BOOLEAN
  743. CCServerUpgCheck(
  744. IN PCCMEDIA This,
  745. IN PCOMPLIANCE_DATA CompData,
  746. OUT PUINT FailureReason,
  747. OUT PBOOL UpgradeAllowed )
  748. /*++
  749. Routine Description:
  750. This routine checks whether the an installation is compliant with the
  751. server upgrade media.
  752. Arguments:
  753. This : server media object pointer
  754. CompData : compliance data describing details for an installation
  755. FailureReason : receives the reason for failure, if any.
  756. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  757. or not
  758. Return Value:
  759. TRUE if the given install is compliant for installing using the
  760. server upgrade media, otherwise FALSE
  761. --*/
  762. {
  763. switch (CompData->InstallVariation) {
  764. case COMPLIANCE_INSTALLVAR_NFR:
  765. case COMPLIANCE_INSTALLVAR_EVAL:
  766. *FailureReason = COMPLIANCEERR_VARIATION;
  767. *UpgradeAllowed = FALSE;
  768. break;
  769. default:
  770. CCServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  771. break;
  772. }
  773. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  774. }
  775. BOOLEAN
  776. CCAdvancedServerCheck(
  777. IN PCCMEDIA This,
  778. IN PCOMPLIANCE_DATA CompData,
  779. OUT PUINT FailureReason,
  780. OUT PBOOL UpgradeAllowed )
  781. /*++
  782. Routine Description:
  783. This routine checks whether the an installation is compliant with the
  784. advanced server media.
  785. Arguments:
  786. This : advanced server media object pointer
  787. CompData : compliance data describing details for an installation
  788. FailureReason : receives the reason for failure, if any.
  789. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  790. or not
  791. Return Value:
  792. TRUE if the given install is compliant for installing using the
  793. advanced server media, otherwise FALSE
  794. --*/
  795. {
  796. DWORD SuitesToCheck = 0;
  797. switch (CompData->InstallType) {
  798. case COMPLIANCE_INSTALLTYPE_NTS:
  799. // note: 501 is version 5.1 because of calculation major*100 + minor
  800. if (CompData->MinimumVersion < 501 && CompData->MinimumVersion > 351) {
  801. SuitesToCheck = (COMPLIANCE_INSTALLSUITE_SBS |
  802. COMPLIANCE_INSTALLSUITE_SBSR |
  803. COMPLIANCE_INSTALLSUITE_BACK);
  804. if (SUITE_INSTALLED(CompData->InstallSuite, SuitesToCheck)) {
  805. *FailureReason = COMPLIANCEERR_SUITE;
  806. *UpgradeAllowed = FALSE;
  807. } else {
  808. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  809. *FailureReason = COMPLIANCEERR_NONE;
  810. *UpgradeAllowed = TRUE;
  811. } else {
  812. *FailureReason = COMPLIANCEERR_VERSION;
  813. *UpgradeAllowed = FALSE;
  814. }
  815. }
  816. } else {
  817. *FailureReason = COMPLIANCEERR_VERSION;
  818. *UpgradeAllowed = FALSE;
  819. }
  820. break;
  821. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  822. if (CompData->BuildNumberNt < 1381) {
  823. *FailureReason = COMPLIANCEERR_SUITE;
  824. *UpgradeAllowed = FALSE;
  825. } else {
  826. *FailureReason = COMPLIANCEERR_NONE;
  827. *UpgradeAllowed = TRUE;
  828. }
  829. break;
  830. case COMPLIANCE_INSTALLTYPE_NTSE:
  831. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  832. *FailureReason = COMPLIANCEERR_NONE;
  833. *UpgradeAllowed = TRUE;
  834. } else {
  835. *FailureReason = COMPLIANCEERR_VERSION;
  836. *UpgradeAllowed = FALSE;
  837. }
  838. break;
  839. case COMPLIANCE_INSTALLTYPE_WIN9X:
  840. case COMPLIANCE_INSTALLTYPE_WIN31:
  841. case COMPLIANCE_INSTALLTYPE_NTWP:
  842. case COMPLIANCE_INSTALLTYPE_NTW:
  843. case COMPLIANCE_INSTALLTYPE_NTSB:
  844. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  845. case COMPLIANCE_INSTALLTYPE_NTSBS:
  846. *FailureReason = COMPLIANCEERR_TYPE;
  847. *UpgradeAllowed = FALSE;
  848. break;
  849. default:
  850. *UpgradeAllowed = FALSE;
  851. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  852. break;
  853. }
  854. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  855. }
  856. BOOLEAN
  857. CCFullAdvancedServerCheck(
  858. IN PCCMEDIA This,
  859. IN PCOMPLIANCE_DATA CompData,
  860. OUT PUINT FailureReason,
  861. OUT PBOOL UpgradeAllowed )
  862. /*++
  863. Routine Description:
  864. This routine checks whether the an installation is compliant with the
  865. advanced server full media.
  866. Arguments:
  867. This : advanced server media object pointer
  868. CompData : compliance data describing details for an installation
  869. FailureReason : receives the reason for failure, if any.
  870. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  871. or not
  872. Return Value:
  873. TRUE if the given install is compliant for installing using the
  874. advanced server full media, otherwise FALSE
  875. --*/
  876. {
  877. CCAdvancedServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  878. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  879. }
  880. BOOLEAN
  881. CCAdvancedServerUpgCheck(
  882. IN PCCMEDIA This,
  883. IN PCOMPLIANCE_DATA CompData,
  884. OUT PUINT FailureReason,
  885. OUT PBOOL UpgradeAllowed )
  886. /*++
  887. Routine Description:
  888. This routine checks whether the an installation is compliant with the
  889. advanced server upgrade media.
  890. Arguments:
  891. This : advanced server media object pointer
  892. CompData : compliance data describing details for an installation
  893. FailureReason : receives the reason for failure, if any.
  894. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  895. or not
  896. Return Value:
  897. TRUE if the given install is compliant for installing using the
  898. advanced server upgrade media, otherwise FALSE
  899. --*/
  900. {
  901. DWORD CurrentSuite = 0;
  902. DWORD SuitesToCheck = 0;
  903. switch (CompData->InstallVariation) {
  904. case COMPLIANCE_INSTALLVAR_NFR:
  905. case COMPLIANCE_INSTALLVAR_EVAL:
  906. *FailureReason = COMPLIANCEERR_VARIATION;
  907. *UpgradeAllowed = FALSE;
  908. break;
  909. default:
  910. switch (CompData->InstallType) {
  911. case COMPLIANCE_INSTALLTYPE_NTS:
  912. CurrentSuite = CompData->InstallSuite;
  913. if (SUITE_INSTALLED(CurrentSuite, COMPLIANCE_INSTALLSUITE_ENT)) {
  914. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  915. *FailureReason = COMPLIANCEERR_NONE;
  916. *UpgradeAllowed = TRUE;
  917. } else {
  918. *FailureReason = COMPLIANCEERR_VERSION;
  919. *UpgradeAllowed = FALSE;
  920. }
  921. } else {
  922. if (SUITE_INSTALLED(CurrentSuite, COMPLIANCE_INSTALLSUITE_NONE)) {
  923. *FailureReason = COMPLIANCEERR_TYPE;
  924. *UpgradeAllowed = FALSE;
  925. } else {
  926. *FailureReason = COMPLIANCEERR_SUITE;
  927. *UpgradeAllowed = FALSE;
  928. }
  929. }
  930. break;
  931. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  932. *FailureReason = COMPLIANCEERR_SUITE;
  933. *UpgradeAllowed = FALSE;
  934. break;
  935. default:
  936. CCAdvancedServerCheck(This, CompData, FailureReason, UpgradeAllowed);
  937. break;
  938. }
  939. break;
  940. }
  941. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  942. }
  943. BOOLEAN
  944. CCDataCenterCheck(
  945. IN PCCMEDIA This,
  946. IN PCOMPLIANCE_DATA CompData,
  947. OUT PUINT FailureReason,
  948. OUT PBOOL UpgradeAllowed )
  949. /*++
  950. Routine Description:
  951. This routine checks whether the an installation is compliant with the
  952. datacenter media.
  953. Arguments:
  954. This : datacenter media object pointer
  955. CompData : compliance data describing details for an installation
  956. FailureReason : receives the reason for failure, if any.
  957. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  958. or not
  959. Return Value:
  960. TRUE if the given install is compliant for installing using the
  961. datacenter media, otherwise FALSE
  962. --*/
  963. {
  964. DWORD SuitesToCheck = 0;
  965. switch (CompData->InstallType) {
  966. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  967. if (CompData->MinimumVersion < 500) {
  968. *UpgradeAllowed = FALSE;
  969. *FailureReason = COMPLIANCEERR_VERSION;
  970. } else {
  971. switch (CompData->InstallVariation) {
  972. case COMPLIANCE_INSTALLVAR_CDRETAIL:
  973. case COMPLIANCE_INSTALLVAR_FLOPPYRETAIL:
  974. case COMPLIANCE_INSTALLVAR_OEM:
  975. case COMPLIANCE_INSTALLVAR_SELECT:
  976. case COMPLIANCE_INSTALLVAR_NFR:
  977. if (IsValidBuild(CompData->BuildNumberNt, This->BuildNumber)) {
  978. *FailureReason = COMPLIANCEERR_NONE;
  979. *UpgradeAllowed = TRUE;
  980. } else {
  981. *FailureReason = COMPLIANCEERR_VERSION;
  982. *UpgradeAllowed = FALSE;
  983. }
  984. break;
  985. default:
  986. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  987. *UpgradeAllowed = FALSE;
  988. break;
  989. }
  990. }
  991. break;
  992. case COMPLIANCE_INSTALLTYPE_NTS:
  993. case COMPLIANCE_INSTALLTYPE_NTSB:
  994. case COMPLIANCE_INSTALLTYPE_NTSE:
  995. case COMPLIANCE_INSTALLTYPE_NTSTSE:
  996. case COMPLIANCE_INSTALLTYPE_WIN9X:
  997. case COMPLIANCE_INSTALLTYPE_WIN31:
  998. case COMPLIANCE_INSTALLTYPE_NTWP:
  999. case COMPLIANCE_INSTALLTYPE_NTW:
  1000. case COMPLIANCE_INSTALLTYPE_NTSBS:
  1001. *FailureReason = COMPLIANCEERR_TYPE;
  1002. *UpgradeAllowed = FALSE;
  1003. break;
  1004. default:
  1005. *UpgradeAllowed = FALSE;
  1006. *FailureReason = COMPLIANCEERR_UNKNOWNTARGET;
  1007. break;
  1008. }
  1009. return (*FailureReason == COMPLIANCEERR_NONE) ? TRUE : FALSE;
  1010. }
  1011. BOOLEAN
  1012. CCFullDataCenterCheck(
  1013. IN PCCMEDIA This,
  1014. IN PCOMPLIANCE_DATA CompData,
  1015. OUT PUINT FailureReason,
  1016. OUT PBOOL UpgradeAllowed )
  1017. /*++
  1018. Routine Description:
  1019. This routine checks whether the an installation is compliant with the
  1020. datacenter full media.
  1021. Arguments:
  1022. This : datacenter media object pointer
  1023. CompData : compliance data describing details for an installation
  1024. FailureReason : receives the reason for failure, if any.
  1025. UpgradeAllowed : receives a bool indicating whether upgrade is allowed
  1026. or not
  1027. Return Value:
  1028. TRUE if the given install is compliant for installing using the
  1029. datacenter full media, otherwise FALSE
  1030. --*/
  1031. {
  1032. CCDataCenterCheck(This, CompData, FailureReason, UpgradeAllowed);
  1033. return (*FailureReason != COMPLIANCEERR_UNKNOWNTARGET) ? TRUE : FALSE;
  1034. }
  1035. PCCMEDIA
  1036. CCMediaCreate(
  1037. IN DWORD SourceSKU,
  1038. IN DWORD SourceVariation,
  1039. IN OPTIONAL DWORD Version,
  1040. IN OPTIONAL DWORD BuildNumber )
  1041. /*++
  1042. Routine Description:
  1043. This routine creates a media object and binds the appropriate compliance
  1044. checking function to the media object.
  1045. Arguments:
  1046. SourceSKU : the kind of SKU
  1047. SourceVariation : the kind of variation (oem, msdn, retail etc)
  1048. Version : the version ((major ver + minor ver) * 100)
  1049. BuildNumber : the build number
  1050. Return Value:
  1051. A new allocated and initialized media object of the appropriate type if
  1052. the media type is supported otherwise NULL.
  1053. NOTE:
  1054. Once you are done with the object, free the media object using CCMemFree()
  1055. macro. This function uses factory design pattern.
  1056. --*/
  1057. {
  1058. PCCMEDIA SourceMedia = CCMemAlloc(sizeof(CCMEDIA));
  1059. if( !SourceMedia ) {
  1060. return SourceMedia;
  1061. }
  1062. SourceMedia->SourceVariation = SourceVariation;
  1063. SourceMedia->Version = Version;
  1064. SourceMedia->BuildNumber = BuildNumber;
  1065. switch (SourceSKU) {
  1066. case COMPLIANCE_SKU_NTWFULL:
  1067. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTW;
  1068. SourceMedia->StepUpMedia = FALSE;
  1069. SourceMedia->CheckInstall = CCFullProfessionalCheck;
  1070. break;
  1071. case COMPLIANCE_SKU_NTW32U:
  1072. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTW;
  1073. SourceMedia->StepUpMedia = TRUE;
  1074. SourceMedia->CheckInstall = CCProfessionalUpgCheck;
  1075. break;
  1076. case COMPLIANCE_SKU_NTWPFULL:
  1077. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTWP;
  1078. SourceMedia->StepUpMedia = FALSE;
  1079. SourceMedia->CheckInstall = CCFullPersonalCheck;
  1080. break;
  1081. case COMPLIANCE_SKU_NTWPU:
  1082. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTWP;
  1083. SourceMedia->StepUpMedia = TRUE;
  1084. SourceMedia->CheckInstall = CCPersonalUpgCheck;
  1085. break;
  1086. case COMPLIANCE_SKU_NTSB:
  1087. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSB;
  1088. SourceMedia->StepUpMedia = FALSE;
  1089. SourceMedia->CheckInstall = CCFullBladeServerCheck;
  1090. break;
  1091. case COMPLIANCE_SKU_NTSBU:
  1092. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSB;
  1093. SourceMedia->StepUpMedia = TRUE;
  1094. SourceMedia->CheckInstall = CCBladeServerUpgCheck;
  1095. break;
  1096. case COMPLIANCE_SKU_NTSBS:
  1097. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSBS;
  1098. SourceMedia->StepUpMedia = FALSE;
  1099. SourceMedia->CheckInstall = CCFullSmallBusinessServerCheck;
  1100. break;
  1101. case COMPLIANCE_SKU_NTSBSU:
  1102. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSBS;
  1103. SourceMedia->StepUpMedia = TRUE;
  1104. SourceMedia->CheckInstall = CCSmallBusinessServerUpgCheck;
  1105. break;
  1106. case COMPLIANCE_SKU_NTSFULL:
  1107. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTS;
  1108. SourceMedia->StepUpMedia = FALSE;
  1109. SourceMedia->CheckInstall = CCFullServerCheck;
  1110. break;
  1111. case COMPLIANCE_SKU_NTSU:
  1112. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTS;
  1113. SourceMedia->StepUpMedia = TRUE;
  1114. SourceMedia->CheckInstall = CCServerUpgCheck;
  1115. break;
  1116. case COMPLIANCE_SKU_NTSEFULL:
  1117. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSE;
  1118. SourceMedia->StepUpMedia = FALSE;
  1119. SourceMedia->CheckInstall = CCFullAdvancedServerCheck;
  1120. break;
  1121. case COMPLIANCE_SKU_NTSEU:
  1122. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSE;
  1123. SourceMedia->StepUpMedia = TRUE;
  1124. SourceMedia->CheckInstall = CCAdvancedServerUpgCheck;
  1125. break;
  1126. case COMPLIANCE_SKU_NTSDTC:
  1127. SourceMedia->SourceType = COMPLIANCE_INSTALLTYPE_NTSDTC;
  1128. SourceMedia->StepUpMedia = FALSE;
  1129. SourceMedia->CheckInstall = CCFullDataCenterCheck;
  1130. break;
  1131. default:
  1132. CCMemFree(SourceMedia);
  1133. SourceMedia = 0;
  1134. break;
  1135. }
  1136. return SourceMedia;
  1137. }
  1138. BOOLEAN
  1139. CCMediaInitialize(
  1140. OUT PCCMEDIA DestMedia,
  1141. IN DWORD Type,
  1142. IN DWORD Variation,
  1143. IN BOOLEAN StepupMedia,
  1144. IN OPTIONAL DWORD Version,
  1145. IN OPTIONAL DWORD BuildNumber)
  1146. /*++
  1147. Routine Description:
  1148. The routine initializes a CCMEDIA structure with the given values
  1149. particularly the binding of "CheckInstall" method based on "Type"
  1150. and "StepupMedia".
  1151. Arguments:
  1152. DestMedia - The media object which needs to be initialized
  1153. Type - The type of media object (eg. COMPLIANCE_INSTALLTYPE_NTS)
  1154. Variation - The variation of the media object (eg. COMPLIANCE_INSTALLVAR_CDRETAIL)
  1155. StepupMedia - TRUE if the media is a stepup media or FALSE otherwise
  1156. Version - Optional OS Version (major * 100 + minor)
  1157. BuildNumber - Optinal Build number of OS (eg. 2172)
  1158. Return Value:
  1159. TRUE if the given media object could be initialized otherwise FALSE.
  1160. --*/
  1161. {
  1162. BOOLEAN Result = FALSE;
  1163. if (DestMedia) {
  1164. Result = TRUE;
  1165. DestMedia->SourceType = Type;
  1166. DestMedia->SourceVariation = Variation;
  1167. DestMedia->StepUpMedia = StepupMedia;
  1168. DestMedia->Version = Version;
  1169. DestMedia->BuildNumber = BuildNumber;
  1170. DestMedia->CheckInstall = 0;
  1171. switch (Type) {
  1172. case COMPLIANCE_INSTALLTYPE_NTW:
  1173. DestMedia->CheckInstall = StepupMedia ?
  1174. CCProfessionalUpgCheck : CCFullProfessionalCheck;
  1175. break;
  1176. case COMPLIANCE_INSTALLTYPE_NTWP:
  1177. DestMedia->CheckInstall = StepupMedia ?
  1178. CCPersonalUpgCheck : CCFullPersonalCheck;
  1179. break;
  1180. case COMPLIANCE_INSTALLTYPE_NTSB:
  1181. DestMedia->CheckInstall = StepupMedia ?
  1182. CCBladeServerUpgCheck : CCFullBladeServerCheck;
  1183. break;
  1184. case COMPLIANCE_INSTALLTYPE_NTS:
  1185. DestMedia->CheckInstall = StepupMedia ?
  1186. CCServerUpgCheck : CCFullServerCheck;
  1187. break;
  1188. case COMPLIANCE_INSTALLTYPE_NTSE:
  1189. DestMedia->CheckInstall = StepupMedia ?
  1190. CCAdvancedServerUpgCheck : CCFullAdvancedServerCheck;
  1191. break;
  1192. case COMPLIANCE_INSTALLTYPE_NTSDTC:
  1193. if (!StepupMedia) {
  1194. DestMedia->CheckInstall = CCFullDataCenterCheck;
  1195. } else {
  1196. Result = FALSE;
  1197. }
  1198. break;
  1199. default:
  1200. assert(FALSE);
  1201. Result = FALSE;
  1202. break;
  1203. }
  1204. }
  1205. return Result;
  1206. }