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.

207 lines
5.9 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1998.
  5. //
  6. // File: LocPkg.cpp
  7. //
  8. // Contents: locale - platform property page
  9. //
  10. // Classes: CLocPkg
  11. //
  12. // History: 03-14-1998 stevebl Commented
  13. //
  14. //---------------------------------------------------------------------------
  15. #include "precomp.hxx"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CLocPkg property page
  23. IMPLEMENT_DYNCREATE(CLocPkg, CPropertyPage)
  24. CLocPkg::CLocPkg() : CPropertyPage(CLocPkg::IDD)
  25. {
  26. //{{AFX_DATA_INIT(CLocPkg)
  27. m_fWin64 = FALSE;
  28. m_fX86 = FALSE;
  29. m_ProcessorArch = PROCESSOR_ARCHITECTURE_IA64;
  30. //}}AFX_DATA_INIT
  31. m_pIClassAdmin = NULL;
  32. }
  33. CLocPkg::~CLocPkg()
  34. {
  35. *m_ppThis = NULL;
  36. if (m_pIClassAdmin)
  37. {
  38. m_pIClassAdmin->Release();
  39. }
  40. }
  41. void CLocPkg::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CPropertyPage::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CLocPkg)
  45. DDX_Check(pDX, IDC_CHECK1, m_fWin64);
  46. DDX_Check(pDX, IDC_CHECK2, m_fX86);
  47. //}}AFX_DATA_MAP
  48. }
  49. BEGIN_MESSAGE_MAP(CLocPkg, CPropertyPage)
  50. //{{AFX_MSG_MAP(CLocPkg)
  51. ON_BN_CLICKED(IDC_CHECK1, OnChange)
  52. ON_BN_CLICKED(IDC_CHECK2, OnChange)
  53. ON_WM_CONTEXTMENU()
  54. //}}AFX_MSG_MAP
  55. END_MESSAGE_MAP()
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CLocPkg message handlers
  58. BOOL CLocPkg::OnApply()
  59. {
  60. PLATFORMINFO * pPlatformInfo = m_pData->m_pDetails->pPlatformInfo;
  61. UINT i = 0;
  62. if (m_fX86)
  63. {
  64. i++;
  65. }
  66. if (m_fWin64)
  67. {
  68. i++;
  69. }
  70. if (i == 0)
  71. {
  72. CString szTitle;
  73. szTitle.LoadString(IDS_BADDATA);
  74. CString szText;
  75. szText.LoadString(IDS_PLATFORMREQUIRED);
  76. MessageBox(szText, szTitle, MB_ICONEXCLAMATION | MB_OK);
  77. return FALSE;
  78. }
  79. m_pData->m_pDetails->pPlatformInfo = new PLATFORMINFO;
  80. m_pData->m_pDetails->pPlatformInfo->cPlatforms = i;
  81. m_pData->m_pDetails->pPlatformInfo->prgPlatform = new CSPLATFORM[i];
  82. m_pData->m_pDetails->pPlatformInfo->cLocales = pPlatformInfo->cLocales;
  83. m_pData->m_pDetails->pPlatformInfo->prgLocale = pPlatformInfo->prgLocale;
  84. i = 0;
  85. if (m_fX86)
  86. {
  87. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwPlatformId = VER_PLATFORM_WIN32_NT;
  88. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwVersionHi = 5;
  89. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwVersionLo = 0;
  90. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwProcessorArch = PROCESSOR_ARCHITECTURE_INTEL;
  91. i++;
  92. }
  93. if (m_fWin64)
  94. {
  95. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwPlatformId = VER_PLATFORM_WIN32_NT;
  96. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwVersionHi = 5;
  97. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwVersionLo = 0;
  98. m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwProcessorArch = m_ProcessorArch;
  99. }
  100. HRESULT hr = S_OK;
  101. #if 0
  102. hr = m_pIClassAdmin->UpgradePackage(m_pData->m_pDetails->pszPackageName,
  103. m_pData->m_pDetails);
  104. if (FAILED(hr))
  105. {
  106. PLATFORMINFO * pTemp = m_pData->m_pDetails->pPlatformInfo;
  107. m_pData->m_pDetails->pPlatformInfo = pPlatformInfo;
  108. pPlatformInfo = pTemp;
  109. }
  110. else
  111. MMCPropertyChangeNotify(m_hConsoleHandle, (long) m_cookie);
  112. #endif
  113. delete [] pPlatformInfo->prgPlatform;
  114. delete pPlatformInfo;
  115. if (FAILED(hr))
  116. {
  117. CString sz;
  118. sz.LoadString(IDS_CHANGEFAILED);
  119. ReportGeneralPropertySheetError(sz, hr);
  120. return FALSE;
  121. }
  122. SetModified(FALSE);
  123. return CPropertyPage::OnApply();
  124. }
  125. BOOL CLocPkg::OnInitDialog()
  126. {
  127. UINT i;
  128. for (i = m_pData->m_pDetails->pPlatformInfo->cPlatforms; i--;)
  129. {
  130. switch (m_pData->m_pDetails->pPlatformInfo->prgPlatform[i].dwProcessorArch)
  131. {
  132. case PROCESSOR_ARCHITECTURE_INTEL:
  133. m_fX86 = TRUE;
  134. break;
  135. case PROCESSOR_ARCHITECTURE_AMD64:
  136. m_ProcessorArch = PROCESSOR_ARCHITECTURE_AMD64;
  137. m_fWin64 = TRUE;
  138. break;
  139. case PROCESSOR_ARCHITECTURE_IA64:
  140. m_ProcessorArch = PROCESSOR_ARCHITECTURE_IA64;
  141. m_fWin64 = TRUE;
  142. break;
  143. default:
  144. break;
  145. }
  146. }
  147. TCHAR szBuffer[256];
  148. CString sz;
  149. i = 0;
  150. while (i < m_pData->m_pDetails->pPlatformInfo->cLocales)
  151. {
  152. GetLocaleInfo(m_pData->m_pDetails->pPlatformInfo->prgLocale[i], LOCALE_SLANGUAGE, szBuffer, 256);
  153. sz = szBuffer;
  154. #ifdef SHOWCOUNTRY
  155. GetLocaleInfo(m_pData->m_pDetails->pPlatformInfo->prgLocale[i], LOCALE_SCOUNTRY, szBuffer, 256);
  156. sz += _T(" - ");
  157. sz += szBuffer;
  158. #endif
  159. i++;
  160. ((CListBox *)GetDlgItem(IDC_LIST1))->AddString(sz);
  161. }
  162. CPropertyPage::OnInitDialog();
  163. return TRUE; // return TRUE unless you set the focus to a control
  164. // EXCEPTION: OCX Property Pages should return FALSE
  165. }
  166. void CLocPkg::OnChange()
  167. {
  168. SetModified();
  169. }
  170. LRESULT CLocPkg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  171. {
  172. switch (message)
  173. {
  174. case WM_HELP:
  175. StandardHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, IDD);
  176. return 0;
  177. case WM_USER_REFRESH:
  178. // UNDONE
  179. return 0;
  180. case WM_USER_CLOSE:
  181. return GetOwner()->SendMessage(WM_CLOSE);
  182. default:
  183. return CPropertyPage::WindowProc(message, wParam, lParam);
  184. }
  185. }
  186. void CLocPkg::OnContextMenu(CWnd* pWnd, CPoint point)
  187. {
  188. StandardContextMenu(pWnd->m_hWnd, IDD_LOCALE_PACKAGE);
  189. }