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.

776 lines
24 KiB

  1. /*++
  2. Copyright (c) 1992-1999 Microsoft Corporation
  3. Module Name:
  4. Memory.c
  5. Abstract:
  6. This module contains the memory options dialog callback and supporting
  7. routines to choose options for memory display.
  8. --*/
  9. #include "precomp.hxx"
  10. #pragma hdrstop
  11. _FORMATS_MEM_WIN g_FormatsMemWin[] = {
  12. {8, fmtAscii, 0, FALSE, 1, _T("ASCII")},
  13. {16, fmtUnicode, 0, FALSE, 1, _T("Unicode")},
  14. {8, fmtInt | fmtZeroPad, 16, TRUE, 2, _T("Byte")},
  15. {16, fmtInt | fmtSpacePad, 10, FALSE, 6, _T("Short")},
  16. {16, fmtUInt | fmtZeroPad, 16, FALSE, 4, _T("Short Hex")},
  17. {16, fmtUInt | fmtSpacePad, 10, FALSE, 5, _T("Short Unsigned")},
  18. {32, fmtInt | fmtSpacePad, 10, FALSE, 11, _T("Long")},
  19. {32, fmtUInt | fmtZeroPad, 16, FALSE, 8, _T("Long Hex")},
  20. {32, fmtUInt | fmtSpacePad, 10, FALSE, 10, _T("Long Unsigned")},
  21. {64, fmtInt | fmtSpacePad, 10, FALSE, 21, _T("Quad")},
  22. {64, fmtUInt | fmtZeroPad, 16, FALSE, 16, _T("Quad Hex")},
  23. {64, fmtUInt | fmtSpacePad, 10, FALSE, 20, _T("Quad Unsigned")},
  24. {32, fmtFloat, 10, FALSE, 14, _T("Real (32-bit)")},
  25. {64, fmtFloat, 10, FALSE, 23, _T("Real (64-bit)")},
  26. {80, fmtFloat, 10, FALSE, 25, _T("Real (10-byte)")},
  27. {128,fmtFloat, 10, FALSE, 42, _T("Real (16-byte)")}
  28. };
  29. const int g_nMaxNumFormatsMemWin = sizeof(g_FormatsMemWin) / sizeof(g_FormatsMemWin[0]);
  30. HWND hwndMemOptsParent = NULL;
  31. void
  32. Init(HWND,
  33. HINSTANCE,
  34. LPPROPSHEETHEADER,
  35. PROPSHEETPAGE [],
  36. const int
  37. );
  38. INT_PTR CALLBACK DlgProc_Physical_Mem(HWND, UINT, WPARAM, LPARAM);
  39. INT_PTR CALLBACK DlgProc_Virtual_Mem(HWND, UINT, WPARAM, LPARAM);
  40. INT_PTR CALLBACK DlgProc_IO_Mem(HWND, UINT, WPARAM, LPARAM);
  41. INT_PTR CALLBACK DlgProc_Bus_Mem(HWND, UINT, WPARAM, LPARAM);
  42. INT_PTR CALLBACK DlgProc_Control_Mem(HWND, UINT, WPARAM, LPARAM);
  43. INT_PTR CALLBACK DlgProc_MSR_Mem(HWND, UINT, WPARAM, LPARAM);
  44. INT_PTR
  45. CALLBACK
  46. DlgProc_MemoryProperties(MEMORY_TYPE, HWND, UINT, WPARAM, LPARAM);
  47. int
  48. MemType_To_DlgId(
  49. MEMORY_TYPE memtype
  50. )
  51. {
  52. int i;
  53. struct {
  54. MEMORY_TYPE memtype;
  55. int nId;
  56. } rgMap[] = {
  57. { PHYSICAL_MEM_TYPE, IDD_DLG_MEM_PHYSICAL },
  58. { VIRTUAL_MEM_TYPE, IDD_DLG_MEM_VIRTUAL },
  59. { BUS_MEM_TYPE, IDD_DLG_MEM_BUS_DATA },
  60. { CONTROL_MEM_TYPE, IDD_DLG_MEM_CONTROL },
  61. { IO_MEM_TYPE, IDD_DLG_MEM_IO },
  62. { MSR_MEM_TYPE, IDD_DLG_MEM_MSR }
  63. };
  64. for (i=0; i<sizeof(rgMap)/sizeof(rgMap[0]); i++) {
  65. if (memtype == rgMap[i].memtype) {
  66. return rgMap[i].nId;
  67. }
  68. }
  69. Assert(!"This should not happen");
  70. return 0;
  71. }
  72. INT_PTR
  73. DisplayOptionsPropSheet(
  74. HWND hwndOwner,
  75. HINSTANCE hinst,
  76. MEMORY_TYPE memtypeStartPage
  77. )
  78. /*++
  79. Routine Description:
  80. Will Initialize and display the Options property sheet. Handle the return codes,
  81. and the commitment of changes to the debugger.
  82. Arguments:
  83. hwndOwner
  84. hinst
  85. Are both used initialize the property sheet dialog.
  86. nStart - Is used to specify the page that is to be initially
  87. displayed when the prop sheet first appears. The default
  88. value is 0. The values specified correspond to array index
  89. of the PROPSHEETPAGE array.
  90. Returns
  91. Button pushed IDOK, etc...
  92. --*/
  93. {
  94. INT_PTR nRes = 0;
  95. PROPSHEETHEADER psh = {0};
  96. PROPSHEETPAGE apsp[MAX_MEMORY_TYPE] = {0};
  97. int nNumPropPages = sizeof(apsp) / sizeof(PROPSHEETPAGE);
  98. Init(hwndOwner, hinst, &psh, apsp, nNumPropPages);
  99. {
  100. //
  101. // Figure out the initial page to be displayed
  102. //
  103. int i;
  104. int nStartPage = 0;
  105. int nId = MemType_To_DlgId(memtypeStartPage);
  106. for (i=0; i<MAX_MEMORY_TYPE; i++) {
  107. if ( (PVOID)(MAKEINTRESOURCE(nId)) == (PVOID)(apsp[i].pszTemplate) ) {
  108. nStartPage = i;
  109. break;
  110. }
  111. }
  112. psh.nStartPage = nStartPage;
  113. }
  114. hwndMemOptsParent = hwndOwner;
  115. nRes = PropertySheet(&psh);
  116. hwndMemOptsParent = NULL;
  117. if (IDOK == nRes) {
  118. // Save workspace changes here
  119. }
  120. return nRes;
  121. }
  122. void
  123. Init(
  124. HWND hwndOwner,
  125. HINSTANCE hinst,
  126. LPPROPSHEETHEADER lppsh,
  127. PROPSHEETPAGE apsp[],
  128. const int nMaxPropPages
  129. )
  130. /*++
  131. Routine Description:
  132. Initializes the property sheet header and pages.
  133. Arguments:
  134. hwndOwner
  135. hinst
  136. Are both used by the PROPSHEETHEADER & PROPSHEETPAGE structure.
  137. Please see the docs for the these structures for more info.
  138. lppsh
  139. Standard prop sheet structure.
  140. apsp[]
  141. An array of prop pages
  142. Standard prop sheet structure.
  143. nNumPropPages
  144. Number of prop pages in the "apsp" array.
  145. --*/
  146. {
  147. int nPropIdx;
  148. memset(lppsh, 0, sizeof(PROPSHEETHEADER));
  149. lppsh->dwSize = sizeof(PROPSHEETHEADER);
  150. lppsh->dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
  151. lppsh->hwndParent = hwndOwner;
  152. lppsh->hInstance = hinst;
  153. lppsh->pszCaption = "Memory Options";
  154. lppsh->nPages = 0;
  155. lppsh->ppsp = apsp;
  156. // Init the first one, then copy its contents to all the others
  157. memset(apsp, 0, sizeof(PROPSHEETPAGE));
  158. apsp[0].dwSize = sizeof(PROPSHEETPAGE);
  159. // apsp[0].dwFlags = PSP_HASHELP;
  160. apsp[0].hInstance = hinst;
  161. for (nPropIdx = 1; nPropIdx < nMaxPropPages; nPropIdx++) {
  162. memcpy(&(apsp[nPropIdx]), &apsp[0], sizeof(PROPSHEETPAGE));
  163. }
  164. // Only init the distinct values
  165. nPropIdx = 0;
  166. apsp[nPropIdx].pszTemplate = MAKEINTRESOURCE(IDD_DLG_MEM_VIRTUAL);
  167. apsp[nPropIdx].pfnDlgProc = DlgProc_Virtual_Mem;
  168. if (g_TargetClass == DEBUG_CLASS_KERNEL)
  169. {
  170. nPropIdx = 1;
  171. apsp[nPropIdx].pszTemplate = MAKEINTRESOURCE(IDD_DLG_MEM_PHYSICAL);
  172. apsp[nPropIdx].pfnDlgProc = DlgProc_Physical_Mem;
  173. nPropIdx = 2;
  174. apsp[nPropIdx].pszTemplate = MAKEINTRESOURCE(IDD_DLG_MEM_BUS_DATA);
  175. apsp[nPropIdx].pfnDlgProc = DlgProc_Bus_Mem;
  176. nPropIdx = 3;
  177. apsp[nPropIdx].pszTemplate = MAKEINTRESOURCE(IDD_DLG_MEM_CONTROL);
  178. apsp[nPropIdx].pfnDlgProc = DlgProc_Control_Mem;
  179. nPropIdx = 4;
  180. apsp[nPropIdx].pszTemplate = MAKEINTRESOURCE(IDD_DLG_MEM_IO);
  181. apsp[nPropIdx].pfnDlgProc = DlgProc_IO_Mem;
  182. nPropIdx = 5;
  183. apsp[nPropIdx].pszTemplate = MAKEINTRESOURCE(IDD_DLG_MEM_MSR);
  184. apsp[nPropIdx].pfnDlgProc = DlgProc_MSR_Mem;
  185. }
  186. Assert(nPropIdx < nMaxPropPages);
  187. lppsh->nPages = nPropIdx + 1;
  188. }
  189. INT_PTR
  190. CALLBACK
  191. DlgProc_MemoryProperties(
  192. MEMORY_TYPE memtype,
  193. HWND hDlg,
  194. UINT uMsg,
  195. WPARAM wParam,
  196. LPARAM lParam
  197. )
  198. {
  199. LRESULT nPos;
  200. MEMWIN_DATA *pMemWinData = GetMemWinData( hwndMemOptsParent );
  201. switch (uMsg) {
  202. /*
  203. case WM_HELP:
  204. WinHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, "windbg.hlp", HELP_WM_HELP,
  205. (DWORD_PTR)(LPVOID) HelpArray );
  206. return TRUE;
  207. case WM_CONTEXTMENU:
  208. WinHelp ((HWND) wParam, "windbg.hlp", HELP_CONTEXTMENU,
  209. (DWORD_PTR)(LPVOID) HelpArray );
  210. return TRUE;
  211. */
  212. case WM_COMMAND:
  213. /*{
  214. WORD wNotifyCode = HIWORD(wParam); // notification code
  215. WORD wID = LOWORD(wParam); // item, control, or accelerator identifier
  216. HWND hwndCtl = (HWND) lParam; // handle of control
  217. BOOL bEnabled;
  218. switch(wID) {
  219. case ID_ENV_SRCHPATH:
  220. if (BN_CLICKED == wNotifyCode) {
  221. BOOL b = IsDlgButtonChecked(hDlg, ID_ENV_SRCHPATH);
  222. EnableWindow(GetDlgItem(hDlg, IDC_EDIT_EXECUTABLE_SEARCH_PATH), b);
  223. EnableWindow(GetDlgItem(hDlg, IDC_BUT_BROWSE), b);
  224. return TRUE;
  225. }
  226. break;
  227. }
  228. }*/
  229. break;
  230. case WM_INITDIALOG:
  231. { // begin Prog & Arguments code block
  232. int nIdx;
  233. TCHAR szTmp[MAX_MSG_TXT];
  234. //
  235. // Enter the display formats
  236. //
  237. for (nIdx=0; nIdx < g_nMaxNumFormatsMemWin; nIdx++) {
  238. nPos = SendDlgItemMessage(hDlg,
  239. IDC_COMBO_DISPLAY_FORMAT,
  240. CB_ADDSTRING,
  241. 0,
  242. (LPARAM) g_FormatsMemWin[nIdx].lpszDescription
  243. );
  244. SendDlgItemMessage(hDlg,
  245. IDC_COMBO_DISPLAY_FORMAT,
  246. CB_SETITEMDATA,
  247. (WPARAM) nPos,
  248. (LPARAM) (UINT) nIdx
  249. );
  250. }
  251. SendDlgItemMessage(hDlg,
  252. IDC_COMBO_DISPLAY_FORMAT,
  253. CB_SELECTSTRING,
  254. (WPARAM) -1,
  255. (LPARAM) g_FormatsMemWin[pMemWinData->m_GenMemData.nDisplayFormat].lpszDescription
  256. );
  257. //
  258. // Update the offset. Offset is common to all dialogs
  259. //
  260. SendDlgItemMessage(hDlg, IDC_EDIT_OFFSET, EM_LIMITTEXT,
  261. sizeof(pMemWinData->m_OffsetExpr) - 1, 0);
  262. SetDlgItemText(hDlg, IDC_EDIT_OFFSET, pMemWinData->m_OffsetExpr);
  263. switch (memtype) {
  264. default:
  265. Assert(!"Unhandled value");
  266. break;
  267. case VIRTUAL_MEM_TYPE:
  268. // Nothing to do
  269. break;
  270. case PHYSICAL_MEM_TYPE:
  271. // Nothing to do
  272. break;
  273. case CONTROL_MEM_TYPE:
  274. SendDlgItemMessage(hDlg, IDC_EDIT_PROCESSOR, EM_LIMITTEXT,
  275. 32, 0);
  276. sprintf(szTmp, "%d",
  277. pMemWinData->m_GenMemData.any.control.Processor);
  278. SetDlgItemText(hDlg, IDC_EDIT_PROCESSOR, szTmp);
  279. break;
  280. case IO_MEM_TYPE:
  281. SendDlgItemMessage(hDlg, IDC_EDIT_BUS_NUMBER, EM_LIMITTEXT,
  282. 32, 0);
  283. SendDlgItemMessage(hDlg, IDC_EDIT_ADDRESS_SPACE, EM_LIMITTEXT,
  284. 32, 0);
  285. sprintf(szTmp, "%d",
  286. pMemWinData->m_GenMemData.any.io.BusNumber);
  287. SetDlgItemText(hDlg, IDC_EDIT_BUS_NUMBER, szTmp);
  288. sprintf(szTmp, "%d",
  289. pMemWinData->m_GenMemData.any.io.AddressSpace);
  290. SetDlgItemText(hDlg, IDC_EDIT_ADDRESS_SPACE, szTmp);
  291. //
  292. // Enter the interface types
  293. //
  294. for (nIdx = 0; nIdx < sizeof(rgInterfaceTypeNames) /
  295. sizeof(rgInterfaceTypeNames[0]); nIdx++) {
  296. nPos = SendDlgItemMessage(hDlg,
  297. IDC_COMBO_INTERFACE_TYPE,
  298. CB_ADDSTRING,
  299. 0,
  300. (LPARAM) rgInterfaceTypeNames[nIdx].psz
  301. );
  302. SendDlgItemMessage(hDlg,
  303. IDC_COMBO_INTERFACE_TYPE,
  304. CB_SETITEMDATA,
  305. (WPARAM) nPos,
  306. (LPARAM) (UINT) nIdx
  307. );
  308. }
  309. if (memtype == pMemWinData->m_GenMemData.memtype) {
  310. nIdx = pMemWinData->m_GenMemData.any.io.interface_type;
  311. } else {
  312. nIdx = 0;
  313. }
  314. SendDlgItemMessage(hDlg,
  315. IDC_COMBO_INTERFACE_TYPE,
  316. CB_SELECTSTRING,
  317. (WPARAM) -1,
  318. (LPARAM) rgInterfaceTypeNames[nIdx].psz
  319. );
  320. break;
  321. case MSR_MEM_TYPE:
  322. // Nothing to do
  323. break;
  324. case BUS_MEM_TYPE:
  325. SendDlgItemMessage(hDlg, IDC_EDIT_BUS_NUMBER, EM_LIMITTEXT,
  326. 32, 0);
  327. SendDlgItemMessage(hDlg, IDC_EDIT_SLOT_NUMBER, EM_LIMITTEXT,
  328. 32, 0);
  329. sprintf(szTmp, "%d",
  330. pMemWinData->m_GenMemData.any.bus.BusNumber);
  331. SetDlgItemText(hDlg, IDC_EDIT_BUS_NUMBER, szTmp);
  332. sprintf(szTmp, "%d",
  333. pMemWinData->m_GenMemData.any.bus.SlotNumber);
  334. SetDlgItemText(hDlg, IDC_EDIT_SLOT_NUMBER, szTmp);
  335. //
  336. // Enter the bus types
  337. //
  338. for (nIdx = 0; nIdx < sizeof(rgBusTypeNames) /
  339. sizeof(rgBusTypeNames[0]); nIdx++) {
  340. nPos = SendDlgItemMessage(hDlg,
  341. IDC_COMBO_BUS_DATA_TYPE,
  342. CB_ADDSTRING,
  343. 0,
  344. (LPARAM) rgBusTypeNames[nIdx].psz
  345. );
  346. SendDlgItemMessage(hDlg,
  347. IDC_COMBO_BUS_DATA_TYPE,
  348. CB_SETITEMDATA,
  349. (WPARAM) nPos,
  350. (LPARAM) (UINT) nIdx
  351. );
  352. }
  353. if (memtype == pMemWinData->m_GenMemData.memtype) {
  354. nIdx = pMemWinData->m_GenMemData.any.bus.bus_type;
  355. } else {
  356. nIdx = 0;
  357. }
  358. SendDlgItemMessage(hDlg,
  359. IDC_COMBO_BUS_DATA_TYPE,
  360. CB_SELECTSTRING,
  361. (WPARAM) -1,
  362. (LPARAM) rgBusTypeNames[nIdx].psz
  363. );
  364. break;
  365. }
  366. return FALSE;
  367. } // end Prog & Arguments code block
  368. break;
  369. case WM_NOTIFY:
  370. switch (((NMHDR FAR *) lParam)->code) {
  371. case PSN_SETACTIVE:
  372. pMemWinData->m_GenMemData.memtype = memtype;
  373. return 0;
  374. case PSN_KILLACTIVE:
  375. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
  376. return 1;
  377. case PSN_APPLY:
  378. if (memtype != pMemWinData->m_GenMemData.memtype) {
  379. // This isn't the current page so ignore.
  380. break;
  381. }
  382. int nIdx;
  383. TCHAR szTmp[MAX_MSG_TXT];
  384. ULONG64 u64; // tmp value
  385. //
  386. // Get the display formats
  387. //
  388. nPos = SendDlgItemMessage(hDlg,
  389. IDC_COMBO_DISPLAY_FORMAT,
  390. CB_GETCURSEL,
  391. 0,
  392. 0
  393. );
  394. if (CB_ERR == nPos) {
  395. pMemWinData->m_GenMemData.nDisplayFormat = 0;
  396. } else {
  397. nIdx = (int)SendDlgItemMessage(hDlg,
  398. IDC_COMBO_DISPLAY_FORMAT,
  399. CB_GETITEMDATA,
  400. (WPARAM) nPos,
  401. 0
  402. );
  403. if (CB_ERR == nIdx) {
  404. pMemWinData->m_GenMemData.nDisplayFormat = 0;
  405. } else {
  406. pMemWinData->m_GenMemData.nDisplayFormat = nIdx;
  407. }
  408. }
  409. //
  410. // Update the offset. Offset is common to all dialogs
  411. //
  412. GetDlgItemText(hDlg, IDC_EDIT_OFFSET,
  413. pMemWinData->m_OffsetExpr,
  414. sizeof(pMemWinData->m_OffsetExpr));
  415. switch (memtype) {
  416. default:
  417. Assert(!"Unhandled value");
  418. break;
  419. case VIRTUAL_MEM_TYPE:
  420. // Nothing to do
  421. break;
  422. case PHYSICAL_MEM_TYPE:
  423. // Nothing to do
  424. break;
  425. case CONTROL_MEM_TYPE:
  426. GetDlgItemText(hDlg, IDC_EDIT_PROCESSOR,
  427. szTmp, _tsizeof(szTmp));
  428. if (sscanf(szTmp, "%d", &pMemWinData->
  429. m_GenMemData.any.control.Processor) != 1)
  430. {
  431. pMemWinData->m_GenMemData.any.control.Processor = 0;
  432. }
  433. break;
  434. case IO_MEM_TYPE:
  435. GetDlgItemText(hDlg, IDC_EDIT_BUS_NUMBER,
  436. szTmp, _tsizeof(szTmp));
  437. if (sscanf(szTmp, "%d", &pMemWinData->
  438. m_GenMemData.any.io.BusNumber) != 1)
  439. {
  440. pMemWinData->m_GenMemData.any.io.BusNumber = 0;
  441. }
  442. GetDlgItemText(hDlg, IDC_EDIT_ADDRESS_SPACE,
  443. szTmp, _tsizeof(szTmp));
  444. if (sscanf(szTmp, "%d", &pMemWinData->
  445. m_GenMemData.any.io.AddressSpace) != 1)
  446. {
  447. pMemWinData->m_GenMemData.any.io.AddressSpace = 0;
  448. }
  449. //
  450. // Get the interface types
  451. //
  452. nPos = SendDlgItemMessage(hDlg,
  453. IDC_COMBO_INTERFACE_TYPE,
  454. CB_GETCURSEL,
  455. 0,
  456. 0
  457. );
  458. if (CB_ERR == nPos) {
  459. pMemWinData->m_GenMemData.any.io.interface_type =
  460. _INTERFACE_TYPE(0);
  461. } else {
  462. nIdx = (int)SendDlgItemMessage(hDlg,
  463. IDC_COMBO_INTERFACE_TYPE,
  464. CB_GETITEMDATA,
  465. (WPARAM) nPos,
  466. 0
  467. );
  468. if (CB_ERR == nIdx) {
  469. pMemWinData->m_GenMemData.any.io.interface_type =
  470. _INTERFACE_TYPE(0);
  471. } else {
  472. pMemWinData->m_GenMemData.any.io.interface_type =
  473. _INTERFACE_TYPE(nIdx);
  474. }
  475. }
  476. break;
  477. case MSR_MEM_TYPE:
  478. // Nothing to do
  479. break;
  480. case BUS_MEM_TYPE:
  481. GetDlgItemText(hDlg, IDC_EDIT_BUS_NUMBER,
  482. szTmp, _tsizeof(szTmp));
  483. if (sscanf(szTmp, "%d", &pMemWinData->
  484. m_GenMemData.any.bus.BusNumber) != 1)
  485. {
  486. pMemWinData->m_GenMemData.any.bus.BusNumber = 0;
  487. }
  488. GetDlgItemText(hDlg, IDC_EDIT_SLOT_NUMBER,
  489. szTmp, _tsizeof(szTmp));
  490. if (sscanf(szTmp, "%d", &pMemWinData->
  491. m_GenMemData.any.bus.SlotNumber) != 1)
  492. {
  493. pMemWinData->m_GenMemData.any.bus.SlotNumber = 0;
  494. }
  495. //
  496. // Get the bus type
  497. //
  498. nPos = SendDlgItemMessage(hDlg,
  499. IDC_COMBO_BUS_DATA_TYPE,
  500. CB_GETCURSEL,
  501. 0,
  502. 0
  503. );
  504. if (CB_ERR == nPos) {
  505. pMemWinData->m_GenMemData.any.bus.bus_type =
  506. _BUS_DATA_TYPE(0);
  507. } else {
  508. nIdx = (int)SendDlgItemMessage(hDlg,
  509. IDC_COMBO_BUS_DATA_TYPE,
  510. CB_GETITEMDATA,
  511. (WPARAM) nPos,
  512. 0
  513. );
  514. if (CB_ERR == nIdx) {
  515. pMemWinData->m_GenMemData.any.bus.bus_type =
  516. _BUS_DATA_TYPE(0);
  517. } else {
  518. pMemWinData->m_GenMemData.any.bus.bus_type =
  519. _BUS_DATA_TYPE(nIdx);
  520. }
  521. }
  522. break;
  523. }
  524. return FALSE;
  525. }
  526. break;
  527. }
  528. return FALSE;
  529. }
  530. #if 0
  531. void
  532. Workspace_ApplyChanges(
  533. HWND hDlg
  534. )
  535. {
  536. BOOL bChecked = FALSE;
  537. char sz[_MAX_PATH];
  538. if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_RADIO_AUTO_SAVE_WORKSPACE) ) {
  539. g_contGlobalPreferences_WkSp.m_bAlwaysSaveWorkspace = TRUE;
  540. g_contGlobalPreferences_WkSp.m_bPromptBeforeSavingWorkspace = FALSE;
  541. } else if (BST_CHECKED == IsDlgButtonChecked(hDlg, IDC_RADIO_PROMPT_BEFORE_SAVING_WORKSPACE)) {
  542. g_contGlobalPreferences_WkSp.m_bPromptBeforeSavingWorkspace = TRUE;
  543. g_contGlobalPreferences_WkSp.m_bAlwaysSaveWorkspace = TRUE;
  544. } else {
  545. g_contGlobalPreferences_WkSp.m_bPromptBeforeSavingWorkspace = FALSE;
  546. g_contGlobalPreferences_WkSp.m_bAlwaysSaveWorkspace = FALSE;
  547. }
  548. bChecked = (IsDlgButtonChecked(hDlg,ID_LFOPT_APPEND) == BST_CHECKED);
  549. if (bChecked != g_contWorkspace_WkSp.m_bLfOptAppend) {
  550. g_contWorkspace_WkSp.m_bLfOptAppend = bChecked;
  551. }
  552. bChecked = (IsDlgButtonChecked(hDlg,ID_LFOPT_AUTO) == BST_CHECKED);
  553. if (bChecked != g_contWorkspace_WkSp.m_bLfOptAuto) {
  554. g_contWorkspace_WkSp.m_bLfOptAuto = bChecked;
  555. }
  556. GetDlgItemText(hDlg, ID_LFOPT_FNAME, sz, sizeof(sz));
  557. if (strlen(sz) == 0) {
  558. Assert(strlen(DEFAULT_CMD_WINDOW_LOGFILENAME) < sizeof(sz));
  559. strcpy( sz, DEFAULT_CMD_WINDOW_LOGFILENAME );
  560. }
  561. if (0 == g_contWorkspace_WkSp.m_pszLogFileName
  562. || strcmp(sz, g_contWorkspace_WkSp.m_pszLogFileName)) {
  563. FREE_STR(g_contWorkspace_WkSp.m_pszLogFileName);
  564. g_contWorkspace_WkSp.m_pszLogFileName = _strdup(sz);
  565. }
  566. }
  567. #endif
  568. INT_PTR
  569. CALLBACK
  570. DlgProc_Physical_Mem(
  571. HWND hDlg,
  572. UINT uMsg,
  573. WPARAM wParam,
  574. LPARAM lParam
  575. )
  576. {
  577. return DlgProc_MemoryProperties(PHYSICAL_MEM_TYPE, hDlg, uMsg, wParam, lParam);
  578. }
  579. INT_PTR
  580. CALLBACK
  581. DlgProc_Virtual_Mem(
  582. HWND hDlg,
  583. UINT uMsg,
  584. WPARAM wParam,
  585. LPARAM lParam
  586. )
  587. {
  588. return DlgProc_MemoryProperties(VIRTUAL_MEM_TYPE, hDlg, uMsg, wParam, lParam);
  589. }
  590. INT_PTR
  591. CALLBACK
  592. DlgProc_IO_Mem(
  593. HWND hDlg,
  594. UINT uMsg,
  595. WPARAM wParam,
  596. LPARAM lParam
  597. )
  598. {
  599. return DlgProc_MemoryProperties(IO_MEM_TYPE, hDlg, uMsg, wParam, lParam);
  600. }
  601. INT_PTR
  602. CALLBACK
  603. DlgProc_Bus_Mem(
  604. HWND hDlg,
  605. UINT uMsg,
  606. WPARAM wParam,
  607. LPARAM lParam
  608. )
  609. {
  610. return DlgProc_MemoryProperties(BUS_MEM_TYPE, hDlg, uMsg, wParam, lParam);
  611. }
  612. INT_PTR
  613. CALLBACK
  614. DlgProc_Control_Mem(
  615. HWND hDlg,
  616. UINT uMsg,
  617. WPARAM wParam,
  618. LPARAM lParam
  619. )
  620. {
  621. return DlgProc_MemoryProperties(CONTROL_MEM_TYPE, hDlg, uMsg, wParam, lParam);
  622. }
  623. INT_PTR
  624. CALLBACK
  625. DlgProc_MSR_Mem(
  626. HWND hDlg,
  627. UINT uMsg,
  628. WPARAM wParam,
  629. LPARAM lParam
  630. )
  631. {
  632. return DlgProc_MemoryProperties(MSR_MEM_TYPE, hDlg, uMsg, wParam, lParam);
  633. }