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.

235 lines
5.8 KiB

  1. //
  2. // Application Verifier UI
  3. // Copyright (c) Microsoft Corporation, 2001
  4. //
  5. //
  6. //
  7. // module: ChooseExe.cpp
  8. // author: CLupu
  9. // created: 04/13/2001
  10. //
  11. // Description:
  12. //
  13. // "Select individual tests" wizard page class.
  14. //
  15. #include "stdafx.h"
  16. #include "appverif.h"
  17. #include "Options.h"
  18. #include "AVUtil.h"
  19. #include "AVGlobal.h"
  20. #include "Setting.h"
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26. DWORD g_dwRegFlags;
  27. TCHAR g_szCrashDumpFile[MAX_PATH];
  28. //
  29. // Help IDs
  30. //
  31. static DWORD MyHelpIds[] =
  32. {
  33. 0, 0
  34. };
  35. /////////////////////////////////////////////////////////////////////////////
  36. // COptionsPage property page
  37. IMPLEMENT_DYNCREATE(COptionsPage, CAppverifPage)
  38. COptionsPage::COptionsPage() : CAppverifPage(COptionsPage::IDD)
  39. {
  40. //{{AFX_DATA_INIT(COptionsPage)
  41. // NOTE: the ClassWizard will add member initialization here
  42. //}}AFX_DATA_INIT
  43. m_nIssues = 0;
  44. }
  45. COptionsPage::~COptionsPage()
  46. {
  47. }
  48. void COptionsPage::DoDataExchange(CDataExchange* pDX)
  49. {
  50. CAppverifPage::DoDataExchange(pDX);
  51. //{{AFX_DATA_MAP(COptionsPage)
  52. DDX_Control(pDX, IDC_ISSUES, m_IssuesList);
  53. DDX_Control(pDX, IDC_CRASHDUMP_FILE, m_CrashDumpFile);
  54. DDX_Control(pDX, IDC_CREATE_CRASHDUMP_FILE, m_CreateCrashDumpFile);
  55. DDX_Control(pDX, IDC_OPTIONS_NEXTDESCR_STATIC, m_NextDescription);
  56. //}}AFX_DATA_MAP
  57. }
  58. BEGIN_MESSAGE_MAP(COptionsPage, CAppverifPage)
  59. //{{AFX_MSG_MAP(COptionsPage)
  60. ON_MESSAGE( WM_HELP, OnHelp )
  61. ON_WM_CONTEXTMENU()
  62. ON_BN_CLICKED(IDC_CREATE_CRASHDUMP_FILE, OnCheckCreateCrashDumpFile)
  63. ON_BN_CLICKED(IDC_BROWSE_CRASHDUMP, OnBrowseCrashDumpFile)
  64. //}}AFX_MSG_MAP
  65. END_MESSAGE_MAP()
  66. /////////////////////////////////////////////////////////////////////////////
  67. ULONG COptionsPage::GetDialogId() const
  68. {
  69. return IDD_OPTIONS_PAGE;
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. void COptionsPage::InsertIssue( DWORD idResIssue )
  73. {
  74. TCHAR szIssue[128];
  75. VERIFY( AVLoadString( idResIssue, szIssue, ARRAY_LENGTH( szIssue ) ) );
  76. m_IssuesList.InsertItem(m_nIssues, szIssue);
  77. m_IssuesList.SetCheck(m_nIssues, TRUE);
  78. g_dwRegFlags |= g_AllNamesAndBits[ m_nIssues ].m_dwBit;
  79. m_nIssues++;
  80. return;
  81. }
  82. /////////////////////////////////////////////////////////////////////////////
  83. // COptionsPage message handlers
  84. /////////////////////////////////////////////////////////////
  85. LONG COptionsPage::OnHelp( WPARAM wParam, LPARAM lParam )
  86. {
  87. LONG lResult = 0;
  88. LPHELPINFO lpHelpInfo = (LPHELPINFO)lParam;
  89. ::WinHelp(
  90. (HWND) lpHelpInfo->hItemHandle,
  91. g_szAVHelpFile,
  92. HELP_WM_HELP,
  93. (DWORD_PTR) MyHelpIds );
  94. return lResult;
  95. }
  96. /////////////////////////////////////////////////////////////////////////////
  97. void COptionsPage::OnBrowseCrashDumpFile()
  98. {
  99. TCHAR szFilter[] = _T("Memory dump files (*.dmp)\0*.dmp\0");
  100. OPENFILENAME ofn;
  101. ofn.lStructSize = sizeof(OPENFILENAME);
  102. ofn.hwndOwner = m_hWndTop;
  103. ofn.hInstance = NULL;
  104. ofn.lpstrFilter = szFilter;
  105. ofn.lpstrCustomFilter = NULL;
  106. ofn.nMaxCustFilter = 0;
  107. ofn.nFilterIndex = 0;
  108. ofn.lpstrFile = g_szCrashDumpFile;
  109. ofn.nMaxFile = MAX_PATH;
  110. ofn.lpstrFileTitle = NULL;
  111. ofn.nMaxFileTitle = 0;
  112. ofn.lpstrInitialDir = NULL;
  113. ofn.lpstrTitle = _T("Choose the crash dump file");
  114. ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
  115. ofn.lpstrDefExt = _T("DMP");
  116. if ( !GetOpenFileName(&ofn) )
  117. {
  118. return;
  119. }
  120. m_CrashDumpFile.SetWindowText(g_szCrashDumpFile);
  121. }
  122. /////////////////////////////////////////////////////////////////////////////
  123. void COptionsPage::OnContextMenu(CWnd* pWnd, CPoint point)
  124. {
  125. ::WinHelp(
  126. pWnd->m_hWnd,
  127. g_szAVHelpFile,
  128. HELP_CONTEXTMENU,
  129. (DWORD_PTR) MyHelpIds );
  130. }
  131. /////////////////////////////////////////////////////////////////////////////
  132. LRESULT COptionsPage::OnWizardNext()
  133. {
  134. //
  135. // Create the dwRegFlags that needs to be passed arround.
  136. //
  137. g_dwRegFlags = 0;
  138. for( int uCrtBit = 0; uCrtBit < ARRAY_LENGTH( g_AllNamesAndBits ); uCrtBit++ )
  139. {
  140. m_IssuesList.GetCheck( uCrtBit );
  141. if( m_IssuesList.GetCheck( uCrtBit ) )
  142. {
  143. g_dwRegFlags |= g_AllNamesAndBits[ uCrtBit ].m_dwBit;
  144. }
  145. }
  146. GoingToNextPageNotify( IDD_STARTAPP_PAGE );
  147. return IDD_STARTAPP_PAGE;
  148. }
  149. /////////////////////////////////////////////////////////////////////////////
  150. BOOL COptionsPage::OnSetActive()
  151. {
  152. ASSERT_VALID( m_pParentSheet );
  153. m_pParentSheet->SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT );
  154. return CAppverifPage::OnSetActive();
  155. }
  156. /////////////////////////////////////////////////////////////////////////////
  157. void COptionsPage::OnCheckCreateCrashDumpFile()
  158. {
  159. }
  160. /////////////////////////////////////////////////////////////////////////////
  161. BOOL COptionsPage::OnInitDialog()
  162. {
  163. CAppverifPage::OnInitDialog();
  164. g_dwRegFlags = 0;
  165. m_IssuesList.SetExtendedStyle(LVS_EX_CHECKBOXES);
  166. m_IssuesList.InsertColumn(0, _T("Issue Description"), LVCFMT_LEFT, 250);
  167. for( int uCrtBit = 0; uCrtBit < ARRAY_LENGTH( g_AllNamesAndBits ); uCrtBit++ )
  168. {
  169. InsertIssue( g_AllNamesAndBits[ uCrtBit ].m_uNameStringId );
  170. }
  171. ExpandEnvironmentStrings(_T("%windir%\\AppVerifier.dmp"), g_szCrashDumpFile, MAX_PATH);
  172. m_CrashDumpFile.SetWindowText(g_szCrashDumpFile);
  173. m_CreateCrashDumpFile.SetCheck(1);
  174. AVSetWindowText( m_NextDescription, IDS_OPTIONS_NEXTDESCR_STATIC );
  175. return TRUE; // return TRUE unless you set the focus to a control
  176. // EXCEPTION: OCX Property Pages should return FALSE
  177. }
  178. /////////////////////////////////////////////////////////////////////////////
  179. // COptionsPage message handlers