Changeset 5145 for branches/notebook/src/win32k/utils/Win32kCC.c
- Timestamp:
- Feb 17, 2001, 9:57:51 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/notebook/src/win32k/utils/Win32kCC.c
r5144 r5145 1 /* $Id: Win32kCC.c,v 1.12.2. 2 2001-02-16 23:23:05bird Exp $1 /* $Id: Win32kCC.c,v 1.12.2.3 2001-02-17 08:57:50 bird Exp $ 2 2 * 3 3 * Win32CC - Win32k Control Center. … … 24 24 * Notebook page constants. 25 25 */ 26 #define W32CCPG_INFO 0 27 #define W32CCPG_LOADERS 1 28 #define W32CCPG_LOGGING 2 29 #define W32CCPG_STATUS 3 30 #define W32CCPG_HEAPS 4 31 #define W32CCPG_LDRFIX 5 32 #define W32CCPG_PAGES (W32CCPG_LDRFIX+1) 33 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) 34 33 35 34 … … 46 45 #define INCL_WINBUTTONS 47 46 #define INCL_WINWINDOWMGR 47 #define INCL_WINSTDBOOK 48 #define INCL_WINSYS 49 #define INCL_GPIPRIMITIVES 50 #define INCL_GPILCIDS 48 51 #define INCL_DOSMISC 52 49 53 50 54 /******************************************************************************* … … 71 75 typedef struct _Win32kCCPage 72 76 { 73 ULONG ul PageId;77 ULONG ulId; 74 78 HWND hwnd; 75 79 } WIN32KCCPAGE, *PWIN32KCCPAGE; … … 78 82 { 79 83 HWND hwnd; 84 HWND hwndNtbk; 80 85 HAB hab; 81 86 BOOL fDirty; … … 85 90 K32STATUS Status; 86 91 87 W 32CCPG_PAGES aPages[W32CCPG_PAGES];92 WIN32KCCPAGE aPages[W32KCCPG_PAGES]; /* Array containing generic page info. */ 88 93 89 94 } WIN32KCC, *PWIN32KCC; … … 98 103 * WM_QUITs. 99 104 */ 100 105 BOOL fOldNtbk; /* Set if we must use the old notebook 106 * style. 107 */ 101 108 102 109 /******************************************************************************* 103 110 * Internal Functions * 104 111 *******************************************************************************/ 105 MRESULT EXPENTRY Win32kCCDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 112 MRESULT EXPENTRY Win32kCCDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 113 114 MRESULT EXPENTRY LoadersDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 115 MRESULT EXPENTRY LoggingDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 116 MRESULT EXPENTRY StatusDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 117 MRESULT EXPENTRY HeapsDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 118 MRESULT EXPENTRY LdrFixDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 119 MRESULT EXPENTRY MemInfoDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 120 121 MRESULT EXPENTRY NtbkDefPageDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 122 123 BOOL SetDlgItemTextF(HWND hwndDlg, ULONG idItem, PSZ pszFormat, ...); 106 124 ULONG ShowMessage(HWND hwndOwner, int id, ULONG flStyle); 107 125 BOOL Complain(HWND hwndOwner, int id, ...); … … 128 146 ULONG rc = 0; 129 147 HWND hwnd; 148 ULONG aulVer[2]; 130 149 131 150 /* … … 166 185 167 186 /* 187 * Check version and set fOldNtbk accordingly. 188 */ 189 fOldNtbk = (DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, &aulVer, sizeof(aulVer)) 190 || (aulVer[1] <= 20 && aulVer[0] < 40)); 191 192 /* 168 193 * Load the dialog. 169 194 */ … … 171 196 Win32kCCDlgProc, 172 197 NULLHANDLE, 173 DL_WIN32KCC,198 fOldNtbk ? DL_WIN32KCC_OLD : DL_WIN32KCC, 174 199 NULL); 175 200 … … 212 237 #pragma info(noord) /*remove annoying (and possible incorrect) messages on the MP* macros */ 213 238 214 #if 1215 239 /** 216 240 * Dialog procedure for the DL_WIN32KCC notebook dialog. … … 220 244 { 221 245 PWIN32KCC pThis; 246 int i; 222 247 223 248 … … 247 272 case WM_INITDLG: 248 273 { 274 static struct _NtbkPage 275 { 276 PFNWP pfnDlgProc; 277 ULONG idDlg; 278 ULONG idPage; 279 } aPages[W32KCCPG_PAGES] = 280 { 281 { StatusDlgProc , PG_WIN32K_INFO_PAGE, W32KCCPG_STATUS }, 282 { LoadersDlgProc, DL_LOADERS_PAGE, W32KCCPG_LOADERS}, 283 { LoggingDlgProc, DL_LOGGING_PAGE, W32KCCPG_LOGGING}, 284 { HeapsDlgProc , DL_HEAPS_PAGE, W32KCCPG_HEAPS }, 285 { LdrFixDlgProc , DL_LDRFIX_PAGE, W32KCCPG_LDRFIX }, 286 { MemInfoDlgProc , DL_MEMINFO_PAGE, W32KCCPG_MEMINFO } 287 }; 288 CHAR szTabText[128]; 289 PDLGTEMPLATE pdlgt; 290 APIRET rc; 291 RECTL rectl; 292 SWP swp; 293 SWP swp2; 294 249 295 /* 250 296 * Init and set instance data. … … 260 306 pThis->hwnd = hwnd; 261 307 pThis->hab = WinQueryAnchorBlock(hwnd); 308 pThis->hwndNtbk = WinWindowFromID(hwnd, DL_WIN32KCC_NTBK); 262 309 if (!WinSetWindowPtr(hwnd, QWL_USER, pThis)) 263 310 { 264 311 /* complain, dismiss and return. */ 265 Complain(hwnd, IDS_ERR_SET_INSTA CEDATA,312 Complain(hwnd, IDS_ERR_SET_INSTANCEDATA, 266 313 WinGetLastError(pThis->hab), 267 314 getLastErrorMsg(pThis->hab)); … … 272 319 } 273 320 321 274 322 /* 275 323 * Insert notebooks pages. 276 324 */ 277 325 for (i = 0; i < W32KCCPG_PAGES; i++) 326 { 327 ULONG ulErrId = 0; 328 ULONG iPage = aPages[i].idPage; 329 330 rc = DosGetResource(NULLHANDLE, RT_DIALOG, aPages[i].idDlg, (PPVOID)(void*)&pdlgt); 331 if (rc) 332 { 333 Complain(hwnd, IDS_ERR_FAILED_TO_LOAD_DLGT, aPages[i].idDlg, rc); 334 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 335 WinSendMsg(hwnd, WM_DESTROY, NULL, NULL); 336 return FALSE; 337 } 338 339 pThis->aPages[iPage].hwnd = 340 (HWND)WinLoadDlg(hwnd, HWND_DESKTOP, aPages[i].pfnDlgProc, 341 NULLHANDLE, aPages[i].idDlg, pThis); 342 if (pThis->aPages[iPage].hwnd != NULLHANDLE) 343 { 344 /* 345 * Resize the notebook according to the first page. 346 * Get the size of the page we're inserting 347 * Calc notebook size according to that page. 348 * Resize the notebook controll. 349 * Resize the dialog. 350 * Recalc page rectangle. 351 */ 352 if (i == 0) 353 { 354 WinQueryWindowPos(pThis->aPages[iPage].hwnd, &swp); 355 rectl.xLeft = rectl.yBottom = 0; 356 rectl.xRight = swp.cx; 357 rectl.yTop = swp.cy; 358 WinSendMsg(pThis->hwndNtbk, BKM_CALCPAGERECT, &rectl, (MPARAM)FALSE); 359 360 WinQueryWindowPos(pThis->hwndNtbk, &swp); 361 WinSetWindowPos(pThis->hwndNtbk, NULLHANDLE, 362 0, 0, 363 rectl.xRight - rectl.xLeft, 364 rectl.yTop - rectl.yBottom, 365 SWP_SIZE); 366 367 WinQueryWindowPos(hwnd, &swp2); 368 WinSetWindowPos(hwnd, NULLHANDLE, 369 0, 0, 370 swp2.cx + (rectl.xRight - rectl.xLeft) - swp.cx, 371 swp2.cy + (rectl.yTop - rectl.yBottom) - swp.cy, 372 SWP_SIZE); 373 } 374 375 /* 376 * Insert page. 377 */ 378 pThis->aPages[iPage].ulId = 379 (ULONG)WinSendMsg(pThis->hwndNtbk, BKM_INSERTPAGE, NULL, 380 MPFROM2SHORT(BKA_MAJOR | BKA_AUTOPAGESIZE, BKA_LAST)); 381 if (pThis->aPages[iPage].ulId != 0) 382 { 383 /* 384 * Place the dialog into the page. 385 */ 386 if (WinSendMsg(pThis->hwndNtbk, BKM_SETPAGEWINDOWHWND, 387 (MPARAM)pThis->aPages[iPage].ulId, (MPARAM)pThis->aPages[iPage].hwnd)) 388 { 389 /* 390 * Set tab text - use the title of the dialog. 391 */ 392 szTabText[0] = '\0'; 393 if ( pdlgt != NULL && pdlgt->adlgti[0].cchText != 0 394 && pdlgt->adlgti[0].offText != 0xFFFF && pdlgt->adlgti[0].offText != 0) 395 strncat(szTabText, (char*)((unsigned)(pdlgt) + pdlgt->adlgti[0].offText), pdlgt->adlgti[0].cchText); 396 WinSendMsg(pThis->hwndNtbk, BKM_SETTABTEXT, (MPARAM)pThis->aPages[iPage].ulId, &szTabText[0]); 397 } 398 else 399 ulErrId = IDS_ERR_ADD_NTBK_PAGE_SET; 400 } 401 else 402 ulErrId = IDS_ERR_ADD_NTBK_PAGE_INSERT; 403 } 404 else 405 ulErrId = IDS_ERR_ADD_NTBK_PAGE_LOAD; 406 407 /* Check for error */ 408 if (ulErrId) 409 { 410 Complain(hwnd, ulErrId, aPages[i].idDlg, WinGetLastError(pThis->hab), getLastErrorMsg(pThis->hab)); 411 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 412 WinSendMsg(hwnd, WM_DESTROY, NULL, NULL); 413 return FALSE; 414 } 415 } 416 417 if (fOldNtbk) 418 { 419 POINTL ptl; 420 FONTMETRICS fm; 421 422 /* 423 * If it's an old style dialog we'll have to resize the tabs. 424 * Hackish!!! Seems like I don't do this right! 425 */ 426 for (i = 0, ptl.x = 7, ptl.y = 7; i < W32KCCPG_PAGES; i++) 427 { 428 BOOKTEXT booktxt = {&szTabText[0], sizeof(szTabText)}; 429 if (pThis->aPages[i].hwnd == NULLHANDLE) continue; 430 431 if (WinSendMsg(pThis->hwndNtbk, BKM_QUERYTABTEXT, (MPARAM)pThis->aPages[i].ulId, &booktxt)) 432 { 433 POINTL aptl[TXTBOX_COUNT]; 434 if (GpiQueryTextBox(WinGetPS(pThis->hwndNtbk), strlen(booktxt.pString)+1, booktxt.pString, TXTBOX_COUNT, aptl)) 435 { 436 if (ptl.x < abs(aptl[TXTBOX_BOTTOMRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x)) 437 ptl.x = abs(aptl[TXTBOX_BOTTOMRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x); 438 } 439 } 440 } 441 if (GpiQueryFontMetrics(WinGetPS(pThis->hwndNtbk), sizeof(fm), &fm)) 442 ptl.y = fm.lXHeight + fm.lEmHeight; 443 444 445 /* 446 * Before we resize anything, we'll have to get the size of a page. 447 * Change the tab size. This may effect the notebook page size. 448 * Recalc new notebook size using old page size. 449 * Addjust dialog window. 450 * Addjust notebook control. 451 */ 452 WinQueryWindowPos(pThis->aPages[aPages[0].idPage].hwnd, &swp); 453 454 WinSendMsg(pThis->hwndNtbk, BKM_SETDIMENSIONS, MPFROM2SHORT(ptl.x, ptl.y), (MPARAM)BKA_MAJORTAB); 455 456 rectl.xLeft = swp.x; 457 rectl.yBottom = swp.y; 458 rectl.xRight = swp.cx - swp.x; 459 rectl.yTop = swp.cy - swp.y; 460 WinSendMsg(pThis->hwndNtbk, BKM_CALCPAGERECT, &rectl, (MPARAM)FALSE); 461 WinQueryWindowPos(hwnd, &swp); 462 WinQueryWindowPos(pThis->hwndNtbk, &swp2); 463 WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, 464 swp.cx + rectl.xRight - rectl.xLeft - swp2.cx, 465 swp.cy + rectl.yTop - rectl.yBottom - swp2.cy, 466 SWP_SIZE); 467 WinSetWindowPos(pThis->hwndNtbk, NULLHANDLE, 0, 0, 468 rectl.xRight - rectl.xLeft, 469 rectl.yTop - rectl.yBottom, 470 SWP_SIZE); 471 472 /* 473 * Set Status text background color to dialog background color. 474 */ 475 WinSendMsg(pThis->hwndNtbk, BKM_SETNOTEBOOKCOLORS, 476 (MPARAM)SYSCLR_DIALOGBACKGROUND, 477 (MPARAM)BKA_BACKGROUNDPAGECOLORINDEX); 478 } 278 479 279 480 … … 495 696 { 496 697 APIRET rc; 497 CHAR szNumber[32];498 CHAR szBuffer[100];499 500 698 501 699 /* … … 517 715 518 716 /* 519 * Set the controls.717 * Update the individual pages. 520 718 */ 521 /* win32k */ 522 sprintf(szBuffer, "%d.%d", 0, pThis->Status.ulVersion); 523 WinSetDlgItemText(hwnd, TX_W32K_VERSION_VAL, szBuffer); 524 sprintf(szBuffer, "%s %s", pThis->Status.szBuildTime, pThis->Status.szBuildDate); 525 WinSetDlgItemText(hwnd, TX_W32K_BUILD_DATETIME_VAL, szBuffer); 526 WinSetDlgItemText(hwnd, TX_W32K_SYMBOLFILE_VAL, pThis->Status.szSymFile); 527 sprintf(szBuffer, "%d - ", pThis->Status.ulBuild); 528 if (GetFixpackDesc(pThis->Status.ulBuild, pThis->Status.fKernel, szBuffer + strlen(szBuffer))) 529 sprintf(szBuffer, "%d", pThis->Status.ulBuild); 530 WinSetDlgItemText(hwnd, TX_W32K_KERNELBUILD_VAL, szBuffer); 531 532 /* logging */ 533 WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fLogging), NULL); 534 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3f8), NULL); 535 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2f8), NULL); 536 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3e8), NULL); 537 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2e8), NULL); 538 539 /* loaders */ 719 for (i = 0; i < W32KCCPG_PAGES; i++) 720 { 721 if (pThis->aPages[i].hwnd != NULLHANDLE) 722 WinSendMsg(pThis->aPages[i].hwnd, msg, mp1, mp2); 723 } 724 725 /* Since all fields are update now - we can't be dirty any longer. */ 726 pThis->fDirty = FALSE; 727 return NULL; 728 } 729 730 731 /* 732 * Validate data in the controls. Complains accoring to mp1. 733 * Put the data into the win32k option struct. 734 * 735 * mr: Valid indicator. 736 * TRUE: Valid data. 737 * FALSE: Not valid data. 738 * mp1: BOOL fComplain. 739 * TRUE: Do complain about errors. The pThis->Options struct 740 * is updated on successful return. 741 * FALSE: Do not complain about errors, and don't update the 742 * pThis->Options struct. 743 * mp2: reserved. 744 */ 745 case WM_QUERYCONTROLS: 746 { 747 /* 748 * Init temporary option struct. 749 */ 750 memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS)); 751 pThis->NewOptions.cb = sizeof(K32OPTIONS); 752 753 /* 754 * Query the individual pages. 755 */ 756 for (i = 0; i < W32KCCPG_PAGES; i++) 757 { 758 if (pThis->aPages[i].hwnd != NULLHANDLE) 759 if (!WinSendMsg(pThis->aPages[i].hwnd, msg, mp1, mp2)) 760 { 761 WinSendMsg(pThis->hwndNtbk, BKM_TURNTOPAGE, (MPARAM)pThis->aPages[i].ulId, NULL); 762 return (MPARAM)FALSE; 763 } 764 } 765 766 /* 767 * Check if there is any change and set the fDirty flag accordingly. 768 */ 769 pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0; 770 return (MPARAM)TRUE; 771 } 772 } 773 774 /* 775 * Return thru the default dialog procedure. 776 */ 777 return WinDefDlgProc(hwnd, msg, mp1, mp2); 778 } 779 780 781 /** 782 * Dialog procedure for the DL_ dialog. 783 * (See PMREF for the general specifications of this function.) 784 */ 785 MRESULT EXPENTRY LoadersDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 786 { 787 PWIN32KCC pThis; 788 789 790 /* 791 * Get instance data pointer (pThis). 792 */ 793 if (msg != WM_INITDLG) 794 { 795 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 796 if (pThis == NULL) 797 return WinDefDlgProc(hwnd, msg, mp1, mp2); 798 } 799 800 801 /* 802 * Message switch. 803 */ 804 switch (msg) 805 { 806 /* 807 * Sets the controls according to the data from win32k. 808 * 809 * mr: Focus changed or not. 810 * mp1: hwnd of dialog 811 * mp2: (user data) (NULL) 812 */ 813 case WM_INITDLG: 814 { 815 pThis = (PWIN32KCC)mp2; 816 if (!WinSetWindowPtr(hwnd, QWL_USER, pThis)) 817 { 818 /* complain, dismiss and return. */ 819 Complain(hwnd, IDS_ERR_SET_INSTANCEDATA, 820 WinGetLastError(pThis->hab), 821 getLastErrorMsg(pThis->hab)); 822 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 823 return FALSE; 824 } 825 826 /* 827 * Initiate controls (ie. behaviour not data). 828 * - Ranges of the info level spinbuttons. 829 */ 830 WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0); 831 WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0); 832 break; 833 } 834 835 836 /* 837 * Gets data from win32k. 838 * Sets the controls according to the data from win32k. 839 * 840 * mr: reserved 841 * mp1: reserved 842 * mp2: reserved 843 */ 844 case WM_SETCONTROLS: 845 { 846 CHAR szNumber[32]; 847 540 848 WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_SETCHECK, (MPARAM)(pThis->Options.fNoLoader), NULL); 541 849 /* PE */ … … 559 867 /* REXX Scripts */ 560 868 WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_SETCHECK, (MPARAM)(pThis->Options.fREXXScript), NULL); 561 562 /* OS/2 Loader Fixes */ 563 WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_SETCHECK, (MPARAM)(pThis->Options.fDllFixes), NULL); 564 WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_SETCHECK, (MPARAM)(pThis->Options.fForcePreload), NULL); 565 566 /* heaps */ 869 return NULL; 870 } 871 872 873 /* 874 * Validate data in the controls. Complains accoring to mp1. 875 * Put the data into the win32k option struct. 876 * 877 * mr: Valid indicator. 878 * TRUE: Valid data. 879 * FALSE: Not valid data. 880 * mp1: BOOL fComplain. 881 * TRUE: Do complain about errors. The pThis->Options struct 882 * is updated on successful return. 883 * FALSE: Do not complain about errors, and don't update the 884 * pThis->Options struct. 885 * mp2: reserved. 886 */ 887 case WM_QUERYCONTROLS: 888 { 889 BOOL fComplain = (BOOL)mp1; 890 ULONG ul; 891 892 pThis->NewOptions.fNoLoader = WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_QUERYCHECK, NULL, NULL) != 0; 893 /* PE */ 894 if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_QUERYCHECK, NULL, NULL)) 895 pThis->NewOptions.fPE = FLAGS_PE_PE2LX; 896 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_QUERYCHECK, NULL, NULL)) 897 pThis->NewOptions.fPE = FLAGS_PE_MIXED; 898 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_QUERYCHECK, NULL, NULL)) 899 pThis->NewOptions.fPE = FLAGS_PE_PE; 900 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_QUERYCHECK, NULL, NULL)) 901 pThis->NewOptions.fPE = FLAGS_PE_NOT; 902 else 903 { 904 if (fComplain) 905 Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON); 906 return (MPARAM)FALSE; 907 } 908 pThis->NewOptions.fPEOneObject = (ULONG)WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT, BM_QUERYCHECK, NULL, NULL); 909 if (pThis->NewOptions.fPEOneObject > 2) 910 { 911 if (fComplain) 912 Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON); 913 return (MPARAM)FALSE; 914 } 915 if (!WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) 916 { 917 if (fComplain) 918 { 919 Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL); 920 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_PE_INFOLEVEL)); 921 } 922 return (MPARAM)FALSE; 923 } 924 pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */ 925 926 /* Elf */ 927 pThis->NewOptions.fElf = WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0; 928 if (!WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) 929 { 930 if (fComplain) 931 { 932 Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL); 933 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_ELF_INFOLEVEL)); 934 } 935 return (MPARAM)FALSE; 936 } 937 //pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */ 938 /* UNIX Shell Scripts */ 939 pThis->NewOptions.fUNIXScript = WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_QUERYCHECK, NULL, NULL) != 0; 940 /* JAVA */ 941 pThis->NewOptions.fJava = WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_QUERYCHECK, NULL, NULL) != 0; 942 /* REXX Scripts */ 943 pThis->NewOptions.fREXXScript = WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_QUERYCHECK, NULL, NULL) != 0; 944 return (MRESULT)TRUE; 945 } 946 } 947 948 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 949 } 950 951 952 /** 953 * Dialog procedure for the DL_ dialog. 954 * (See PMREF for the general specifications of this function.) 955 */ 956 MRESULT EXPENTRY LoggingDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 957 { 958 PWIN32KCC pThis; 959 960 961 /* 962 * Get instance data pointer (pThis). 963 */ 964 if (msg != WM_INITDLG) 965 { 966 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 967 if (pThis == NULL) 968 return WinDefDlgProc(hwnd, msg, mp1, mp2); 969 } 970 971 972 /* 973 * Message switch. 974 */ 975 switch (msg) 976 { 977 /* 978 * Gets data from win32k. 979 * Sets the controls according to the data from win32k. 980 * 981 * mr: reserved 982 * mp1: reserved 983 * mp2: reserved 984 */ 985 case WM_SETCONTROLS: 986 { 987 WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fLogging), NULL); 988 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3f8), NULL); 989 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2f8), NULL); 990 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3e8), NULL); 991 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2e8), NULL); 992 return NULL; 993 } 994 995 996 /* 997 * Validate data in the controls. Complains accoring to mp1. 998 * Put the data into the win32k option struct. 999 * 1000 * mr: Valid indicator. 1001 * TRUE: Valid data. 1002 * FALSE: Not valid data. 1003 * mp1: BOOL fComplain. 1004 * TRUE: Do complain about errors. The pThis->Options struct 1005 * is updated on successful return. 1006 * FALSE: Do not complain about errors, and don't update the 1007 * pThis->Options struct. 1008 * mp2: reserved. 1009 */ 1010 case WM_QUERYCONTROLS: 1011 { 1012 BOOL fComplain = (BOOL)mp1; 1013 1014 pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0; 1015 if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL)) 1016 pThis->NewOptions.usCom = 0x3f8; 1017 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL)) 1018 pThis->NewOptions.usCom = 0x2f8; 1019 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL)) 1020 pThis->NewOptions.usCom = 0x3e8; 1021 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL)) 1022 pThis->NewOptions.usCom = 0x2e8; 1023 else 1024 { 1025 if (fComplain) 1026 Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON); 1027 return (MPARAM)FALSE; 1028 } 1029 return (MRESULT)TRUE; 1030 } 1031 } 1032 1033 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1034 } 1035 1036 1037 /** 1038 * Dialog procedure for the DL_ dialog. 1039 * (See PMREF for the general specifications of this function.) 1040 */ 1041 MRESULT EXPENTRY StatusDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1042 { 1043 PWIN32KCC pThis; 1044 1045 /* 1046 * Get instance data pointer (pThis). 1047 */ 1048 if (msg != WM_INITDLG) 1049 { 1050 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1051 if (pThis == NULL) 1052 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1053 } 1054 1055 1056 /* 1057 * Message switch. 1058 */ 1059 switch (msg) 1060 { 1061 /* 1062 * Gets data from win32k. 1063 * Sets the controls according to the data from win32k. 1064 * 1065 * mr: reserved 1066 * mp1: reserved 1067 * mp2: reserved 1068 */ 1069 case WM_SETCONTROLS: 1070 { 1071 CHAR szBuffer[100]; 1072 1073 /* 1074 * Set the controls 1075 */ 1076 sprintf(szBuffer, "%d.%d", 0, pThis->Status.ulVersion); 1077 WinSetDlgItemText(hwnd, TX_W32K_VERSION_VAL, szBuffer); 1078 sprintf(szBuffer, "%s %s", pThis->Status.szBuildTime, pThis->Status.szBuildDate); 1079 WinSetDlgItemText(hwnd, TX_W32K_BUILD_DATETIME_VAL, szBuffer); 1080 WinSetDlgItemText(hwnd, TX_W32K_SYMBOLFILE_VAL, pThis->Status.szSymFile); 1081 sprintf(szBuffer, "%d - ", pThis->Status.ulBuild); 1082 if (GetFixpackDesc(pThis->Status.ulBuild, pThis->Status.fKernel, szBuffer + strlen(szBuffer))) 1083 sprintf(szBuffer, "%d", pThis->Status.ulBuild); 1084 WinSetDlgItemText(hwnd, TX_W32K_KERNELBUILD_VAL, szBuffer); 1085 return NULL; 1086 } 1087 } 1088 1089 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1090 } 1091 1092 /** 1093 * Dialog procedure for the DL_ dialog. 1094 * (See PMREF for the general specifications of this function.) 1095 */ 1096 MRESULT EXPENTRY HeapsDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1097 { 1098 PWIN32KCC pThis; 1099 1100 1101 /* 1102 * Get instance data pointer (pThis). 1103 */ 1104 if (msg != WM_INITDLG) 1105 { 1106 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1107 if (pThis == NULL) 1108 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1109 } 1110 1111 1112 /* 1113 * Message switch. 1114 */ 1115 switch (msg) 1116 { 1117 /* 1118 * Sets the controls according to the data from win32k. 1119 * 1120 * mr: Focus changed or not. 1121 * mp1: hwnd of dialog 1122 * mp2: (user data) (NULL) 1123 */ 1124 case WM_INITDLG: 1125 { 1126 pThis = (PWIN32KCC)mp2; 1127 if (!WinSetWindowPtr(hwnd, QWL_USER, pThis)) 1128 { 1129 /* complain, dismiss and return. */ 1130 Complain(hwnd, IDS_ERR_SET_INSTANCEDATA, 1131 WinGetLastError(pThis->hab), 1132 getLastErrorMsg(pThis->hab)); 1133 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 1134 return FALSE; 1135 } 1136 1137 /* 1138 * Initiate controls (ie. behaviour not data). 1139 * - Max length of the max heap size entry fields. 1140 */ 1141 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128); 1142 WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128); 1143 break; 1144 } 1145 1146 1147 /* 1148 * Gets data from win32k. 1149 * Sets the controls according to the data from win32k. 1150 * 1151 * mr: reserved 1152 * mp1: reserved 1153 * mp2: reserved 1154 */ 1155 case WM_SETCONTROLS: 1156 { 1157 CHAR szNumber[32]; 1158 567 1159 /* Resident */ 568 1160 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbResHeapMax / 1024), NULL); … … 593 1185 sprintf(szNumber, "%d", pThis->Status.cSwpBlocksFree); 594 1186 WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_BLOCKS_VAL, szNumber); 595 596 pThis->fDirty = FALSE;597 1187 return NULL; 598 1188 } … … 615 1205 case WM_QUERYCONTROLS: 616 1206 { 617 BOOL fComplain = (BOOL)mp1; 618 ULONG ul; 619 620 /* 621 * Init temporary option struct. 622 */ 623 memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS)); 624 pThis->NewOptions.cb = sizeof(K32OPTIONS); 625 626 /* 627 * Logging. 628 */ 629 pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0; 630 if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL)) 631 pThis->NewOptions.usCom = 0x3f8; 632 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL)) 633 pThis->NewOptions.usCom = 0x2f8; 634 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL)) 635 pThis->NewOptions.usCom = 0x3e8; 636 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL)) 637 pThis->NewOptions.usCom = 0x2e8; 638 else 639 { 640 if (fComplain) 641 Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON); 642 return (MPARAM)FALSE; 643 } 644 645 /* 646 * Loaders 647 */ 648 pThis->NewOptions.fNoLoader = WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_QUERYCHECK, NULL, NULL) != 0; 649 /* PE */ 650 if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_QUERYCHECK, NULL, NULL)) 651 pThis->NewOptions.fPE = FLAGS_PE_PE2LX; 652 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_QUERYCHECK, NULL, NULL)) 653 pThis->NewOptions.fPE = FLAGS_PE_MIXED; 654 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_QUERYCHECK, NULL, NULL)) 655 pThis->NewOptions.fPE = FLAGS_PE_PE; 656 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_QUERYCHECK, NULL, NULL)) 657 pThis->NewOptions.fPE = FLAGS_PE_NOT; 658 else 659 { 660 if (fComplain) 661 Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON); 662 return (MPARAM)FALSE; 663 } 664 pThis->NewOptions.fPEOneObject = (ULONG)WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT, BM_QUERYCHECK, NULL, NULL); 665 if (pThis->NewOptions.fPEOneObject > 2) 666 { 667 if (fComplain) 668 Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON); 669 return (MPARAM)FALSE; 670 } 671 if (!WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) 672 { 673 if (fComplain) 674 { 675 Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL); 676 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_PE_INFOLEVEL)); 677 } 678 return (MPARAM)FALSE; 679 } 680 pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */ 681 682 /* Elf */ 683 pThis->NewOptions.fElf = WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0; 684 if (!WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) 685 { 686 if (fComplain) 687 { 688 Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL); 689 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_ELF_INFOLEVEL)); 690 } 691 return (MPARAM)FALSE; 692 } 693 //pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */ 694 /* UNIX Shell Scripts */ 695 pThis->NewOptions.fUNIXScript = WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_QUERYCHECK, NULL, NULL) != 0; 696 /* JAVA */ 697 pThis->NewOptions.fJava = WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_QUERYCHECK, NULL, NULL) != 0; 698 /* REXX Scripts */ 699 pThis->NewOptions.fREXXScript = WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_QUERYCHECK, NULL, NULL) != 0; 700 701 /* 702 * OS/2 Loader Fixes. 703 */ 704 pThis->NewOptions.fDllFixes = WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_QUERYCHECK, NULL, NULL) != 0; 705 pThis->NewOptions.fForcePreload = WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_QUERYCHECK, NULL, NULL) != 0; 706 707 /* 708 * Heaps 709 */ 1207 BOOL fComplain = (BOOL)mp1; 1208 ULONG ul; 1209 710 1210 /* Resident */ 711 1211 if (!WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) … … 730 1230 } 731 1231 pThis->NewOptions.cbSwpHeapMax = ul*1024; 732 733 /* 734 * Check if there is any change and set the fDirty flag accordingly. 735 */ 736 pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0; 737 return (MPARAM)TRUE; 738 } 739 740 741 } 742 743 /* 744 * Return thru the default dialog procedure. 745 */ 746 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1232 return (MRESULT)TRUE; 1233 } 1234 } 1235 1236 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 747 1237 } 748 1238 749 1239 750 #else751 1240 /** 752 * Dialog procedure for the DL_ WIN32KCCdialog.1241 * Dialog procedure for the DL_ dialog. 753 1242 * (See PMREF for the general specifications of this function.) 754 1243 */ 755 MRESULT EXPENTRY Win32kCCDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)1244 MRESULT EXPENTRY LdrFixDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 756 1245 { 757 1246 PWIN32KCC pThis; … … 775 1264 { 776 1265 /* 777 * Sets the controls according to the data from win32k.778 *779 * mr: Focus changed or not.780 * mp1: hwnd of dialog781 * mp2: (user data) (NULL)782 */783 case WM_INITDLG:784 {785 786 /*787 * Initiate controls (ie. behaviour not data).788 * - Ranges of the info level spinbuttons.789 * - Max length of the max heap size entry fields.790 */791 WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);792 WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);793 794 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);795 WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);796 797 798 /*799 * Init and set instance data.800 */801 pThis = malloc(sizeof(*pThis));802 if (pThis == NULL)803 {804 /* complain, dismiss and return. */805 Complain(hwnd, IDS_ERR_MALLOC_FAILED, __FILE__, __LINE__, __FUNCTION__);806 WinPostMsg(hwnd, WM_QUIT, NULL, NULL);807 return FALSE;808 }809 pThis->hwnd = hwnd;810 pThis->hab = WinQueryAnchorBlock(hwnd);811 if (!WinSetWindowPtr(hwnd, QWL_USER, pThis))812 {813 /* complain, dismiss and return. */814 Complain(hwnd, IDS_ERR_SET_INSTACEDATA,815 WinGetLastError(pThis->hab),816 getLastErrorMsg(pThis->hab));817 WinDismissDlg(hwnd, 0);818 WinPostMsg(hwnd, WM_QUIT, NULL, NULL);819 free(pThis);820 return FALSE;821 }822 823 /*824 * Send a set controls message which gets data from825 * win32k and puts it into the controls.826 */827 WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);828 break;829 }830 831 832 /*833 * The user wants me to do something...834 */835 case WM_COMMAND:836 switch (SHORT1FROMMP(mp1))837 {838 /*839 * The user pushed the "Apply" button.840 */841 case PB_APPLY:842 {843 /* Check and get data from the dialog. */844 if (WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL)845 && pThis->fDirty846 )847 {848 APIRET rc;849 rc = libWin32kSetOptions(&pThis->NewOptions);850 if (rc != NO_ERROR)851 Complain(hwnd, IDS_ERR_SETPOPTIONS, rc);852 WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);853 }854 }855 break;856 857 858 /*859 * User pushed the "Refresh" button.860 */861 case PB_REFRESH:862 WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);863 break;864 865 866 /*867 * The user pushed the "Close" button.868 */869 case DID_OK:870 /* Check if data is dirty */871 if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)FALSE, NULL) || pThis->fDirty)872 {873 if (ShowMessage(hwnd, IDM_INFO_DIRTY, MB_YESNO | MB_WARNING) != MBID_YES)874 {875 fNotExit = TRUE;876 return NULL;877 }878 }879 /* Close the dialog */880 fNotExit = FALSE;881 WinDismissDlg(hwnd, 0);882 WinPostMsg(hwnd, WM_QUIT, NULL, NULL);883 break;884 885 /*886 * The use requested update of config.sys.887 */888 case PB_UPD_CONFIGSYS:889 {890 ULONG ulBootDrv;891 FILE * phConfigSys;892 char * pszConfigSys = "A:\\Config.sys";893 char szArgs[120];894 int cchArgs;895 896 if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL))897 break;898 if (DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrv, sizeof(ulBootDrv)))899 break;900 901 /*902 * Make argument list.903 */904 szArgs[0] = '\0';905 if (pThis->NewOptions.fLogging) strcat(szArgs, " -L:Y");906 if (pThis->NewOptions.usCom == 0x3f8) strcat(szArgs, " -C1");907 /*if (pThis->NewOptions.usCom != 0x2f8) strcat(szArgs, " -C2"); - default */908 if (pThis->NewOptions.usCom == 0x3e8) strcat(szArgs, " -C3");909 if (pThis->NewOptions.usCom == 0x2e8) strcat(szArgs, " -C4");910 if (pThis->NewOptions.fPE == FLAGS_PE_PE2LX)strcat(szArgs, " -P:pe2lx");911 /*if (pThis->NewOptions.fPE == FLAGS_PE_MIXED)strcat(szArgs, " -P:mixed"); - old default */912 if (pThis->NewOptions.fPE == FLAGS_PE_MIXED)strcat(szArgs, " -P:mixed");913 /* if (pThis->NewOptions.fPE == FLAGS_PE_PE) strcat(szArgs, " -P:pe"); - default */914 if (pThis->NewOptions.fPE == FLAGS_PE_NOT) strcat(szArgs, " -P:not");915 if (pThis->NewOptions.ulInfoLevel != 0) /* -W0 is default */916 sprintf(szArgs + strlen(szArgs), " -W%d", pThis->NewOptions.ulInfoLevel); /* FIXME - to be changed */917 if (pThis->NewOptions.fElf) strcat(szArgs, " -E:Y"); /* default is disabled */918 if (!pThis->NewOptions.fUNIXScript) strcat(szArgs, " -Script:N");919 if (!pThis->NewOptions.fREXXScript) strcat(szArgs, " -Rexx:N");920 if (!pThis->NewOptions.fJava) strcat(szArgs, " -Java:N");921 if (pThis->NewOptions.fNoLoader) strcat(szArgs, " -Noloader");922 if (!pThis->NewOptions.fDllFixes) strcat(szArgs, " -DllFixes:D"); /* default is enabled */923 if (!pThis->NewOptions.fForcePreload) strcat(szArgs, " -ForcePreload:Y"); /* default is disabled */924 if (pThis->NewOptions.cbSwpHeapMax != CB_SWP_MAX)925 sprintf(szArgs + strlen(szArgs), " -HeapMax:%d", pThis->NewOptions.cbSwpHeapMax); /* FIXME - to be changed */926 if (pThis->NewOptions.cbResHeapMax != CB_RES_MAX)927 sprintf(szArgs + strlen(szArgs), " -ResHeapMax:%d", pThis->NewOptions.cbResHeapMax); /* FIXME - to be changed */928 strcat(szArgs, "\n");929 cchArgs = strlen(szArgs);930 931 /*932 * Update Config.sys.933 */934 *pszConfigSys = (char)(ulBootDrv - 1 + 'A');935 phConfigSys = fopen(pszConfigSys, "r+");936 if (phConfigSys)937 {938 ULONG cbConfigSys;939 if ( fseek(phConfigSys, 0, SEEK_END) == 0940 && (cbConfigSys = ftell(phConfigSys)) > 0941 && fseek(phConfigSys, 0, SEEK_SET) == 0942 )943 {944 char * pszConfigSys;945 946 pszConfigSys = (char*)calloc(1, 2 * (cbConfigSys + 256)); /* Paranoia... */947 if (pszConfigSys)948 {949 char *pszCurrent = pszConfigSys;950 951 /* Read and modify config.sys */952 while (fgets(pszCurrent, cbConfigSys + pszCurrent - pszConfigSys, phConfigSys))953 {954 char *pszWin32k;955 /* NB! This statment will not only update the "device=" statements!956 * We'll call this a feature...957 */958 pszWin32k = stristr(pszCurrent, "win32k.sys");959 if (pszWin32k)960 {961 int cch;962 pszWin32k += 10; /* skip "win32k.sys" */963 cch = strlen(pszWin32k);964 strcpy(pszWin32k, szArgs);965 if (cchArgs < cch)966 { /* fix which stops us from shrinking the file.. */967 memset(pszWin32k + cchArgs - 1, ' ', cch - cchArgs);968 pszWin32k[cch - 1] = '\n';969 pszWin32k[cch] = '\0';970 }971 }972 973 /* next */974 pszCurrent += strlen(pszCurrent);975 }976 if (pszCurrent[-1] != '\n')977 *pszCurrent++ = '\n';978 979 /* Write it back980 * One big question, how do we shrink a file?981 */982 if ( fseek(phConfigSys, 0, SEEK_SET) == 0983 && fwrite(pszConfigSys, 1, pszCurrent - pszConfigSys, phConfigSys))984 {985 ShowMessage(hwnd, IDM_CONFIGSYS_UPDATED, MB_OK);986 }987 else988 Complain(hwnd, IDS_FWRITE_FAILED, pszConfigSys);989 free(pszConfigSys);990 }991 else992 Complain(hwnd, IDS_MALLOC_FAILED, cbConfigSys + 256);993 }994 else995 Complain(hwnd, IDS_FSIZE_FAILED, pszConfigSys);996 fclose(phConfigSys);997 }998 else999 Complain(hwnd, IDS_ERR_FOPEN_FAILED, pszConfigSys);1000 break;1001 }1002 }1003 return NULL;1004 1005 1006 /*1007 * Close window. Typically sent when Alt-F4 pressed or system-menu-Close is selected.1008 */1009 case WM_CLOSE:1010 fNotExit = TRUE;1011 WinSendMsg(hwnd, WM_COMMAND,1012 MPFROMSHORT(DID_OK), MPFROM2SHORT(CMDSRC_MENU, FALSE));1013 break;1014 1015 1016 /*1017 * Window is destroyed (last message which ever should reach us!)1018 * -Free instance data1019 * -Set the instance data pointer to NULL (just in case).1020 */1021 case WM_DESTROY:1022 {1023 free(pThis);1024 WinSetWindowPtr(hwnd, QWL_USER, NULL);1025 break;1026 }1027 1028 1029 /*1030 1266 * Gets data from win32k. 1031 1267 * Sets the controls according to the data from win32k. … … 1037 1273 case WM_SETCONTROLS: 1038 1274 { 1039 APIRET rc;1040 CHAR szNumber[32];1041 CHAR szBuffer[100];1042 1043 1044 /*1045 * Call Win32k.sys to get options and statuses.1046 */1047 memset(&pThis->Options, 0, sizeof(K32OPTIONS));1048 pThis->Options.cb = sizeof(K32OPTIONS);1049 memset(&pThis->Status, 0, sizeof(K32STATUS));1050 pThis->Status.cb = sizeof(K32STATUS);1051 rc = libWin32kQueryOptionsStatus(&pThis->Options, &pThis->Status);1052 if (rc != NO_ERROR)1053 {1054 Complain(hwnd, IDS_ERR_QUERYOPTIONSTATUS, rc);1055 fNotExit = FALSE;1056 WinDismissDlg(hwnd, 0);1057 WinPostMsg(hwnd, WM_QUIT, NULL, NULL);1058 return NULL;1059 }1060 1061 /*1062 * Set the controls.1063 */1064 /* win32k */1065 sprintf(szBuffer, "%d.%d", 0, pThis->Status.ulVersion);1066 WinSetDlgItemText(hwnd, TX_W32K_VERSION_VAL, szBuffer);1067 sprintf(szBuffer, "%s %s", pThis->Status.szBuildTime, pThis->Status.szBuildDate);1068 WinSetDlgItemText(hwnd, TX_W32K_BUILD_DATETIME_VAL, szBuffer);1069 WinSetDlgItemText(hwnd, TX_W32K_SYMBOLFILE_VAL, pThis->Status.szSymFile);1070 sprintf(szBuffer, "%d - ", pThis->Status.ulBuild);1071 if (GetFixpackDesc(pThis->Status.ulBuild, pThis->Status.fKernel, szBuffer + strlen(szBuffer)))1072 sprintf(szBuffer, "%d", pThis->Status.ulBuild);1073 WinSetDlgItemText(hwnd, TX_W32K_KERNELBUILD_VAL, szBuffer);1074 1075 /* logging */1076 WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fLogging), NULL);1077 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3f8), NULL);1078 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2f8), NULL);1079 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3e8), NULL);1080 WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2e8), NULL);1081 1082 /* loaders */1083 WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_SETCHECK, (MPARAM)(pThis->Options.fNoLoader), NULL);1084 /* PE */1085 WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE2LX), NULL);1086 WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_MIXED), NULL);1087 WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE), NULL);1088 WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_NOT), NULL);1089 WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT, BM_SETCHECK, (MPARAM)(pThis->Options.fPEOneObject), NULL);1090 WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel), NULL); /* FIXME to be changed */1091 sprintf(szNumber, "%d", pThis->Status.cPe2LxModules);1092 WinSetDlgItemText(hwnd, TX_LDR_PE_MODULES_VAL, szNumber);1093 /* Elf */1094 WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fElf), NULL);1095 WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel), NULL); /* FIXME to be changed */1096 sprintf(szNumber, "%d", pThis->Status.cElf2LxModules);1097 WinSetDlgItemText(hwnd, TX_LDR_ELF_MODULES_VAL, szNumber);1098 /* UNIX Shell Scripts */1099 WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_SETCHECK, (MPARAM)(pThis->Options.fUNIXScript), NULL);1100 /* JAVA */1101 WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_SETCHECK, (MPARAM)(pThis->Options.fJava), NULL);1102 /* REXX Scripts */1103 WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_SETCHECK, (MPARAM)(pThis->Options.fREXXScript), NULL);1104 1105 /* OS/2 Loader Fixes */1106 1275 WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_SETCHECK, (MPARAM)(pThis->Options.fDllFixes), NULL); 1107 1276 WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_SETCHECK, (MPARAM)(pThis->Options.fForcePreload), NULL); 1108 1109 /* heaps */1110 /* Resident */1111 WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbResHeapMax / 1024), NULL);1112 sprintf(szNumber, "%d", pThis->Status.cbResHeapInit / 1024);1113 WinSetDlgItemText(hwnd, TX_HEAP_RES_INIT_VAL, szNumber);1114 sprintf(szNumber, "%d", pThis->Status.cbResHeapSize / 1024);1115 WinSetDlgItemText(hwnd, TX_HEAP_RES_SIZE_VAL, szNumber);1116 sprintf(szNumber, "%d", pThis->Status.cbResHeapUsed / 1024);1117 WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_VAL, szNumber);1118 sprintf(szNumber, "%d", pThis->Status.cbResHeapFree / 1024);1119 WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_VAL, szNumber);1120 sprintf(szNumber, "%d", pThis->Status.cResBlocksUsed);1121 WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_BLOCKS_VAL, szNumber);1122 sprintf(szNumber, "%d", pThis->Status.cResBlocksFree);1123 WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_BLOCKS_VAL, szNumber);1124 /* Swappable */1125 WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbSwpHeapMax / 1024), NULL);1126 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapInit / 1024);1127 WinSetDlgItemText(hwnd, TX_HEAP_SWP_INIT_VAL, szNumber);1128 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapSize / 1024);1129 WinSetDlgItemText(hwnd, TX_HEAP_SWP_SIZE_VAL, szNumber);1130 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapUsed / 1024);1131 WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_VAL, szNumber);1132 sprintf(szNumber, "%d", pThis->Status.cbSwpHeapFree / 1024);1133 WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_VAL, szNumber);1134 sprintf(szNumber, "%d", pThis->Status.cSwpBlocksUsed);1135 WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_BLOCKS_VAL, szNumber);1136 sprintf(szNumber, "%d", pThis->Status.cSwpBlocksFree);1137 WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_BLOCKS_VAL, szNumber);1138 1139 pThis->fDirty = FALSE;1140 1277 return NULL; 1141 1278 } … … 1158 1295 case WM_QUERYCONTROLS: 1159 1296 { 1160 BOOL fComplain = (BOOL)mp1;1161 ULONG ul;1162 1163 /*1164 * Init temporary option struct.1165 */1166 memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS));1167 pThis->NewOptions.cb = sizeof(K32OPTIONS);1168 1169 /*1170 * Logging.1171 */1172 pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;1173 if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL))1174 pThis->NewOptions.usCom = 0x3f8;1175 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL))1176 pThis->NewOptions.usCom = 0x2f8;1177 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL))1178 pThis->NewOptions.usCom = 0x3e8;1179 else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL))1180 pThis->NewOptions.usCom = 0x2e8;1181 else1182 {1183 if (fComplain)1184 Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON);1185 return (MPARAM)FALSE;1186 }1187 1188 /*1189 * Loaders1190 */1191 pThis->NewOptions.fNoLoader = WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_QUERYCHECK, NULL, NULL) != 0;1192 /* PE */1193 if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_QUERYCHECK, NULL, NULL))1194 pThis->NewOptions.fPE = FLAGS_PE_PE2LX;1195 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_QUERYCHECK, NULL, NULL))1196 pThis->NewOptions.fPE = FLAGS_PE_MIXED;1197 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_QUERYCHECK, NULL, NULL))1198 pThis->NewOptions.fPE = FLAGS_PE_PE;1199 else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_QUERYCHECK, NULL, NULL))1200 pThis->NewOptions.fPE = FLAGS_PE_NOT;1201 else1202 {1203 if (fComplain)1204 Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON);1205 return (MPARAM)FALSE;1206 }1207 pThis->NewOptions.fPEOneObject = (ULONG)WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT, BM_QUERYCHECK, NULL, NULL);1208 if (pThis->NewOptions.fPEOneObject > 2)1209 {1210 if (fComplain)1211 Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON);1212 return (MPARAM)FALSE;1213 }1214 if (!WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))1215 {1216 if (fComplain)1217 {1218 Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);1219 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_PE_INFOLEVEL));1220 }1221 return (MPARAM)FALSE;1222 }1223 pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */1224 1225 /* Elf */1226 pThis->NewOptions.fElf = WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;1227 if (!WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))1228 {1229 if (fComplain)1230 {1231 Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);1232 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_ELF_INFOLEVEL));1233 }1234 return (MPARAM)FALSE;1235 }1236 //pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */1237 /* UNIX Shell Scripts */1238 pThis->NewOptions.fUNIXScript = WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_QUERYCHECK, NULL, NULL) != 0;1239 /* JAVA */1240 pThis->NewOptions.fJava = WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_QUERYCHECK, NULL, NULL) != 0;1241 /* REXX Scripts */1242 pThis->NewOptions.fREXXScript = WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_QUERYCHECK, NULL, NULL) != 0;1243 1244 /*1245 * OS/2 Loader Fixes.1246 */1247 1297 pThis->NewOptions.fDllFixes = WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_QUERYCHECK, NULL, NULL) != 0; 1248 1298 pThis->NewOptions.fForcePreload = WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_QUERYCHECK, NULL, NULL) != 0; 1249 1250 /* 1251 * Heaps 1252 */ 1253 /* Resident */ 1254 if (!WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) 1255 { 1256 if (fComplain) 1257 { 1258 Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE); 1259 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_RES_MAX)); 1260 } 1261 return (MPARAM)FALSE; 1262 } 1263 pThis->NewOptions.cbResHeapMax = ul*1024; 1264 /* Swappable */ 1265 if (!WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID))) 1266 { 1267 if (fComplain) 1268 { 1269 Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE); 1270 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_SWP_MAX)); 1271 } 1272 return (MPARAM)FALSE; 1273 } 1274 pThis->NewOptions.cbSwpHeapMax = ul*1024; 1275 1276 /* 1277 * Check if there is any change and set the fDirty flag accordingly. 1278 */ 1279 pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0; 1280 return (MPARAM)TRUE; 1281 } 1282 1283 1284 } 1285 1286 /* 1287 * Return thru the default dialog procedure. 1288 */ 1299 return (MRESULT)TRUE; 1300 } 1301 } 1302 1303 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1304 } 1305 1306 1307 /** 1308 * Dialog procedure for the DL_ dialog. 1309 * (See PMREF for the general specifications of this function.) 1310 */ 1311 MRESULT EXPENTRY MemInfoDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1312 { 1313 PWIN32KCC pThis; 1314 1315 1316 /* 1317 * Get instance data pointer (pThis). 1318 */ 1319 if (msg != WM_INITDLG) 1320 { 1321 pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER); 1322 if (pThis == NULL) 1323 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1324 } 1325 1326 1327 /* 1328 * Message switch. 1329 */ 1330 switch (msg) 1331 { 1332 /* 1333 * Sets the controls according to the data from win32k. 1334 * 1335 * mr: Focus changed or not. 1336 * mp1: hwnd of dialog 1337 * mp2: (user data) (pThis for notebook) 1338 */ 1339 case WM_INITDLG: 1340 { 1341 WinEnableWindow(WinWindowFromID(hwnd, TX_MEMINFO_PAGE_ENABLED), FALSE); 1342 break; /* break, not return thru ntbk page default procedure. */ 1343 } 1344 1345 1346 /* 1347 * Gets data from win32k. 1348 * Sets the controls according to the data from win32k. 1349 * 1350 * mr: reserved 1351 * mp1: reserved 1352 * mp2: reserved 1353 */ 1354 case WM_SETCONTROLS: 1355 { 1356 K32SYSTEMMEMINFO MemInfo; 1357 APIRET rc; 1358 1359 MemInfo.cb = sizeof(MemInfo); 1360 MemInfo.flFlags = 0; 1361 rc = W32kQuerySystemMemInfo(&MemInfo); 1362 if (rc) 1363 { 1364 break; 1365 } 1366 1367 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_SIZE , "%d", MemInfo.cbSwapFileSize / 1024); 1368 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_AVAIL , "%d", MemInfo.cbSwapFileAvail / 1024); 1369 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_USED , "%d", MemInfo.cbSwapFileUsed / 1024); 1370 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_MINFREE , "%d", MemInfo.cbSwapFileMinFree / 1024); 1371 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_CFG_MINFREE, "%d", MemInfo.cbSwapFileCFGMinFree / 1024); 1372 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_CFG_SIZE , "%d", MemInfo.cbSwapFileCFGSwapSize / 1024); 1373 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_BROKEN_DFS , "%d", MemInfo.cSwapFileBrokenDF); 1374 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_GROW_FAILS , "%d", MemInfo.cSwapFileGrowFails); 1375 SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_DFS_IN_MEMFILE, "%d", MemInfo.cSwapFileInMemFile); 1376 1377 SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_SIZE , "%d", MemInfo.cbPhysSize); 1378 SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_AVAIL, "%d", MemInfo.cbPhysAvail); 1379 SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_USED , "%d", MemInfo.cbPhysUsed); 1380 WinSendDlgItemMsg(hwnd, TX_MEMINFO_PAGE_ENABLED, BM_SETCHECK, (MPARAM)MemInfo.fPagingSwapEnabled, NULL); 1381 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_FAULTS , "%d", MemInfo.cPagingPageFaults); 1382 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_FAULTS_ACTIVE, "%d", MemInfo.cPagingPageFaultsActive); 1383 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_PHYSPAGES, "%d", MemInfo.cPagingPhysPages); 1384 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_RESPAGES , "%d", MemInfo.cPagingResidentPages); 1385 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_SWAPPAGES, "%d", MemInfo.cPagingSwappablePages); 1386 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_DISCPAGES, "%d", MemInfo.cPagingDiscardablePages); 1387 SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_DISCINMEM, "%d", MemInfo.cPagingDiscardableInmem); 1388 1389 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_ADDRESSLIMIT, "%08xh", MemInfo.ulAddressLimit); 1390 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_MIN , "%08xh", MemInfo.ulVMArenaSharedMin); 1391 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_MAX , "%08xh", MemInfo.ulVMArenaSharedMax); 1392 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_PRIVATE_MAX , "%08xh", MemInfo.ulVMArenaPrivMax); 1393 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SYSTEM_MIN , "%08xh", MemInfo.ulVMArenaSystemMin); 1394 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SYSTEM_MAX , "%08xh", MemInfo.ulVMArenaSystemMax); 1395 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_PRIVATE_HMAX, "%08xh", MemInfo.ulVMArenaHighPrivMax); 1396 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_HMIN , "%08xh", MemInfo.ulVMArenaHighSharedMin); 1397 SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_HMAX , "%08xh", MemInfo.ulVMArenaHighSharedMax); 1398 1399 return NULL; 1400 } 1401 } 1402 1403 return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2); 1404 } 1405 1406 1407 1408 /** 1409 * Default notebook page dialog procedure. 1410 * (See PMREF for the general specifications of this function.) 1411 */ 1412 MRESULT EXPENTRY NtbkDefPageDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 1413 { 1414 /* 1415 * Message switch. 1416 */ 1417 switch (msg) 1418 { 1419 /* 1420 * Sets the controls according to the data from win32k. 1421 * 1422 * mr: Focus changed or not. 1423 * mp1: hwnd of dialog 1424 * mp2: (user data) (pThis for notebook) 1425 */ 1426 case WM_INITDLG: 1427 { 1428 PWIN32KCC pThis = (PWIN32KCC)mp2; 1429 1430 if (!WinSetWindowPtr(hwnd, QWL_USER, mp2)) 1431 { 1432 /* complain, dismiss and return. */ 1433 Complain(hwnd, IDS_ERR_SET_INSTANCEDATA, 1434 WinGetLastError(pThis->hab), 1435 getLastErrorMsg(pThis->hab)); 1436 WinPostMsg(hwnd, WM_QUIT, NULL, NULL); 1437 return FALSE; 1438 } 1439 break; 1440 } 1441 1442 1443 /* 1444 * Gets data from win32k. 1445 * Sets the controls according to the data from win32k. 1446 * 1447 * mr: reserved 1448 * mp1: reserved 1449 * mp2: reserved 1450 */ 1451 case WM_SETCONTROLS: 1452 { 1453 return NULL; 1454 } 1455 1456 1457 /* 1458 * Validate data in the controls. Complains accoring to mp1. 1459 * Put the data into the win32k option struct. 1460 * 1461 * mr: Valid indicator. 1462 * TRUE: Valid data. 1463 * FALSE: Not valid data. 1464 * mp1: BOOL fComplain. 1465 * TRUE: Do complain about errors. The pThis->Options struct 1466 * is updated on successful return. 1467 * FALSE: Do not complain about errors, and don't update the 1468 * pThis->Options struct. 1469 * mp2: reserved. 1470 */ 1471 case WM_QUERYCONTROLS: 1472 { 1473 return (MRESULT)TRUE; 1474 } 1475 } 1476 1289 1477 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1290 1478 } 1291 #endif 1479 1480 /** 1481 * Spirintf version of WinSetDlgItemText. 1482 * @returns Same as WinSetDlgItemText. 1483 * @param hwndDlg Dialog Window Handle. 1484 * @param idItem Control ID. 1485 * @param pszFormat Pointer to format string. (input to sprintf) 1486 * @param .. Additional parameters. 1487 * @status completly implemented. 1488 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 1489 */ 1490 BOOL SetDlgItemTextF(HWND hwndDlg, ULONG idItem, PSZ pszFormat, ...) 1491 { 1492 BOOL fRc; 1493 char sz[64]; 1494 va_list arg; 1495 1496 #pragma info(none) 1497 va_start(arg, pszFormat); 1498 #pragma info(restore) 1499 vsprintf(sz, pszFormat, arg); 1500 va_end(arg); 1501 1502 fRc = WinSetDlgItemText(hwndDlg, idItem, sz); 1503 #ifdef DEBUG 1504 if (!fRc) 1505 Complain(hwndDlg, IDS_ERR_ASSERT, __FILE__, __LINE__, __FUNCTION__); 1506 #endif 1507 1508 return fRc; 1509 } 1292 1510 1293 1511
Note:
See TracChangeset
for help on using the changeset viewer.