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.

338 lines
8.9 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // platform.c
  8. //
  9. // Description:
  10. // This file contains the dialog procedure for the platform choice
  11. // (IDD_WKS_OR_SRV).
  12. //
  13. //----------------------------------------------------------------------------
  14. #include "pch.h"
  15. #include "resource.h"
  16. #include "optcomp.h"
  17. static PLATFORM_TYPES iBeginPlatform;
  18. //----------------------------------------------------------------------------
  19. //
  20. // Function: AdjustNetSettingsForPlatform
  21. //
  22. // Purpose:
  23. //
  24. // Arguments: IN HWND hwnd - handle to the dialog box
  25. //
  26. // Returns: VOID
  27. //
  28. //----------------------------------------------------------------------------
  29. VOID
  30. AdjustNetSettingsForPlatform( VOID )
  31. {
  32. NETWORK_COMPONENT *pNetComponent;
  33. NETWORK_COMPONENT *pNetwareClientComponent = NULL;
  34. NETWORK_COMPONENT *pGatewayComponent = NULL;
  35. //
  36. // Only adjust the net settings if the platform changed while the user
  37. // was on this page.
  38. //
  39. if( iBeginPlatform != WizGlobals.iPlatform )
  40. {
  41. for( pNetComponent = NetSettings.NetComponentsList;
  42. pNetComponent;
  43. pNetComponent = pNetComponent->next )
  44. {
  45. if( pNetComponent->iPosition == NETWARE_CLIENT_POSITION )
  46. {
  47. pNetwareClientComponent = pNetComponent;
  48. }
  49. if( pNetComponent->iPosition == GATEWAY_FOR_NETWARE_POSITION )
  50. {
  51. pGatewayComponent = pNetComponent;
  52. }
  53. }
  54. if( pNetwareClientComponent && pGatewayComponent )
  55. {
  56. if( WizGlobals.iPlatform == PLATFORM_WORKSTATION || WizGlobals.iPlatform == PLATFORM_PERSONAL)
  57. {
  58. pNetwareClientComponent->bInstalled = pGatewayComponent->bInstalled;
  59. }
  60. else if( WizGlobals.iPlatform == PLATFORM_SERVER || WizGlobals.iPlatform == PLATFORM_ENTERPRISE || WizGlobals.iPlatform == PLATFORM_WEBBLADE)
  61. {
  62. pGatewayComponent->bInstalled = pNetwareClientComponent->bInstalled;
  63. }
  64. else
  65. {
  66. AssertMsg( FALSE,
  67. "Bad platform case");
  68. }
  69. }
  70. }
  71. }
  72. //----------------------------------------------------------------------------
  73. //
  74. // Function: OnPlatformSetActive
  75. //
  76. // Purpose:
  77. //
  78. // Arguments: IN HWND hwnd - handle to the dialog box
  79. //
  80. // Returns: VOID
  81. //
  82. //----------------------------------------------------------------------------
  83. VOID
  84. OnPlatformSetActive( IN HWND hwnd )
  85. {
  86. int nButtonId = IDC_WORKSTATION;
  87. iBeginPlatform = WizGlobals.iPlatform;
  88. //
  89. // Select the proper radio button
  90. //
  91. switch( WizGlobals.iPlatform ) {
  92. case PLATFORM_PERSONAL:
  93. nButtonId = IDC_PERSONAL;
  94. break;
  95. case PLATFORM_WORKSTATION:
  96. nButtonId = IDC_WORKSTATION;
  97. break;
  98. case PLATFORM_SERVER:
  99. nButtonId = IDC_SERVER;
  100. break;
  101. case PLATFORM_ENTERPRISE:
  102. nButtonId = IDC_ENTERPRISE;
  103. break;
  104. case PLATFORM_WEBBLADE:
  105. nButtonId = IDC_WEBBLADE;
  106. break;
  107. default:
  108. AssertMsg( FALSE,
  109. "Invalid value for WizGlobals.iProductInstall" );
  110. break;
  111. }
  112. CheckRadioButton( hwnd,
  113. IDC_WORKSTATION,
  114. IDC_WEBBLADE,
  115. nButtonId );
  116. WIZ_BUTTONS(hwnd, PSWIZB_BACK | PSWIZB_NEXT);
  117. }
  118. //----------------------------------------------------------------------------
  119. //
  120. // Function: OnWizNextPlatform
  121. //
  122. // Purpose:
  123. //
  124. // Arguments: IN HWND hwnd - handle to the dialog box
  125. //
  126. // Returns: VOID
  127. //
  128. //----------------------------------------------------------------------------
  129. VOID
  130. OnWizNextPlatform( IN HWND hwnd ) {
  131. DWORD dwCompItem = 0,
  132. dwCompGroup = 0;
  133. TCHAR szAnswer[MAX_PATH] = NULLSTR;
  134. if( IsDlgButtonChecked(hwnd, IDC_PERSONAL) )
  135. {
  136. WizGlobals.iPlatform = PLATFORM_PERSONAL;
  137. }
  138. else if( IsDlgButtonChecked(hwnd, IDC_WORKSTATION) )
  139. {
  140. WizGlobals.iPlatform = PLATFORM_WORKSTATION;
  141. }
  142. else if( IsDlgButtonChecked(hwnd, IDC_SERVER) )
  143. {
  144. WizGlobals.iPlatform = PLATFORM_SERVER;
  145. }
  146. else if( IsDlgButtonChecked(hwnd, IDC_ENTERPRISE) )
  147. {
  148. WizGlobals.iPlatform = PLATFORM_ENTERPRISE;
  149. }
  150. else if( IsDlgButtonChecked(hwnd, IDC_WEBBLADE) )
  151. {
  152. WizGlobals.iPlatform = PLATFORM_WEBBLADE;
  153. }
  154. else
  155. {
  156. WizGlobals.iPlatform = PLATFORM_WORKSTATION;
  157. }
  158. AdjustNetSettingsForPlatform();
  159. #ifdef OPTCOMP
  160. //
  161. // Adjust defaults for windows components (only for unattended installations)
  162. //
  163. // Iterate through each of the components themselves
  164. //
  165. if ( WizGlobals.iProductInstall == PRODUCT_UNATTENDED_INSTALL )
  166. {
  167. // Iterate through each group to determine if this component is part of it
  168. //
  169. for(dwCompGroup=0;dwCompGroup<AS(s_cgComponentNames);dwCompGroup++)
  170. {
  171. // Check to see if this component is the correct platform, set it to true
  172. //
  173. if (s_cgComponentNames[dwCompGroup].dwDefaultSkus & WizGlobals.iPlatform)
  174. {
  175. // Set this component as a default
  176. //
  177. GenSettings.dwWindowsComponents |= s_cgComponentNames[dwCompGroup].dwComponents;
  178. }
  179. }
  180. // Iterate through each of the components
  181. //
  182. for(dwCompItem=0;dwCompItem<AS(s_cComponent);dwCompItem++)
  183. {
  184. // We read in a script during the load process, let's write back the components that were specified in the file
  185. //
  186. if ( FixedGlobals.ScriptName[0] )
  187. {
  188. // Attemp to grab this component from the file
  189. //
  190. GetPrivateProfileString(_T("Components"), s_cComponent[dwCompItem].lpComponentString, NULLSTR, szAnswer, AS(szAnswer), FixedGlobals.ScriptName);
  191. // Do we have a component?
  192. //
  193. if ( szAnswer[0] )
  194. {
  195. // User did not want to install component
  196. //
  197. if ( LSTRCMPI(szAnswer, _T("On")) == 0 )
  198. {
  199. GenSettings.dwWindowsComponents |= s_cComponent[dwCompItem].dwComponent;
  200. }
  201. else if ( LSTRCMPI(szAnswer, _T("Off")) == 0 )
  202. {
  203. GenSettings.dwWindowsComponents &= ~s_cComponent[dwCompItem].dwComponent;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. #endif
  210. }
  211. //----------------------------------------------------------------------------
  212. //
  213. // Function: DlgPlatformPage
  214. //
  215. // Purpose:
  216. //
  217. // Arguments: standard Win32 dialog proc arguments
  218. //
  219. // Returns: standard Win32 dialog proc return value -- whether the message
  220. // was handled or not
  221. //
  222. //----------------------------------------------------------------------------
  223. INT_PTR CALLBACK
  224. DlgPlatformPage( IN HWND hwnd,
  225. IN UINT uMsg,
  226. IN WPARAM wParam,
  227. IN LPARAM lParam )
  228. {
  229. BOOL bStatus = TRUE;
  230. switch( uMsg ) {
  231. case WM_INITDIALOG: {
  232. // Set the default platform
  233. //
  234. if ( !WizGlobals.iPlatform )
  235. WizGlobals.iPlatform = PLATFORM_WORKSTATION;
  236. break;
  237. }
  238. case WM_NOTIFY: {
  239. LPNMHDR pnmh = (LPNMHDR)lParam;
  240. switch( pnmh->code ) {
  241. case PSN_QUERYCANCEL:
  242. WIZ_CANCEL(hwnd);
  243. break;
  244. case PSN_SETACTIVE: {
  245. g_App.dwCurrentHelp = IDH_CHZ_PLAT;
  246. OnPlatformSetActive( hwnd );
  247. break;
  248. }
  249. case PSN_WIZBACK:
  250. bStatus = FALSE;
  251. break;
  252. case PSN_WIZNEXT:
  253. OnWizNextPlatform( hwnd );
  254. bStatus = FALSE;
  255. break;
  256. case PSN_HELP:
  257. WIZ_HELP();
  258. break;
  259. default:
  260. break;
  261. }
  262. break;
  263. }
  264. default:
  265. bStatus = FALSE;
  266. break;
  267. }
  268. return( bStatus );
  269. }