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.

216 lines
5.9 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1999.
  5. //
  6. // File: AdvDep.cpp
  7. //
  8. // Contents: addvanced deployment settings dialog
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 01-28-1999 stevebl Created
  15. //
  16. //---------------------------------------------------------------------------
  17. #include "precomp.hxx"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CAdvDep dialog
  25. CAdvDep::CAdvDep(CWnd* pParent /*=NULL*/)
  26. : CDialog(CAdvDep::IDD, pParent)
  27. {
  28. //{{AFX_DATA_INIT(CAdvDep)
  29. m_fIgnoreLCID = FALSE;
  30. m_fInstallOnAlpha = FALSE;
  31. m_f32On64 = FALSE;
  32. m_szProductCode = _T("");
  33. m_szDeploymentCount = _T("");
  34. m_szScriptName = _T("");
  35. m_fIncludeOLEInfo = FALSE;
  36. //}}AFX_DATA_INIT
  37. }
  38. void CAdvDep::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CDialog::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CAdvDep)
  42. DDX_Check(pDX, IDC_CHECK1, m_fIgnoreLCID);
  43. DDX_Check(pDX, IDC_CHECK3, m_fUninstallUnmanaged);
  44. DDX_Check(pDX, IDC_CHECK4, m_fIncludeOLEInfo);
  45. DDX_Check(pDX, IDC_CHECK2, m_f32On64);
  46. DDX_Text(pDX, IDC_STATIC1, m_szProductCode);
  47. DDX_Text(pDX, IDC_STATIC2, m_szDeploymentCount);
  48. DDX_Text(pDX, IDC_STATIC3, m_szScriptName);
  49. //}}AFX_DATA_MAP
  50. }
  51. BEGIN_MESSAGE_MAP(CAdvDep, CDialog)
  52. //{{AFX_MSG_MAP(CAdvDep)
  53. ON_WM_CONTEXTMENU()
  54. //}}AFX_MSG_MAP
  55. END_MESSAGE_MAP()
  56. int FindBreak(CString &sz)
  57. {
  58. int iReturn = sz.ReverseFind(L'\\');
  59. int i2 = sz.ReverseFind(L' ');
  60. if (i2 > iReturn)
  61. {
  62. iReturn = i2;
  63. }
  64. return iReturn;
  65. }
  66. BOOL CAdvDep::OnInitDialog()
  67. {
  68. BOOL fIntel = FALSE;
  69. GetDlgItem(IDC_CHECK4)->EnableWindow(FALSE);
  70. //
  71. // The include COM information flag is not supported by RSoP
  72. // so in RSoP mode, we will hide this control
  73. //
  74. if ( m_pDeploy->m_fRSOP )
  75. {
  76. GetDlgItem( IDC_CHECK4 )->ShowWindow( SW_HIDE );
  77. }
  78. if (m_pDeploy->m_fPreDeploy)
  79. {
  80. // and we're in pre-deploy mode - enable the extensions only field
  81. GetDlgItem(IDC_CHECK4)->EnableWindow(TRUE);
  82. }
  83. // search for an Intel processor code
  84. int nPlatforms = m_pDeploy->m_pData->m_pDetails->pPlatformInfo->cPlatforms;
  85. while (nPlatforms--)
  86. {
  87. if (m_pDeploy->m_pData->m_pDetails->pPlatformInfo->
  88. prgPlatform[nPlatforms].dwProcessorArch
  89. == PROCESSOR_ARCHITECTURE_INTEL)
  90. {
  91. fIntel = TRUE;
  92. }
  93. }
  94. // GetDlgItem(IDC_CHECK2)->EnableWindow(fIntel);
  95. CString sz;
  96. if (m_pDeploy->m_fMachine)
  97. {
  98. sz.LoadString(IDS_ADVANCEDMACHINES);
  99. }
  100. if (m_pDeploy->m_pData->Is64Bit())
  101. {
  102. GetDlgItem(IDC_CHECK2)->EnableWindow(FALSE);
  103. GetDlgItem(IDC_CHECK2)->ShowWindow(SW_HIDE);
  104. }
  105. else
  106. {
  107. GetDlgItem(IDC_CHECK2)->EnableWindow(TRUE);
  108. GetDlgItem(IDC_CHECK2)->ShowWindow(SW_SHOW);
  109. }
  110. //
  111. // In the past, we allowed administrators to optionally specify
  112. // that unmanaged installs should be removed for per-user non-admin
  113. // installs. Due to security issues, it is clear that the
  114. // behavior should not be configurable, that the client
  115. // should transparently make the decision. For this reason,
  116. // we hide this option in the ui below, and note that
  117. // we leave the resource in the executable so that
  118. // test code will not be broken by a resource change at this
  119. // stage in the project -- this resource should be removed altogether
  120. // in the next release
  121. //
  122. GetDlgItem(IDC_CHECK3)->EnableWindow(FALSE);
  123. GetDlgItem(IDC_CHECK3)->ShowWindow(SW_HIDE);
  124. if (m_pDeploy->m_fRSOP)
  125. {
  126. // disable EVERYTHING
  127. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  128. GetDlgItem(IDC_CHECK3)->EnableWindow(FALSE);
  129. GetDlgItem(IDC_CHECK2)->EnableWindow(FALSE);
  130. GetDlgItem(IDC_CHECK4)->EnableWindow(FALSE);
  131. }
  132. // split the path so it will fit in the control
  133. RECT rect;
  134. CWnd * pwndStatic = GetDlgItem(IDC_STATIC3);
  135. pwndStatic->GetClientRect(&rect);
  136. DWORD dwControl = rect.right-rect.left;
  137. CString szPath = m_szScriptName;
  138. m_szScriptName = "";
  139. CDC * pDC = pwndStatic->GetDC();
  140. CSize size = pDC->GetTextExtent(szPath);
  141. pDC->LPtoDP(&size);
  142. int ich;
  143. while (size.cx >= dwControl)
  144. {
  145. ich = FindBreak(szPath);
  146. if (ich <= 0)
  147. {
  148. // there's no where else to break this string
  149. break;
  150. }
  151. else
  152. {
  153. // break off the front of the string
  154. CString szFront;
  155. do
  156. {
  157. szFront = szPath.Left(ich);
  158. size = pDC->GetTextExtent(szFront);
  159. pDC->LPtoDP(&size);
  160. ich = FindBreak(szFront);
  161. } while (ich > 0 && size.cx >= dwControl);
  162. m_szScriptName += szFront;
  163. m_szScriptName += L'\n';
  164. szPath = szPath.Mid(szFront.GetLength());
  165. }
  166. size = pDC->GetTextExtent(szPath);
  167. pDC->LPtoDP(&size);
  168. }
  169. m_szScriptName += szPath;
  170. pwndStatic->ReleaseDC(pDC);
  171. CDialog::OnInitDialog();
  172. return TRUE;
  173. }
  174. /////////////////////////////////////////////////////////////////////////////
  175. // CAdvDep message handlers
  176. void CAdvDep::OnContextMenu(CWnd* pWnd, CPoint point)
  177. {
  178. StandardContextMenu(pWnd->m_hWnd, IDD_ADVDEP);
  179. }
  180. LRESULT CAdvDep::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  181. {
  182. switch (message)
  183. {
  184. case WM_HELP:
  185. StandardHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, IDD);
  186. return 0;
  187. default:
  188. return CDialog::WindowProc(message, wParam, lParam);
  189. }
  190. }