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.

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