Changeset 5160 for trunk/src/win32k/utils/Win32kCC.c
- Timestamp:
- Feb 17, 2001, 9:25:44 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/utils/Win32kCC.c
r5119 r5160 1 /* $Id: Win32kCC.c,v 1.1 2 2001-02-11 23:41:46bird Exp $1 /* $Id: Win32kCC.c,v 1.13 2001-02-17 20:25:44 bird Exp $ 2 2 * 3 3 * Win32CC - Win32k Control Center. … … 22 22 23 23 /* 24 * Notebook page constants. 25 */ 26 #define W32KCCPG_STATUS 0 27 #define W32KCCPG_LOADERS 1 28 #define W32KCCPG_LOGGING 2 29 #define W32KCCPG_HEAPS 3 30 #define W32KCCPG_LDRFIX 4 31 #define W32KCCPG_MEMINFO 5 32 #define W32KCCPG_PAGES (W32KCCPG_MEMINFO+1) 33 34 35 /* 24 36 * Include defines 25 37 */ … … 27 39 #define INCL_DOSFILEMGR 28 40 #define INCL_DOSRESOURCES 41 #define INCL_DOSMISC 42 29 43 #define INCL_WINERRORS 30 44 #define INCL_WINDIALOGS … … 33 47 #define INCL_WINBUTTONS 34 48 #define INCL_WINWINDOWMGR 35 #define INCL_DOSMISC 49 #define INCL_WINSTDBOOK 50 #define INCL_WINSYS 51 #define INCL_WINTIMER 52 53 #define INCL_WINACCELERATORS 54 #define INCL_WINFRAMEMGR 55 56 #define INCL_GPIPRIMITIVES 57 #define INCL_GPILCIDS 58 59 36 60 37 61 /******************************************************************************* … … 53 77 54 78 55 56 79 /******************************************************************************* 57 80 * Structures and Typedefs * 58 81 *******************************************************************************/ 59 typedef struct _W IN32KCC82 typedef struct _Win32kCCPage 60 83 { 84 ULONG ulId; 61 85 HWND hwnd; 62 HAB hab; 63 BOOL fDirty; 64 65 K32OPTIONS Options; 66 K32OPTIONS NewOptions; 67 K32STATUS Status; 86 } WIN32KCCPAGE, *PWIN32KCCPAGE; 87 88 typedef struct _Win32kCC 89 { 90 HWND hwnd; 91 HWND hwndNtbk; 92 HAB hab; 93 BOOL fDirty; 94 95 K32OPTIONS Options; 96 K32OPTIONS NewOptions; 97 K32STATUS Status; 98 99 ULONG idMemTimer; /* The Timer ID of the MemInfo Refresh Timer. */ 100 K32SYSTEMMEMINFO MemInfo; /* Current displayed meminfo. */ 101 102 WIN32KCCPAGE aPages[W32KCCPG_PAGES]; /* Array containing generic page info. */ 68 103 69 104 } WIN32KCC, *PWIN32KCC; … … 78 113 * WM_QUITs. 79 114 */ 80 115 BOOL fOldNtbk; /* Set if we must use the old notebook 116 * style. 117 */ 81 118 82 119 /******************************************************************************* 83 120 * Internal Functions * 84 121 *******************************************************************************/ 85 MRESULT EXPENTRY Win32kCCDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 122 MRESULT EXPENTRY Win32kCCDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 123 124 MRESULT EXPENTRY LoadersDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 125 MRESULT EXPENTRY LoggingDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 126 MRESULT EXPENTRY StatusDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 127 MRESULT EXPENTRY HeapsDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 128 MRESULT EXPENTRY LdrFixDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 129 MRESULT EXPENTRY MemInfoDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 130 131 MRESULT EXPENTRY NtbkDefPageDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 132 133 BOOL SetDlgItemTextF(HWND hwndDlg, ULONG idItem, PSZ pszFormat, ...); 86 134 ULONG ShowMessage(HWND hwndOwner, int id, ULONG flStyle); 87 135 BOOL Complain(HWND hwndOwner, int id, ...); … … 108 156 ULONG rc = 0; 109 157 HWND hwnd; 158 ULONG aulVer[2]; 110 159 111 160 /* … … 146 195 147 196 /* 197 * Check version and set fOldNtbk accordingly. 198 */ 199 fOldNtbk = (DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, &aulVer, sizeof(aulVer)) 200 || (aulVer[1] <= 20 && aulVer[0] < 40)); 201 202 /* 148 203 * Load the dialog. 149 204 */ … … 151 206 Win32kCCDlgProc, 152 207 NULLHANDLE, 153 DL_WIN32KCC,208 fOldNtbk ? DL_WIN32KCC_OLD : DL_WIN32KCC, 154 209 NULL); 155 210 … … 193 248 194 249 /** 195 * Dialog procedure for the DL_WIN32KCC dialog.250 * Dialog procedure for the DL_WIN32KCC notebook dialog. 196 251 * (See PMREF for the general specifications of this function.) 197 252 */ … … 199 254 { 200 255 PWIN32KCC pThis; 256 int i; 201 257 202 258 … … 218 274 { 219 275 /* 220 * Sets the controls according to the data from win32k.276 * Initialize the controls and trigger a setcontrol event. 221 277 * 222 278 * mr: Focus changed or not. … … 226 282 case WM_INITDLG: 227 283 { 228 229 /* 230 * Initiate controls (ie. behaviour not data). 231 * - Ranges of the info level spinbuttons. 232 * - Max length of the max heap size entry fields. 233 */ 234 WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0); 235 WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0); 236 237 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128); 238 WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128); 239 284 static struct _NtbkPage 285 { 286 PFNWP pfnDlgProc; 287 ULONG idDlg; 288 ULONG idPage; 289 } aPages[W32KCCPG_PAGES] = 290 { 291 { StatusDlgProc , PG_WIN32K_INFO_PAGE, W32KCCPG_STATUS }, 292 { LoadersDlgProc, DL_LOADERS_PAGE, W32KCCPG_LOADERS}, 293 { LoggingDlgProc, DL_LOGGING_PAGE, W32KCCPG_LOGGING}, 294 { HeapsDlgProc , DL_HEAPS_PAGE, W32KCCPG_HEAPS }, 295 { LdrFixDlgProc , DL_LDRFIX_PAGE, W32KCCPG_LDRFIX }, 296 { MemInfoDlgProc , DL_MEMINFO_PAGE, W32KCCPG_MEMINFO } 297 }; 298 CHAR szTabText[128]; 299 PDLGTEMPLATE pdlgt; 300 APIRET rc; 301 RECTL rectl; 302 SWP swp; 303 SWP swp2; 240 304 241 305 /* 242 306 * Init and set instance data. 243 307 */ 244 pThis = malloc(sizeof(*pThis));308 pThis = calloc(sizeof(*pThis), 1); 245 309 if (pThis == NULL) 246 310 { … … 252 316 pThis->hwnd = hwnd; 253 317 pThis->hab = WinQueryAnchorBlock(hwnd); 318 pThis->hwndNtbk = WinWindowFromID(hwnd, DL_WIN32KCC_NTBK); 254 319 if (!WinSetWindowPtr(hwnd, QWL_USER, pThis)) 255 320 { 256 321 /* complain, dismiss and return. */ 257 Complain(hwnd, IDS_ERR_SET_INSTA CEDATA,322 Complain(hwnd, IDS_ERR_SET_INSTANCEDATA, 258 323 WinGetLastError(pThis->hab), 259 324 getLastErrorMsg(pThis->hab)); … … 263 328 return FALSE; 264 329 } 330 331 332 /* 333 * Load and set accellerator table. 334 */ 335 WinSetAccelTable(pThis->hab, WinLoadAccelTable(pThis->hab, NULLHANDLE, DL_WIN32KCC), hwnd); 336 337 338 /* 339 * Insert notebooks pages. 340 */ 341 for (i = 0; i < W32KCCPG_PAGES; i++) 342 { 343 ULONG ulErrId = 0; 344 ULONG iPage = aPages[i].idPage; 345 346 rc = DosGetResource(NULLHANDLE, RT_DIALOG, aPages[i].idDlg, (PPVOID)(void*)&pdlgt); 347 if (rc) 348 { 349 Complain(hwnd, IDS_ERR_FAILED_TO_LOAD_DLGT, aPages[i].idDlg, rc); 350 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 351 WinSendMsg(hwnd, WM_DESTROY, NULL, NULL); 352 return FALSE; 353 } 354 355 pThis->aPages[iPage].hwnd = 356 (HWND)WinLoadDlg(hwnd, HWND_DESKTOP, aPages[i].pfnDlgProc, 357 NULLHANDLE, aPages[i].idDlg, pThis); 358 if (pThis->aPages[iPage].hwnd != NULLHANDLE) 359 { 360 /* 361 * Resize the notebook according to the first page. 362 * Get the size of the page we're inserting 363 * Calc notebook size according to that page. 364 * Resize the notebook controll. 365 * Resize the dialog. 366 * Recalc page rectangle. 367 */ 368 if (i == 0) 369 { 370 WinQueryWindowPos(pThis->aPages[iPage].hwnd, &swp); 371 rectl.xLeft = rectl.yBottom = 0; 372 rectl.xRight = swp.cx; 373 rectl.yTop = swp.cy; 374 WinSendMsg(pThis->hwndNtbk, BKM_CALCPAGERECT, &rectl, (MPARAM)FALSE); 375 376 WinQueryWindowPos(pThis->hwndNtbk, &swp); 377 WinSetWindowPos(pThis->hwndNtbk, NULLHANDLE, 378 0, 0, 379 rectl.xRight - rectl.xLeft, 380 rectl.yTop - rectl.yBottom, 381 SWP_SIZE); 382 383 WinQueryWindowPos(hwnd, &swp2); 384 WinSetWindowPos(hwnd, NULLHANDLE, 385 0, 0, 386 swp2.cx + (rectl.xRight - rectl.xLeft) - swp.cx, 387 swp2.cy + (rectl.yTop - rectl.yBottom) - swp.cy, 388 SWP_SIZE); 389 } 390 391 /* 392 * Insert page. 393 */ 394 pThis->aPages[iPage].ulId = 395 (ULONG)WinSendMsg(pThis->hwndNtbk, BKM_INSERTPAGE, NULL, 396 MPFROM2SHORT(BKA_MAJOR | BKA_AUTOPAGESIZE, BKA_LAST)); 397 if (pThis->aPages[iPage].ulId != 0) 398 { 399 /* 400 * Place the dialog into the page. 401 */ 402 if (WinSendMsg(pThis->hwndNtbk, BKM_SETPAGEWINDOWHWND, 403 (MPARAM)pThis->aPages[iPage].ulId, (MPARAM)pThis->aPages[iPage].hwnd)) 404 { 405 /* 406 * Set tab text - use the title of the dialog. 407 */ 408 szTabText[0] = '\0'; 409 if ( pdlgt != NULL && pdlgt->adlgti[0].cchText != 0 410 && pdlgt->adlgti[0].offText != 0xFFFF && pdlgt->adlgti[0].offText != 0) 411 strncat(szTabText, (char*)((unsigned)(pdlgt) + pdlgt->adlgti[0].offText), pdlgt->adlgti[0].cchText); 412 WinSendMsg(pThis->hwndNtbk, BKM_SETTABTEXT, (MPARAM)pThis->aPages[iPage].ulId, &szTabText[0]); 413 } 414 else 415 ulErrId = IDS_ERR_ADD_NTBK_PAGE_SET; 416 } 417 else 418 ulErrId = IDS_ERR_ADD_NTBK_PAGE_INSERT; 419 } 420 else 421 ulErrId = IDS_ERR_ADD_NTBK_PAGE_LOAD; 422 423 /* Check for error */ 424 if (ulErrId) 425 { 426 Complain(hwnd, ulErrId, aPages[i].idDlg, WinGetLastError(pThis->hab), getLastErrorMsg(pThis->hab)); 427 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 428 WinSendMsg(hwnd, WM_DESTROY, NULL, NULL); 429 return FALSE; 430 } 431 } 432 433 if (fOldNtbk) 434 { 435 POINTL ptl; 436 FONTMETRICS fm; 437 438 /* 439 * If it's an old style dialog we'll have to resize the tabs. 440 * Hackish!!! Seems like I don't do this right! 441 */ 442 for (i = 0, ptl.x = 7, ptl.y = 7; i < W32KCCPG_PAGES; i++) 443 { 444 BOOKTEXT booktxt = {&szTabText[0], sizeof(szTabText)}; 445 if (pThis->aPages[i].hwnd == NULLHANDLE) continue; 446 447 if (WinSendMsg(pThis->hwndNtbk, BKM_QUERYTABTEXT, (MPARAM)pThis->aPages[i].ulId, &booktxt)) 448 { 449 POINTL aptl[TXTBOX_COUNT]; 450 if (GpiQueryTextBox(WinGetPS(pThis->hwndNtbk), strlen(booktxt.pString)+1, booktxt.pString, TXTBOX_COUNT, aptl)) 451 { 452 if (ptl.x < abs(aptl[TXTBOX_BOTTOMRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x)) 453 ptl.x = abs(aptl[TXTBOX_BOTTOMRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x); 454 } 455 } 456 } 457 if (GpiQueryFontMetrics(WinGetPS(pThis->hwndNtbk), sizeof(fm), &fm)) 458 ptl.y = fm.lXHeight + fm.lEmHeight; 459 460 461 /* 462 * Before we resize anything, we'll have to get the size of a page. 463 * Change the tab size. This may effect the notebook page size. 464 * Recalc new notebook size using old page size. 465 * Addjust dialog window. 466 * Addjust notebook control. 467 */ 468 WinQueryWindowPos(pThis->aPages[aPages[0].idPage].hwnd, &swp); 469 470 WinSendMsg(pThis->hwndNtbk, BKM_SETDIMENSIONS, MPFROM2SHORT(ptl.x, ptl.y), (MPARAM)BKA_MAJORTAB); 471 472 rectl.xLeft = swp.x; 473 rectl.yBottom = swp.y; 474 rectl.xRight = swp.cx - swp.x; 475 rectl.yTop = swp.cy - swp.y; 476 WinSendMsg(pThis->hwndNtbk, BKM_CALCPAGERECT, &rectl, (MPARAM)FALSE); 477 WinQueryWindowPos(hwnd, &swp); 478 WinQueryWindowPos(pThis->hwndNtbk, &swp2); 479 WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, 480 swp.cx + rectl.xRight - rectl.xLeft - swp2.cx, 481 swp.cy + rectl.yTop - rectl.yBottom - swp2.cy, 482 SWP_SIZE); 483 WinSetWindowPos(pThis->hwndNtbk, NULLHANDLE, 0, 0, 484 rectl.xRight - rectl.xLeft, 485 rectl.yTop - rectl.yBottom, 486 SWP_SIZE); 487 488 /* 489 * Set Status text background color to dialog background color. 490 */ 491 WinSendMsg(pThis->hwndNtbk, BKM_SETNOTEBOOKCOLORS, 492 (MPARAM)SYSCLR_DIALOGBACKGROUND, 493 (MPARAM)BKA_BACKGROUNDPAGECOLORINDEX); 494 } 495 265 496 266 497 /* … … 454 685 WinSendMsg(hwnd, WM_COMMAND, 455 686 MPFROMSHORT(DID_OK), MPFROM2SHORT(CMDSRC_MENU, FALSE)); 456 break;687 return NULL; 457 688 458 689 459 690 /* 460 691 * Window is destroyed (last message which ever should reach us!) 692 * -Free acceltable if present. 461 693 * -Free instance data 462 694 * -Set the instance data pointer to NULL (just in case). … … 464 696 case WM_DESTROY: 465 697 { 698 HACCEL haccel = WinQueryAccelTable(pThis->hab, hwnd); 699 if (haccel) 700 WinDestroyAccelTable(haccel); 466 701 free(pThis); 467 702 WinSetWindowPtr(hwnd, QWL_USER, NULL); … … 481 716 { 482 717 APIRET rc; 483 CHAR szNumber[32];484 CHAR szBuffer[100];485 486 718 487 719 /* … … 503 735 504 736 /* 505 * Set the controls.737 * Update the individual pages. 506 738 */ 507 /* win32k */ 508 sprintf(szBuffer, "%d.%d", 0, pThis->Status.ulVersion); 509 WinSetDlgItemText(hwnd, TX_W32K_VERSION_VAL, szBuffer); 510 sprintf(szBuffer, "%s %s", pThis->Status.szBuildTime, pThis->Status.szBuildDate); 511 WinSetDlgItemText(hwnd, TX_W32K_BUILD_DATETIME_VAL, szBuffer); 512 WinSetDlgItemText(hwnd, TX_W32K_SYMBOLFILE_VAL, pThis->Status.szSymFile); 513 sprintf(szBuffer, "%d - ", pThis->Status.ulBuild); 514 if (GetFixpackDesc(pThis->Status.ulBuild, pThis->Status.fKernel, szBuffer + strlen(szBuffer))) 515 sprintf(szBuffer, "%d", pThis->Status.ulBuild); 516 WinSetDlgItemText(hwnd, TX_W32K_KERNELBUILD_VAL, szBuffer); 517 518 /* logging */ 519 WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fLogging), NULL); 520 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3f8), NULL); 521 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2f8), NULL); 522 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3e8), NULL); 523 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2e8), NULL); 524 525 /* loaders */ 739 for (i = 0; i < W32KCCPG_PAGES; i++) 740 { 741 if (pThis->aPages[i].hwnd != NULLHANDLE) 742 WinSendMsg(pThis->aPages[i].hwnd, msg, mp1, mp2); 743 } 744 745 /* Since all fields are update now - we can't be dirty any longer. */ 746 pThis->fDirty = FALSE; 747 return NULL; 748 } 749 750 751 /* 752 * Validate data in the controls. Complains accoring to mp1. 753 * Put the data into the win32k option struct. 754 * 755 * mr: Valid indicator. 756 * TRUE: Valid data. 757 * FALSE: Not valid data. 758 * mp1: BOOL fComplain. 759 * TRUE: Do complain about errors. The pThis->Options struct 760 * is updated on successful return. 761 * FALSE: Do not complain about errors, and don't update the 762 * pThis->Options struct. 763 * mp2: reserved. 764 */ 765 case WM_QUERYCONTROLS: 766 { 767 /* 768 * Init temporary option struct. 769 */ 770 memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS)); 771 pThis->NewOptions.cb = sizeof(K32OPTIONS); 772 773 /* 774 * Query the individual pages. 775 */ 776 for (i = 0; i < W32KCCPG_PAGES; i++) 777 { 778 if (pThis->aPages[i].hwnd != NULLHANDLE) 779 if (!WinSendMsg(pThis->aPages[i].hwnd, msg, mp1, mp2)) 780 { 781 WinSendMsg(pThis->hwndNtbk, BKM_TURNTOPAGE, (MPARAM)pThis->aPages[i].ulId, NULL); 782 return (MPARAM)FALSE; 783 } 784 } 785 786 /* 787 * Check if there is any change and set the fDirty flag accordingly. 788 */ 789 pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0; 790 return (MPARAM)TRUE; 791 } 792 793 case WM_TRANSLATEACCEL: 794 { 795 break; 796 } 797 } 798 799 /* 800 * Return thru the default dialog procedure. 801 */ 802 return WinDefDlgProc(hwnd, msg, mp1, mp2); 803 } 804 805 806 /** 807 * Dialog procedure for the DL_ dialog. 808 * (See PMREF for the general specifications of this function.) 809 */ 810 MRESULT EXPENTRY LoadersDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 811 { 812 PWIN32KCC pThis; 813 814 815 /* 816 * Get instance data pointer (pThis). 817 */ 818 if (msg != WM_INITDLG) 819 { 820 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 821 if (pThis == NULL) 822 return WinDefDlgProc(hwnd, msg, mp1, mp2); 823 } 824 825 826 /* 827 * Message switch. 828 */ 829 switch (msg) 830 { 831 /* 832 * Initialize controls. 833 * 834 * mr: Focus changed or not. 835 * mp1: hwnd of dialog 836 * mp2: (user data) (NULL) 837 */ 838 case WM_INITDLG: 839 { 840 /* 841 * Initiate controls (ie. behaviour not data). 842 * - Ranges of the info level spinbuttons. 843 */ 844 WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0); 845 WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0); 846 break; 847 } 848 849 850 /* 851 * Gets data from win32k. 852 * Sets the controls according to the data from win32k. 853 * 854 * mr: reserved 855 * mp1: reserved 856 * mp2: reserved 857 */ 858 case WM_SETCONTROLS: 859 { 860 CHAR szNumber[32]; 861 526 862 WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_SETCHECK, (MPARAM)(pThis->Options.fNoLoader), NULL); 527 863 /* PE */ … … 545 881 /* REXX Scripts */ 546 882 WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_SETCHECK, (MPARAM)(pThis->Options.fREXXScript), NULL); 547 548 /* OS/2 Loader Fixes */549 WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_SETCHECK, (MPARAM)(pThis->Options.fDllFixes), NULL);550 WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_SETCHECK, (MPARAM)(pThis->Options.fForcePreload), NULL);551 552 /* heaps */553 /* Resident */554 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbResHeapMax / 1024), NULL);555 sprintf(szNumber, "%d", pThis->Status.cbResHeapInit / 1024);556 WinSetDlgItemText(hwnd, TX_HEAP_RES_INIT_VAL, szNumber);557 sprintf(szNumber, "%d", pThis->Status.cbResHeapSize / 1024);558 WinSetDlgItemText(hwnd, TX_HEAP_RES_SIZE_VAL, szNumber);559 sprintf(szNumber, "%d", pThis->Status.cbResHeapUsed / 1024);560 WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_VAL, szNumber);561 sprintf(szNumber, "%d", pThis->Status.cbResHeapFree / 1024);562 WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_VAL, szNumber);563 sprintf(szNumber, "%d", pThis->Status.cResBlocksUsed);564 WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_BLOCKS_VAL, szNumber);565 sprintf(szNumber, "%d", pThis->Status.cResBlocksFree);566 WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_BLOCKS_VAL, szNumber);567 /* Swappable */568 WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbSwpHeapMax / 1024), NULL);569 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapInit / 1024);570 WinSetDlgItemText(hwnd, TX_HEAP_SWP_INIT_VAL, szNumber);571 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapSize / 1024);572 WinSetDlgItemText(hwnd, TX_HEAP_SWP_SIZE_VAL, szNumber);573 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapUsed / 1024);574 WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_VAL, szNumber);575 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapFree / 1024);576 WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_VAL, szNumber);577 sprintf(szNumber, "%d", pThis->Status.cSwpBlocksUsed);578 WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_BLOCKS_VAL, szNumber);579 sprintf(szNumber, "%d", pThis->Status.cSwpBlocksFree);580 WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_BLOCKS_VAL, szNumber);581 582 pThis->fDirty = FALSE;583 883 return NULL; 584 884 } … … 601 901 case WM_QUERYCONTROLS: 602 902 { 603 BOOL fComplain = (BOOL)mp1; 604 ULONG ul; 605 606 /* 607 * Init temporary option struct. 608 */ 609 memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS)); 610 pThis->NewOptions.cb = sizeof(K32OPTIONS); 611 612 /* 613 * Logging. 614 */ 615 pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0; 616 if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL)) 617 pThis->NewOptions.usCom = 0x3f8; 618 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL)) 619 pThis->NewOptions.usCom = 0x2f8; 620 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL)) 621 pThis->NewOptions.usCom = 0x3e8; 622 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL)) 623 pThis->NewOptions.usCom = 0x2e8; 624 else 625 { 626 if (fComplain) 627 Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON); 628 return (MPARAM)FALSE; 629 } 630 631 /* 632 * Loaders 633 */ 903 BOOL fComplain = (BOOL)mp1; 904 ULONG ul; 905 634 906 pThis->NewOptions.fNoLoader = WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_QUERYCHECK, NULL, NULL) != 0; 635 907 /* PE */ … … 684 956 /* REXX Scripts */ 685 957 pThis->NewOptions.fREXXScript = WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_QUERYCHECK, NULL, NULL) != 0; 958 return (MRESULT)TRUE; 959 } 960 } 961 962 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 963 } 964 965 966 /** 967 * Dialog procedure for the DL_ dialog. 968 * (See PMREF for the general specifications of this function.) 969 */ 970 MRESULT EXPENTRY LoggingDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 971 { 972 PWIN32KCC pThis; 973 974 975 /* 976 * Get instance data pointer (pThis). 977 */ 978 if (msg != WM_INITDLG) 979 { 980 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 981 if (pThis == NULL) 982 return WinDefDlgProc(hwnd, msg, mp1, mp2); 983 } 984 985 986 /* 987 * Message switch. 988 */ 989 switch (msg) 990 { 991 /* 992 * Gets data from win32k. 993 * Sets the controls according to the data from win32k. 994 * 995 * mr: reserved 996 * mp1: reserved 997 * mp2: reserved 998 */ 999 case WM_SETCONTROLS: 1000 { 1001 WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fLogging), NULL); 1002 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3f8), NULL); 1003 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2f8), NULL); 1004 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3e8), NULL); 1005 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2e8), NULL); 1006 return NULL; 1007 } 1008 1009 1010 /* 1011 * Validate data in the controls. Complains accoring to mp1. 1012 * Put the data into the win32k option struct. 1013 * 1014 * mr: Valid indicator. 1015 * TRUE: Valid data. 1016 * FALSE: Not valid data. 1017 * mp1: BOOL fComplain. 1018 * TRUE: Do complain about errors. The pThis->Options struct 1019 * is updated on successful return. 1020 * FALSE: Do not complain about errors, and don't update the 1021 * pThis->Options struct. 1022 * mp2: reserved. 1023 */ 1024 case WM_QUERYCONTROLS: 1025 { 1026 BOOL fComplain = (BOOL)mp1; 1027 1028 pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0; 1029 if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL)) 1030 pThis->NewOptions.usCom = 0x3f8; 1031 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL)) 1032 pThis->NewOptions.usCom = 0x2f8; 1033 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL)) 1034 pThis->NewOptions.usCom = 0x3e8; 1035 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL)) 1036 pThis->NewOptions.usCom = 0x2e8; 1037 else 1038 { 1039 if (fComplain) 1040 Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON); 1041 return (MPARAM)FALSE; 1042 } 1043 return (MRESULT)TRUE; 1044 } 1045 } 1046 1047 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1048 } 1049 1050 1051 /** 1052 * Dialog procedure for the DL_ dialog. 1053 * (See PMREF for the general specifications of this function.) 1054 */ 1055 MRESULT EXPENTRY StatusDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1056 { 1057 PWIN32KCC pThis; 1058 1059 /* 1060 * Get instance data pointer (pThis). 1061 */ 1062 if (msg != WM_INITDLG) 1063 { 1064 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1065 if (pThis == NULL) 1066 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1067 } 1068 1069 1070 /* 1071 * Message switch. 1072 */ 1073 switch (msg) 1074 { 1075 /* 1076 * Gets data from win32k. 1077 * Sets the controls according to the data from win32k. 1078 * 1079 * mr: reserved 1080 * mp1: reserved 1081 * mp2: reserved 1082 */ 1083 case WM_SETCONTROLS: 1084 { 1085 CHAR szBuffer[100]; 686 1086 687 1087 /* 688 * OS/2 Loader Fixes.1088 * Set the controls 689 1089 */ 690 pThis->NewOptions.fDllFixes = WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_QUERYCHECK, NULL, NULL) != 0; 691 pThis->NewOptions.fForcePreload = WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_QUERYCHECK, NULL, NULL) != 0; 692 1090 sprintf(szBuffer, "%d.%d", 0, pThis->Status.ulVersion); 1091 WinSetDlgItemText(hwnd, TX_W32K_VERSION_VAL, szBuffer); 1092 sprintf(szBuffer, "%s %s", pThis->Status.szBuildTime, pThis->Status.szBuildDate); 1093 WinSetDlgItemText(hwnd, TX_W32K_BUILD_DATETIME_VAL, szBuffer); 1094 WinSetDlgItemText(hwnd, TX_W32K_SYMBOLFILE_VAL, pThis->Status.szSymFile); 1095 sprintf(szBuffer, "%d - ", pThis->Status.ulBuild); 1096 if (GetFixpackDesc(pThis->Status.ulBuild, pThis->Status.fKernel, szBuffer + strlen(szBuffer))) 1097 sprintf(szBuffer, "%d", pThis->Status.ulBuild); 1098 WinSetDlgItemText(hwnd, TX_W32K_KERNELBUILD_VAL, szBuffer); 1099 return NULL; 1100 } 1101 } 1102 1103 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1104 } 1105 1106 /** 1107 * Dialog procedure for the DL_ dialog. 1108 * (See PMREF for the general specifications of this function.) 1109 */ 1110 MRESULT EXPENTRY HeapsDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1111 { 1112 PWIN32KCC pThis; 1113 1114 1115 /* 1116 * Get instance data pointer (pThis). 1117 */ 1118 if (msg != WM_INITDLG) 1119 { 1120 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1121 if (pThis == NULL) 1122 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1123 } 1124 1125 1126 /* 1127 * Message switch. 1128 */ 1129 switch (msg) 1130 { 1131 /* 1132 * Initialize controls. 1133 * 1134 * mr: Focus changed or not. 1135 * mp1: hwnd of dialog 1136 * mp2: (user data) (NULL) 1137 */ 1138 case WM_INITDLG: 1139 { 693 1140 /* 694 * Heaps 1141 * Initiate controls (ie. behaviour not data). 1142 * - Max length of the max heap size entry fields. 695 1143 */ 1144 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128); 1145 WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128); 1146 break; 1147 } 1148 1149 1150 /* 1151 * Gets data from win32k. 1152 * Sets the controls according to the data from win32k. 1153 * 1154 * mr: reserved 1155 * mp1: reserved 1156 * mp2: reserved 1157 */ 1158 case WM_SETCONTROLS: 1159 { 1160 CHAR szNumber[32]; 1161 1162 /* Resident */ 1163 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbResHeapMax / 1024), NULL); 1164 sprintf(szNumber, "%d", pThis->Status.cbResHeapInit / 1024); 1165 WinSetDlgItemText(hwnd, TX_HEAP_RES_INIT_VAL, szNumber); 1166 sprintf(szNumber, "%d", pThis->Status.cbResHeapSize / 1024); 1167 WinSetDlgItemText(hwnd, TX_HEAP_RES_SIZE_VAL, szNumber); 1168 sprintf(szNumber, "%d", pThis->Status.cbResHeapUsed / 1024); 1169 WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_VAL, szNumber); 1170 sprintf(szNumber, "%d", pThis->Status.cbResHeapFree / 1024); 1171 WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_VAL, szNumber); 1172 sprintf(szNumber, "%d", pThis->Status.cResBlocksUsed); 1173 WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_BLOCKS_VAL, szNumber); 1174 sprintf(szNumber, "%d", pThis->Status.cResBlocksFree); 1175 WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_BLOCKS_VAL, szNumber); 1176 /* Swappable */ 1177 WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbSwpHeapMax / 1024), NULL); 1178 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapInit / 1024); 1179 WinSetDlgItemText(hwnd, TX_HEAP_SWP_INIT_VAL, szNumber); 1180 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapSize / 1024); 1181 WinSetDlgItemText(hwnd, TX_HEAP_SWP_SIZE_VAL, szNumber); 1182 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapUsed / 1024); 1183 WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_VAL, szNumber); 1184 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapFree / 1024); 1185 WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_VAL, szNumber); 1186 sprintf(szNumber, "%d", pThis->Status.cSwpBlocksUsed); 1187 WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_BLOCKS_VAL, szNumber); 1188 sprintf(szNumber, "%d", pThis->Status.cSwpBlocksFree); 1189 WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_BLOCKS_VAL, szNumber); 1190 return NULL; 1191 } 1192 1193 1194 /* 1195 * Validate data in the controls. Complains accoring to mp1. 1196 * Put the data into the win32k option struct. 1197 * 1198 * mr: Valid indicator. 1199 * TRUE: Valid data. 1200 * FALSE: Not valid data. 1201 * mp1: BOOL fComplain. 1202 * TRUE: Do complain about errors. The pThis->Options struct 1203 * is updated on successful return. 1204 * FALSE: Do not complain about errors, and don't update the 1205 * pThis->Options struct. 1206 * mp2: reserved. 1207 */ 1208 case WM_QUERYCONTROLS: 1209 { 1210 BOOL fComplain = (BOOL)mp1; 1211 ULONG ul; 1212 696 1213 /* Resident */ 697 1214 if (!WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) … … 716 1233 } 717 1234 pThis->NewOptions.cbSwpHeapMax = ul*1024; 1235 return (MRESULT)TRUE; 1236 } 1237 } 1238 1239 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1240 } 1241 1242 1243 /** 1244 * Dialog procedure for the DL_ dialog. 1245 * (See PMREF for the general specifications of this function.) 1246 */ 1247 MRESULT EXPENTRY LdrFixDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1248 { 1249 PWIN32KCC pThis; 1250 1251 1252 /* 1253 * Get instance data pointer (pThis). 1254 */ 1255 if (msg != WM_INITDLG) 1256 { 1257 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1258 if (pThis == NULL) 1259 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1260 } 1261 1262 1263 /* 1264 * Message switch. 1265 */ 1266 switch (msg) 1267 { 1268 /* 1269 * Gets data from win32k. 1270 * Sets the controls according to the data from win32k. 1271 * 1272 * mr: reserved 1273 * mp1: reserved 1274 * mp2: reserved 1275 */ 1276 case WM_SETCONTROLS: 1277 { 1278 WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_SETCHECK, (MPARAM)(pThis->Options.fDllFixes), NULL); 1279 WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_SETCHECK, (MPARAM)(pThis->Options.fForcePreload), NULL); 1280 return NULL; 1281 } 1282 1283 1284 /* 1285 * Validate data in the controls. Complains accoring to mp1. 1286 * Put the data into the win32k option struct. 1287 * 1288 * mr: Valid indicator. 1289 * TRUE: Valid data. 1290 * FALSE: Not valid data. 1291 * mp1: BOOL fComplain. 1292 * TRUE: Do complain about errors. The pThis->Options struct 1293 * is updated on successful return. 1294 * FALSE: Do not complain about errors, and don't update the 1295 * pThis->Options struct. 1296 * mp2: reserved. 1297 */ 1298 case WM_QUERYCONTROLS: 1299 { 1300 pThis->NewOptions.fDllFixes = WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_QUERYCHECK, NULL, NULL) != 0; 1301 pThis->NewOptions.fForcePreload = WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_QUERYCHECK, NULL, NULL) != 0; 1302 pThis->NewOptions.fExeFixes = pThis->Options.fExeFixes; 1303 return (MRESULT)TRUE; 1304 } 1305 } 1306 1307 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1308 } 1309 1310 1311 /** 1312 * Dialog procedure for the DL_ dialog. 1313 * (See PMREF for the general specifications of this function.) 1314 */ 1315 MRESULT EXPENTRY MemInfoDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1316 { 1317 PWIN32KCC pThis; 1318 1319 1320 /* 1321 * Get instance data pointer (pThis). 1322 */ 1323 if (msg != WM_INITDLG) 1324 { 1325 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1326 if (pThis == NULL) 1327 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1328 } 1329 1330 1331 /* 1332 * Message switch. 1333 */ 1334 switch (msg) 1335 { 1336 /* 1337 * Start timer. 1338 * 1339 * mr: Focus changed or not. 1340 * mp1: hwnd of dialog 1341 * mp2: (user data) (pThis for notebook) 1342 */ 1343 case WM_INITDLG: 1344 { 1345 pThis = (PWIN32KCC)mp2; 1346 WinEnableWindow(WinWindowFromID(hwnd, TX_MEMINFO_PAGE_ENABLED), FALSE); 1347 pThis->idMemTimer = WinStartTimer(pThis->hab, hwnd, 42, 1000); 1348 if (!pThis->idMemTimer) 1349 Complain(hwnd, IDS_ERR_TIMER_START, WinGetLastError(pThis->hab), getLastErrorMsg(pThis->hab)); 1350 memset(&pThis->MemInfo, -1, sizeof(pThis->MemInfo)); /* Force update of everything. */ 1351 break; /* not return, break thru the ntbk page default procedure. */ 1352 } 1353 1354 1355 /* 1356 * We've started a timer for refreshing the memory data. 1357 * 1358 * mr: reserved 1359 * mp1: Id of the timer which is ticking. 1360 * mp2: reserved 1361 */ 1362 case WM_TIMER: 1363 { 1364 if ((ULONG)mp1 != pThis->idMemTimer) 1365 return NULL; 1366 1367 /* intented fallthru to WM_SETCONTROLS */ 1368 } 1369 1370 1371 /* 1372 * Save old data. 1373 * Gets system meminfo data from win32k. 1374 * Updated changed values. 1375 * Update pThis with new meminfo. 1376 * 1377 * mr: reserved 1378 * mp1: reserved 1379 * mp2: reserved 1380 */ 1381 case WM_SETCONTROLS: 1382 { 1383 K32SYSTEMMEMINFO MemInfo; 1384 K32SYSTEMMEMINFO OldMemInfo; 1385 APIRET rc; 1386 1387 OldMemInfo = pThis->MemInfo; 1388 MemInfo.cb = sizeof(MemInfo); 1389 MemInfo.flFlags = 0; 1390 rc = W32kQuerySystemMemInfo(&MemInfo); 1391 if (rc) 1392 { 1393 WinStopTimer(pThis->hab, hwnd, pThis->idMemTimer); 1394 break; 1395 } 1396 1397 if (MemInfo.cbSwapFileSize != OldMemInfo.cbSwapFileSize) 1398 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_SIZE , "%d", MemInfo.cbSwapFileSize / 1024); 1399 if (MemInfo.cbSwapFileAvail != OldMemInfo.cbSwapFileAvail) 1400 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_AVAIL , "%d", MemInfo.cbSwapFileAvail / 1024); 1401 if (MemInfo.cbSwapFileUsed != OldMemInfo.cbSwapFileUsed) 1402 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_USED , "%d", MemInfo.cbSwapFileUsed / 1024); 1403 if (MemInfo.cbSwapFileMinFree != OldMemInfo.cbSwapFileMinFree) 1404 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_MINFREE , "%d", MemInfo.cbSwapFileMinFree / 1024); 1405 if (MemInfo.cbSwapFileCFGMinFree != OldMemInfo.cbSwapFileCFGMinFree) 1406 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_CFG_MINFREE, "%d", MemInfo.cbSwapFileCFGMinFree / 1024); 1407 if (MemInfo.cbSwapFileCFGSwapSize != OldMemInfo.cbSwapFileCFGSwapSize) 1408 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_CFG_SIZE , "%d", MemInfo.cbSwapFileCFGSwapSize / 1024); 1409 if (MemInfo.cSwapFileBrokenDF != OldMemInfo.cSwapFileBrokenDF) 1410 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_BROKEN_DFS , "%d", MemInfo.cSwapFileBrokenDF); 1411 if (MemInfo.cSwapFileGrowFails != OldMemInfo.cSwapFileGrowFails) 1412 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_GROW_FAILS , "%d", MemInfo.cSwapFileGrowFails); 1413 if (MemInfo.cSwapFileInMemFile != OldMemInfo.cSwapFileInMemFile) 1414 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_DFS_IN_MEMFILE, "%d", MemInfo.cSwapFileInMemFile); 1415 1416 if (MemInfo.cbPhysSize != OldMemInfo.cbPhysSize) 1417 SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_SIZE , "%d", MemInfo.cbPhysSize / 1024); 1418 if (MemInfo.cbPhysAvail != OldMemInfo.cbPhysAvail) 1419 SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_AVAIL, "%d", MemInfo.cbPhysAvail / 1024); 1420 if (MemInfo.cbPhysUsed != OldMemInfo.cbPhysUsed) 1421 SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_USED , "%d", MemInfo.cbPhysUsed / 1024); 1422 if (MemInfo.fPagingSwapEnabled != OldMemInfo.fPagingSwapEnabled) 1423 WinSendDlgItemMsg(hwnd, TX_MEMINFO_PAGE_ENABLED, BM_SETCHECK, (MPARAM)MemInfo.fPagingSwapEnabled, NULL); 1424 if (MemInfo.cPagingPageFaults != OldMemInfo.cPagingPageFaults) 1425 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_FAULTS , "%d", MemInfo.cPagingPageFaults); 1426 if (MemInfo.cPagingPageFaultsActive != OldMemInfo.cPagingPageFaultsActive) 1427 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_FAULTS_ACTIVE, "%d", MemInfo.cPagingPageFaultsActive); 1428 if (MemInfo.cPagingPhysPages != OldMemInfo.cPagingPhysPages) 1429 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_PHYSPAGES, "%d", MemInfo.cPagingPhysPages); 1430 if (MemInfo.cPagingResidentPages != OldMemInfo.cPagingResidentPages) 1431 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_RESPAGES , "%d", MemInfo.cPagingResidentPages); 1432 if (MemInfo.cPagingSwappablePages != OldMemInfo.cPagingSwappablePages) 1433 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_SWAPPAGES, "%d", MemInfo.cPagingSwappablePages); 1434 if (MemInfo.cPagingDiscardablePages != OldMemInfo.cPagingDiscardablePages) 1435 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_DISCPAGES, "%d", MemInfo.cPagingDiscardablePages); 1436 if (MemInfo.cPagingDiscardableInmem != OldMemInfo.cPagingDiscardableInmem) 1437 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_DISCINMEM, "%d", MemInfo.cPagingDiscardableInmem); 1438 1439 if (MemInfo.ulAddressLimit != OldMemInfo.ulAddressLimit) 1440 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_ADDRESSLIMIT, "%08xh", MemInfo.ulAddressLimit); 1441 if (MemInfo.ulVMArenaSharedMin != OldMemInfo.ulVMArenaSharedMin) 1442 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_MIN , "%08xh", MemInfo.ulVMArenaSharedMin); 1443 if (MemInfo.ulVMArenaSharedMax != OldMemInfo.ulVMArenaSharedMax) 1444 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_MAX , "%08xh", MemInfo.ulVMArenaSharedMax); 1445 if (MemInfo.ulVMArenaPrivMax != OldMemInfo.ulVMArenaPrivMax) 1446 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_PRIVATE_MAX , "%08xh", MemInfo.ulVMArenaPrivMax); 1447 if (MemInfo.ulVMArenaSystemMin != OldMemInfo.ulVMArenaSystemMin) 1448 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SYSTEM_MIN , "%08xh", MemInfo.ulVMArenaSystemMin); 1449 if (MemInfo.ulVMArenaSystemMax != OldMemInfo.ulVMArenaSystemMax) 1450 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SYSTEM_MAX , "%08xh", MemInfo.ulVMArenaSystemMax); 1451 if (MemInfo.ulVMArenaHighPrivMax != OldMemInfo.ulVMArenaHighPrivMax) 1452 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_PRIVATE_HMAX, "%08xh", MemInfo.ulVMArenaHighPrivMax); 1453 if (MemInfo.ulVMArenaHighSharedMin != OldMemInfo.ulVMArenaHighSharedMin) 1454 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_HMIN , "%08xh", MemInfo.ulVMArenaHighSharedMin); 1455 if (MemInfo.ulVMArenaHighSharedMax != OldMemInfo.ulVMArenaHighSharedMax) 1456 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_HMAX , "%08xh", MemInfo.ulVMArenaHighSharedMax); 1457 1458 pThis->MemInfo = MemInfo; 1459 return NULL; 1460 } 1461 1462 /* 1463 * Cleanup. 1464 * 1465 * mr: reserved 1466 * mp1: reserved 1467 * mp2: reserved 1468 */ 1469 case WM_DESTROY: 1470 { 1471 WinStopTimer(pThis->hab, hwnd, pThis->idMemTimer); 1472 break; 1473 } 1474 1475 } 1476 1477 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1478 } 1479 1480 1481 1482 /** 1483 * Default notebook page dialog procedure. 1484 * (See PMREF for the general specifications of this function.) 1485 */ 1486 MRESULT EXPENTRY NtbkDefPageDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1487 { 1488 /* 1489 * Message switch. 1490 */ 1491 switch (msg) 1492 { 1493 /* 1494 * Sets the controls according to the data from win32k. 1495 * 1496 * mr: Focus changed or not. 1497 * mp1: hwnd of dialog 1498 * mp2: (user data) (pThis for notebook) 1499 */ 1500 case WM_INITDLG: 1501 { 1502 PWIN32KCC pThis = (PWIN32KCC)mp2; 1503 1504 if (!WinSetWindowPtr(hwnd, QWL_USER, mp2)) 1505 { 1506 /* complain, dismiss and return. */ 1507 Complain(hwnd, IDS_ERR_SET_INSTANCEDATA, 1508 WinGetLastError(pThis->hab), 1509 getLastErrorMsg(pThis->hab)); 1510 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 1511 return FALSE; 1512 } 718 1513 719 1514 /* 720 * Check if there is any change and set the fDirty flag accordingly.1515 * Install same acceltable as the notebook - Don't work. 721 1516 */ 722 pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0; 723 return (MPARAM)TRUE; 724 } 725 726 727 } 728 729 /* 730 * Return thru the default dialog procedure. 731 */ 1517 WinSetAccelTable(pThis->hab, WinQueryAccelTable(pThis->hab, pThis->hwnd), hwnd); 1518 break; 1519 } 1520 1521 1522 /* 1523 * Gets data from win32k. 1524 * Sets the controls according to the data from win32k. 1525 * 1526 * mr: reserved 1527 * mp1: reserved 1528 * mp2: reserved 1529 */ 1530 case WM_SETCONTROLS: 1531 { 1532 return NULL; 1533 } 1534 1535 1536 /* 1537 * Validate data in the controls. Complains accoring to mp1. 1538 * Put the data into the win32k option struct. 1539 * 1540 * mr: Valid indicator. 1541 * TRUE: Valid data. 1542 * FALSE: Not valid data. 1543 * mp1: BOOL fComplain. 1544 * TRUE: Do complain about errors. The pThis->Options struct 1545 * is updated on successful return. 1546 * FALSE: Do not complain about errors, and don't update the 1547 * pThis->Options struct. 1548 * mp2: reserved. 1549 */ 1550 case WM_QUERYCONTROLS: 1551 { 1552 return (MRESULT)TRUE; 1553 } 1554 1555 1556 #if 0 1557 /* 1558 * Nice little hack to get global notebook accelerators to work. 1559 * 1560 * mr: 1561 * 1562 */ 1563 case WM_TRANSLATEACCEL: 1564 { 1565 static BOOL fSem = FALSE; 1566 MRESULT mr; 1567 PWIN32KCC pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1568 if (fSem || !pThis) 1569 return FALSE; 1570 fSem = TRUE; 1571 mr = WinSendMsg(pThis->hwnd, msg, mp1, mp2); 1572 fSem = FALSE; 1573 return mr; 1574 } 1575 #endif 1576 } 1577 732 1578 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1579 } 1580 1581 /** 1582 * Spirintf version of WinSetDlgItemText. 1583 * @returns Same as WinSetDlgItemText. 1584 * @param hwndDlg Dialog Window Handle. 1585 * @param idItem Control ID. 1586 * @param pszFormat Pointer to format string. (input to sprintf) 1587 * @param .. Additional parameters. 1588 * @status completly implemented. 1589 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 1590 */ 1591 BOOL SetDlgItemTextF(HWND hwndDlg, ULONG idItem, PSZ pszFormat, ...) 1592 { 1593 BOOL fRc; 1594 char sz[64]; 1595 va_list arg; 1596 1597 #pragma info(none) 1598 va_start(arg, pszFormat); 1599 #pragma info(restore) 1600 vsprintf(sz, pszFormat, arg); 1601 va_end(arg); 1602 1603 fRc = WinSetDlgItemText(hwndDlg, idItem, sz); 1604 #ifdef DEBUG 1605 if (!fRc) 1606 Complain(hwndDlg, IDS_ERR_ASSERT, __FILE__, __LINE__, __FUNCTION__); 1607 #endif 1608 1609 return fRc; 733 1610 } 734 1611 … … 953 1830 } 954 1831 1832 #pragma info(none) 955 1833 return (char*)(*pszStr != '\0' ? (const char*)pszStr - 1 : (const char*)NULL); 1834 #pragma info(restore) 956 1835 } 957 1836
Note:
See TracChangeset
for help on using the changeset viewer.