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.

248 lines
6.5 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 0
  79. if (m_pDeploy->m_pData->m_pDetails->pInstallInfo->PathType != SetupNamePath)
  80. {
  81. // this is NOT a legacy app
  82. #endif
  83. if (m_pDeploy->m_fPreDeploy)
  84. {
  85. // and we're in pre-deploy mode - enable the extensions only field
  86. GetDlgItem(IDC_CHECK4)->EnableWindow(TRUE);
  87. }
  88. #if 0
  89. }
  90. #endif
  91. // search for an Intel processor code
  92. int nPlatforms = m_pDeploy->m_pData->m_pDetails->pPlatformInfo->cPlatforms;
  93. while (nPlatforms--)
  94. {
  95. if (m_pDeploy->m_pData->m_pDetails->pPlatformInfo->
  96. prgPlatform[nPlatforms].dwProcessorArch
  97. == PROCESSOR_ARCHITECTURE_INTEL)
  98. {
  99. fIntel = TRUE;
  100. }
  101. }
  102. // GetDlgItem(IDC_CHECK2)->EnableWindow(fIntel);
  103. CString sz;
  104. if (m_pDeploy->m_fMachine)
  105. {
  106. sz.LoadString(IDS_ADVANCEDMACHINES);
  107. }
  108. else
  109. {
  110. sz.LoadString(IDS_ADVANCEDUSERS);
  111. }
  112. if (m_pDeploy->m_pData->Is64Bit())
  113. {
  114. GetDlgItem(IDC_CHECK2)->EnableWindow(FALSE);
  115. GetDlgItem(IDC_CHECK2)->ShowWindow(SW_HIDE);
  116. }
  117. else
  118. {
  119. GetDlgItem(IDC_CHECK2)->EnableWindow(TRUE);
  120. GetDlgItem(IDC_CHECK2)->ShowWindow(SW_SHOW);
  121. }
  122. //
  123. // In the past, we allowed administrators to optionally specify
  124. // that unmanaged installs should be removed for per-user non-admin
  125. // installs. Due to security issues, it is clear that the
  126. // behavior should not be configurable, that the client
  127. // should transparently make the decision. For this reason,
  128. // we hide this option in the ui below, and note that
  129. // we leave the resource in the executable so that
  130. // test code will not be broken by a resource change at this
  131. // stage in the project -- this resource should be removed altogether
  132. // in the next release
  133. //
  134. GetDlgItem(IDC_CHECK3)->EnableWindow(FALSE);
  135. GetDlgItem(IDC_CHECK3)->ShowWindow(SW_HIDE);
  136. if (m_pDeploy->m_fRSOP)
  137. {
  138. // disable EVERYTHING
  139. GetDlgItem(IDC_CHECK1)->EnableWindow(FALSE);
  140. GetDlgItem(IDC_CHECK3)->EnableWindow(FALSE);
  141. GetDlgItem(IDC_CHECK2)->EnableWindow(FALSE);
  142. GetDlgItem(IDC_CHECK4)->EnableWindow(FALSE);
  143. }
  144. #if 0
  145. // Insert spaces after each directory in the script path to allow the
  146. // static control to split the path over multiple lines.
  147. // (Without whitespace the control won't split the path up and it
  148. // will be unreadable.)
  149. CString szPath = m_szScriptName;
  150. int ich;
  151. m_szScriptName = "";
  152. while (0 <= (ich = szPath.FindOneOf(TEXT("\\/"))))
  153. {
  154. m_szScriptName += szPath.Left(ich+1);
  155. if (ich > 0)
  156. {
  157. m_szScriptName += " ";
  158. }
  159. szPath = szPath.Mid(ich+1);
  160. }
  161. m_szScriptName += szPath;
  162. #else
  163. // split the path so it will fit in the control
  164. RECT rect;
  165. CWnd * pwndStatic = GetDlgItem(IDC_STATIC3);
  166. pwndStatic->GetClientRect(&rect);
  167. DWORD dwControl = rect.right-rect.left;
  168. CString szPath = m_szScriptName;
  169. m_szScriptName = "";
  170. CDC * pDC = pwndStatic->GetDC();
  171. CSize size = pDC->GetTextExtent(szPath);
  172. pDC->LPtoDP(&size);
  173. int ich;
  174. while (size.cx >= dwControl)
  175. {
  176. ich = FindBreak(szPath);
  177. if (ich <= 0)
  178. {
  179. // there's no where else to break this string
  180. break;
  181. }
  182. else
  183. {
  184. // break off the front of the string
  185. CString szFront;
  186. do
  187. {
  188. szFront = szPath.Left(ich);
  189. size = pDC->GetTextExtent(szFront);
  190. pDC->LPtoDP(&size);
  191. ich = FindBreak(szFront);
  192. } while (ich > 0 && size.cx >= dwControl);
  193. m_szScriptName += szFront;
  194. m_szScriptName += L'\n';
  195. szPath = szPath.Mid(szFront.GetLength());
  196. }
  197. size = pDC->GetTextExtent(szPath);
  198. pDC->LPtoDP(&size);
  199. }
  200. m_szScriptName += szPath;
  201. pwndStatic->ReleaseDC(pDC);
  202. #endif
  203. CDialog::OnInitDialog();
  204. return TRUE;
  205. }
  206. /////////////////////////////////////////////////////////////////////////////
  207. // CAdvDep message handlers
  208. void CAdvDep::OnContextMenu(CWnd* pWnd, CPoint point)
  209. {
  210. StandardContextMenu(pWnd->m_hWnd, IDD_ADVDEP);
  211. }
  212. LRESULT CAdvDep::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  213. {
  214. switch (message)
  215. {
  216. case WM_HELP:
  217. StandardHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, IDD);
  218. return 0;
  219. default:
  220. return CDialog::WindowProc(message, wParam, lParam);
  221. }
  222. }