Ignore:
Timestamp:
Feb 17, 2001, 12:20:30 AM (25 years ago)
Author:
bird
Message:

Temporary checkin - not even compiling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/notebook/src/win32k/utils/Win32kCC.c

    r5119 r5143  
    1 /* $Id: Win32kCC.c,v 1.12 2001-02-11 23:41:46 bird Exp $
     1/* $Id: Win32kCC.c,v 1.12.2.1 2001-02-16 23:20:29 bird Exp $
    22 *
    33 * Win32CC - Win32k Control Center.
     
    1919#define  WM_SETCONTROLS         (WM_USER + 10)
    2020#define  WM_QUERYCONTROLS       (WM_USER + 11)
     21
     22
     23/*
     24 * Notebook page constants.
     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
    2134
    2235
     
    5366
    5467
    55 
    5668/*******************************************************************************
    5769*   Structures and Typedefs                                                    *
    5870*******************************************************************************/
    59 typedef struct _WIN32KCC
     71typedef struct _Win32kCCPage
     72{
     73    ULONG   ulPage;
     74    HWND    hwnd;
     75} WIN32KCCPAGE, *PWIN32KCCPAGE;
     76
     77typedef struct _Win32kCC
    6078{
    6179    HWND    hwnd;
     
    6684    K32OPTIONS NewOptions;
    6785    K32STATUS  Status;
     86
     87    W32CCPG_PAGES   aPages[W32CCPG_PAGES];
    6888
    6989} WIN32KCC, *PWIN32KCC;
     
    192212#pragma info(noord) /*remove annoying (and possible incorrect) messages on the MP* macros */
    193213
     214#if 1
    194215/**
    195  * Dialog procedure for the DL_WIN32KCC dialog.
     216 * Dialog procedure for the DL_WIN32KCC notebook dialog.
    196217 * (See PMREF for the general specifications of this function.)
    197218 */
     
    734755
    735756
     757#else
     758/**
     759 * Dialog procedure for the DL_WIN32KCC dialog.
     760 * (See PMREF for the general specifications of this function.)
     761 */
     762MRESULT EXPENTRY Win32kCCDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     763{
     764    PWIN32KCC   pThis;
     765
     766
     767    /*
     768     * Get instance data pointer (pThis).
     769     */
     770    if (msg != WM_INITDLG)
     771    {
     772        pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
     773        if (pThis == NULL)
     774            return WinDefDlgProc(hwnd, msg, mp1, mp2);
     775    }
     776
     777
     778    /*
     779     * Message switch.
     780     */
     781    switch (msg)
     782    {
     783        /*
     784         * Sets the controls according to the data from win32k.
     785         *
     786         * mr:  Focus changed or not.
     787         * mp1: hwnd of dialog
     788         * mp2: (user data) (NULL)
     789         */
     790        case WM_INITDLG:
     791        {
     792
     793            /*
     794             * Initiate controls (ie. behaviour not data).
     795             *  - Ranges of the info level spinbuttons.
     796             *  - Max length of the max heap size entry fields.
     797             */
     798            WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);
     799            WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);
     800
     801            WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);
     802            WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);
     803
     804
     805            /*
     806             * Init and set instance data.
     807             */
     808            pThis = malloc(sizeof(*pThis));
     809            if (pThis == NULL)
     810            {
     811                /* complain, dismiss and return. */
     812                Complain(hwnd, IDS_ERR_MALLOC_FAILED, __FILE__, __LINE__, __FUNCTION__);
     813                WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
     814                return FALSE;
     815            }
     816            pThis->hwnd = hwnd;
     817            pThis->hab = WinQueryAnchorBlock(hwnd);
     818            if (!WinSetWindowPtr(hwnd, QWL_USER, pThis))
     819            {
     820                /* complain, dismiss and return. */
     821                Complain(hwnd, IDS_ERR_SET_INSTACEDATA,
     822                         WinGetLastError(pThis->hab),
     823                         getLastErrorMsg(pThis->hab));
     824                WinDismissDlg(hwnd, 0);
     825                WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
     826                free(pThis);
     827                return FALSE;
     828            }
     829
     830            /*
     831             * Send a set controls message which gets data from
     832             * win32k and puts it into the controls.
     833             */
     834            WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
     835            break;
     836        }
     837
     838
     839        /*
     840         * The user wants me to do something...
     841         */
     842        case WM_COMMAND:
     843            switch (SHORT1FROMMP(mp1))
     844            {
     845                /*
     846                 * The user pushed the "Apply" button.
     847                 */
     848                case PB_APPLY:
     849                {
     850                    /* Check and get data from the dialog. */
     851                    if (WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL)
     852                        && pThis->fDirty
     853                        )
     854                    {
     855                        APIRET rc;
     856                        rc = libWin32kSetOptions(&pThis->NewOptions);
     857                        if (rc != NO_ERROR)
     858                            Complain(hwnd, IDS_ERR_SETPOPTIONS, rc);
     859                        WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
     860                    }
     861                }
     862                break;
     863
     864
     865                /*
     866                 * User pushed the "Refresh" button.
     867                 */
     868                case PB_REFRESH:
     869                    WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
     870                break;
     871
     872
     873                /*
     874                 * The user pushed the "Close" button.
     875                 */
     876                case DID_OK:
     877                    /* Check if data is dirty */
     878                    if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)FALSE, NULL) || pThis->fDirty)
     879                    {
     880                        if (ShowMessage(hwnd, IDM_INFO_DIRTY, MB_YESNO | MB_WARNING) != MBID_YES)
     881                        {
     882                            fNotExit = TRUE;
     883                            return NULL;
     884                        }
     885                    }
     886                    /* Close the dialog */
     887                    fNotExit = FALSE;
     888                    WinDismissDlg(hwnd, 0);
     889                    WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
     890                    break;
     891
     892                /*
     893                 * The use requested update of config.sys.
     894                 */
     895                case PB_UPD_CONFIGSYS:
     896                {
     897                    ULONG   ulBootDrv;
     898                    FILE *  phConfigSys;
     899                    char *  pszConfigSys = "A:\\Config.sys";
     900                    char    szArgs[120];
     901                    int     cchArgs;
     902
     903                    if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL))
     904                        break;
     905                    if (DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrv, sizeof(ulBootDrv)))
     906                        break;
     907
     908                    /*
     909                     * Make argument list.
     910                     */
     911                    szArgs[0] = '\0';
     912                    if (pThis->NewOptions.fLogging)             strcat(szArgs, " -L:Y");
     913                    if (pThis->NewOptions.usCom == 0x3f8)       strcat(szArgs, " -C1");
     914                    /*if (pThis->NewOptions.usCom != 0x2f8)       strcat(szArgs, " -C2"); - default */
     915                    if (pThis->NewOptions.usCom == 0x3e8)       strcat(szArgs, " -C3");
     916                    if (pThis->NewOptions.usCom == 0x2e8)       strcat(szArgs, " -C4");
     917                    if (pThis->NewOptions.fPE == FLAGS_PE_PE2LX)strcat(szArgs, " -P:pe2lx");
     918                    /*if (pThis->NewOptions.fPE == FLAGS_PE_MIXED)strcat(szArgs, " -P:mixed"); - old default */
     919                    if (pThis->NewOptions.fPE == FLAGS_PE_MIXED)strcat(szArgs, " -P:mixed");
     920                    /* if (pThis->NewOptions.fPE == FLAGS_PE_PE)   strcat(szArgs, " -P:pe"); - default */
     921                    if (pThis->NewOptions.fPE == FLAGS_PE_NOT)  strcat(szArgs, " -P:not");
     922                    if (pThis->NewOptions.ulInfoLevel != 0) /* -W0 is default */
     923                        sprintf(szArgs + strlen(szArgs), " -W%d", pThis->NewOptions.ulInfoLevel); /* FIXME - to be changed */
     924                    if (pThis->NewOptions.fElf)                 strcat(szArgs, " -E:Y"); /* default is disabled */
     925                    if (!pThis->NewOptions.fUNIXScript)         strcat(szArgs, " -Script:N");
     926                    if (!pThis->NewOptions.fREXXScript)         strcat(szArgs, " -Rexx:N");
     927                    if (!pThis->NewOptions.fJava)               strcat(szArgs, " -Java:N");
     928                    if (pThis->NewOptions.fNoLoader)            strcat(szArgs, " -Noloader");
     929                    if (!pThis->NewOptions.fDllFixes)           strcat(szArgs, " -DllFixes:D"); /* default is enabled */
     930                    if (!pThis->NewOptions.fForcePreload)       strcat(szArgs, " -ForcePreload:Y"); /* default is disabled */
     931                    if (pThis->NewOptions.cbSwpHeapMax != CB_SWP_MAX)
     932                        sprintf(szArgs + strlen(szArgs), " -HeapMax:%d", pThis->NewOptions.cbSwpHeapMax); /* FIXME - to be changed */
     933                    if (pThis->NewOptions.cbResHeapMax != CB_RES_MAX)
     934                        sprintf(szArgs + strlen(szArgs), " -ResHeapMax:%d", pThis->NewOptions.cbResHeapMax); /* FIXME - to be changed */
     935                    strcat(szArgs, "\n");
     936                    cchArgs = strlen(szArgs);
     937
     938                    /*
     939                     * Update Config.sys.
     940                     */
     941                    *pszConfigSys = (char)(ulBootDrv - 1 + 'A');
     942                    phConfigSys = fopen(pszConfigSys, "r+");
     943                    if (phConfigSys)
     944                    {
     945                        ULONG   cbConfigSys;
     946                        if (    fseek(phConfigSys, 0, SEEK_END) == 0
     947                            &&  (cbConfigSys = ftell(phConfigSys)) > 0
     948                            &&  fseek(phConfigSys, 0, SEEK_SET) == 0
     949                            )
     950                        {
     951                            char *  pszConfigSys;
     952
     953                            pszConfigSys = (char*)calloc(1, 2 * (cbConfigSys + 256)); /* Paranoia... */
     954                            if (pszConfigSys)
     955                            {
     956                                char *pszCurrent = pszConfigSys;
     957
     958                                /* Read and modify config.sys */
     959                                while (fgets(pszCurrent, cbConfigSys + pszCurrent - pszConfigSys, phConfigSys))
     960                                {
     961                                    char *pszWin32k;
     962                                    /* NB! This statment will not only update the "device=" statements!
     963                                     * We'll call this a feature...
     964                                     */
     965                                    pszWin32k = stristr(pszCurrent, "win32k.sys");
     966                                    if (pszWin32k)
     967                                    {
     968                                        int cch;
     969                                        pszWin32k += 10;  /* skip "win32k.sys" */
     970                                        cch = strlen(pszWin32k);
     971                                        strcpy(pszWin32k, szArgs);
     972                                        if (cchArgs < cch)
     973                                        { /* fix which stops us from shrinking the file.. */
     974                                            memset(pszWin32k + cchArgs - 1, ' ', cch - cchArgs);
     975                                            pszWin32k[cch - 1] = '\n';
     976                                            pszWin32k[cch]     = '\0';
     977                                        }
     978                                    }
     979
     980                                    /* next */
     981                                    pszCurrent += strlen(pszCurrent);
     982                                }
     983                                if (pszCurrent[-1] != '\n')
     984                                    *pszCurrent++ = '\n';
     985
     986                                /* Write it back
     987                                 * One big question, how do we shrink a file?
     988                                 */
     989                                if (    fseek(phConfigSys, 0, SEEK_SET) == 0
     990                                    &&  fwrite(pszConfigSys, 1, pszCurrent - pszConfigSys, phConfigSys))
     991                                {
     992                                    ShowMessage(hwnd, IDM_CONFIGSYS_UPDATED, MB_OK);
     993                                }
     994                                else
     995                                    Complain(hwnd, IDS_FWRITE_FAILED, pszConfigSys);
     996                                free(pszConfigSys);
     997                            }
     998                            else
     999                                Complain(hwnd, IDS_MALLOC_FAILED, cbConfigSys + 256);
     1000                        }
     1001                        else
     1002                            Complain(hwnd, IDS_FSIZE_FAILED, pszConfigSys);
     1003                        fclose(phConfigSys);
     1004                    }
     1005                    else
     1006                        Complain(hwnd, IDS_ERR_FOPEN_FAILED, pszConfigSys);
     1007                    break;
     1008                }
     1009            }
     1010            return NULL;
     1011
     1012
     1013        /*
     1014         * Close window. Typically sent when Alt-F4 pressed or system-menu-Close is selected.
     1015         */
     1016        case WM_CLOSE:
     1017            fNotExit = TRUE;
     1018            WinSendMsg(hwnd, WM_COMMAND,
     1019                       MPFROMSHORT(DID_OK), MPFROM2SHORT(CMDSRC_MENU, FALSE));
     1020            break;
     1021
     1022
     1023        /*
     1024         * Window is destroyed (last message which ever should reach us!)
     1025         *  -Free instance data
     1026         *  -Set the instance data pointer to NULL (just in case).
     1027         */
     1028        case WM_DESTROY:
     1029        {
     1030            free(pThis);
     1031            WinSetWindowPtr(hwnd, QWL_USER, NULL);
     1032            break;
     1033        }
     1034
     1035
     1036        /*
     1037         * Gets data from win32k.
     1038         * Sets the controls according to the data from win32k.
     1039         *
     1040         * mr:  reserved
     1041         * mp1: reserved
     1042         * mp2: reserved
     1043         */
     1044        case WM_SETCONTROLS:
     1045        {
     1046            APIRET  rc;
     1047            CHAR    szNumber[32];
     1048            CHAR    szBuffer[100];
     1049
     1050
     1051            /*
     1052             * Call Win32k.sys to get options and statuses.
     1053             */
     1054            memset(&pThis->Options, 0, sizeof(K32OPTIONS));
     1055            pThis->Options.cb = sizeof(K32OPTIONS);
     1056            memset(&pThis->Status, 0, sizeof(K32STATUS));
     1057            pThis->Status.cb = sizeof(K32STATUS);
     1058            rc = libWin32kQueryOptionsStatus(&pThis->Options, &pThis->Status);
     1059            if (rc != NO_ERROR)
     1060            {
     1061                Complain(hwnd, IDS_ERR_QUERYOPTIONSTATUS, rc);
     1062                fNotExit = FALSE;
     1063                WinDismissDlg(hwnd, 0);
     1064                WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
     1065                return NULL;
     1066            }
     1067
     1068            /*
     1069             * Set the controls.
     1070             */
     1071            /* win32k */
     1072            sprintf(szBuffer, "%d.%d", 0, pThis->Status.ulVersion);
     1073            WinSetDlgItemText(hwnd, TX_W32K_VERSION_VAL,        szBuffer);
     1074            sprintf(szBuffer, "%s %s", pThis->Status.szBuildTime, pThis->Status.szBuildDate);
     1075            WinSetDlgItemText(hwnd, TX_W32K_BUILD_DATETIME_VAL, szBuffer);
     1076            WinSetDlgItemText(hwnd, TX_W32K_SYMBOLFILE_VAL,     pThis->Status.szSymFile);
     1077            sprintf(szBuffer, "%d - ", pThis->Status.ulBuild);
     1078            if (GetFixpackDesc(pThis->Status.ulBuild, pThis->Status.fKernel, szBuffer + strlen(szBuffer)))
     1079                sprintf(szBuffer, "%d", pThis->Status.ulBuild);
     1080            WinSetDlgItemText(hwnd, TX_W32K_KERNELBUILD_VAL,    szBuffer);
     1081
     1082            /* logging */
     1083            WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED,     BM_SETCHECK,    (MPARAM)(pThis->Options.fLogging),                  NULL);
     1084            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x3f8),            NULL);
     1085            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x2f8),            NULL);
     1086            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x3e8),            NULL);
     1087            WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4,        BM_SETCHECK,    (MPARAM)(pThis->Options.usCom == 0x2e8),            NULL);
     1088
     1089            /* loaders */
     1090            WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL,     BM_SETCHECK,    (MPARAM)(pThis->Options.fNoLoader),                  NULL);
     1091            /* PE */
     1092            WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE,         BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE2LX),     NULL);
     1093            WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED,        BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_MIXED),     NULL);
     1094            WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE,           BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE),        NULL);
     1095            WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT,          BM_SETCHECK,    (MPARAM)(pThis->Options.fPE == FLAGS_PE_NOT),       NULL);
     1096            WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT,    BM_SETCHECK,    (MPARAM)(pThis->Options.fPEOneObject),              NULL);
     1097            WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL,    SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel),         NULL); /* FIXME to be changed */
     1098            sprintf(szNumber, "%d", pThis->Status.cPe2LxModules);
     1099            WinSetDlgItemText(hwnd, TX_LDR_PE_MODULES_VAL, szNumber);
     1100            /* Elf */
     1101            WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED,     BM_SETCHECK,    (MPARAM)(pThis->Options.fElf),                      NULL);
     1102            WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL,   SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel),         NULL); /* FIXME to be changed */
     1103            sprintf(szNumber, "%d", pThis->Status.cElf2LxModules);
     1104            WinSetDlgItemText(hwnd, TX_LDR_ELF_MODULES_VAL, szNumber);
     1105            /* UNIX Shell Scripts */
     1106            WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS,   BM_SETCHECK,    (MPARAM)(pThis->Options.fUNIXScript),               NULL);
     1107            /* JAVA */
     1108            WinSendDlgItemMsg(hwnd, CB_LDR_JAVA,            BM_SETCHECK,    (MPARAM)(pThis->Options.fJava),                     NULL);
     1109            /* REXX Scripts */
     1110            WinSendDlgItemMsg(hwnd, CB_LDR_REXX,            BM_SETCHECK,    (MPARAM)(pThis->Options.fREXXScript),               NULL);
     1111
     1112            /* OS/2 Loader Fixes */
     1113            WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES,     BM_SETCHECK,    (MPARAM)(pThis->Options.fDllFixes),                 NULL);
     1114            WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_SETCHECK,    (MPARAM)(pThis->Options.fForcePreload),             NULL);
     1115
     1116            /* heaps */
     1117            /* Resident */
     1118            WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX,        SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbResHeapMax / 1024), NULL);
     1119            sprintf(szNumber, "%d", pThis->Status.cbResHeapInit / 1024);
     1120            WinSetDlgItemText(hwnd, TX_HEAP_RES_INIT_VAL,   szNumber);
     1121            sprintf(szNumber, "%d", pThis->Status.cbResHeapSize / 1024);
     1122            WinSetDlgItemText(hwnd, TX_HEAP_RES_SIZE_VAL,   szNumber);
     1123            sprintf(szNumber, "%d", pThis->Status.cbResHeapUsed / 1024);
     1124            WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_VAL,   szNumber);
     1125            sprintf(szNumber, "%d", pThis->Status.cbResHeapFree / 1024);
     1126            WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_VAL,   szNumber);
     1127            sprintf(szNumber, "%d", pThis->Status.cResBlocksUsed);
     1128            WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_BLOCKS_VAL,   szNumber);
     1129            sprintf(szNumber, "%d", pThis->Status.cResBlocksFree);
     1130            WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_BLOCKS_VAL,   szNumber);
     1131            /* Swappable */
     1132            WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX,        SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbSwpHeapMax / 1024), NULL);
     1133            sprintf(szNumber, "%d", pThis->Status.cbSwpHeapInit / 1024);
     1134            WinSetDlgItemText(hwnd, TX_HEAP_SWP_INIT_VAL,   szNumber);
     1135            sprintf(szNumber, "%d", pThis->Status.cbSwpHeapSize / 1024);
     1136            WinSetDlgItemText(hwnd, TX_HEAP_SWP_SIZE_VAL,   szNumber);
     1137            sprintf(szNumber, "%d", pThis->Status.cbSwpHeapUsed / 1024);
     1138            WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_VAL,   szNumber);
     1139            sprintf(szNumber, "%d", pThis->Status.cbSwpHeapFree / 1024);
     1140            WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_VAL,   szNumber);
     1141            sprintf(szNumber, "%d", pThis->Status.cSwpBlocksUsed);
     1142            WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_BLOCKS_VAL,   szNumber);
     1143            sprintf(szNumber, "%d", pThis->Status.cSwpBlocksFree);
     1144            WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_BLOCKS_VAL,   szNumber);
     1145
     1146            pThis->fDirty = FALSE;
     1147            return NULL;
     1148        }
     1149
     1150
     1151        /*
     1152         * Validate data in the controls. Complains accoring to mp1.
     1153         * Put the data into the win32k option struct.
     1154         *
     1155         * mr:  Valid indicator.
     1156         *      TRUE:   Valid data.
     1157         *      FALSE:  Not valid data.
     1158         * mp1: BOOL fComplain.
     1159         *      TRUE:   Do complain about errors. The pThis->Options struct
     1160         *              is updated on successful return.
     1161         *      FALSE:  Do not complain about errors, and don't update the
     1162         *              pThis->Options struct.
     1163         * mp2: reserved.
     1164         */
     1165        case WM_QUERYCONTROLS:
     1166        {
     1167            BOOL        fComplain = (BOOL)mp1;
     1168            ULONG       ul;
     1169
     1170            /*
     1171             * Init temporary option struct.
     1172             */
     1173            memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS));
     1174            pThis->NewOptions.cb = sizeof(K32OPTIONS);
     1175
     1176            /*
     1177             * Logging.
     1178             */
     1179            pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;
     1180            if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL))
     1181                pThis->NewOptions.usCom = 0x3f8;
     1182            else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL))
     1183                pThis->NewOptions.usCom = 0x2f8;
     1184            else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL))
     1185                pThis->NewOptions.usCom = 0x3e8;
     1186            else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL))
     1187                pThis->NewOptions.usCom = 0x2e8;
     1188            else
     1189            {
     1190                if (fComplain)
     1191                    Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON);
     1192                return (MPARAM)FALSE;
     1193            }
     1194
     1195            /*
     1196             * Loaders
     1197             */
     1198            pThis->NewOptions.fNoLoader = WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_QUERYCHECK, NULL, NULL) != 0;
     1199            /* PE */
     1200            if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_QUERYCHECK, NULL, NULL))
     1201                pThis->NewOptions.fPE = FLAGS_PE_PE2LX;
     1202            else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_QUERYCHECK, NULL, NULL))
     1203                pThis->NewOptions.fPE = FLAGS_PE_MIXED;
     1204            else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_QUERYCHECK, NULL, NULL))
     1205                pThis->NewOptions.fPE = FLAGS_PE_PE;
     1206            else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_QUERYCHECK, NULL, NULL))
     1207                pThis->NewOptions.fPE = FLAGS_PE_NOT;
     1208            else
     1209            {
     1210                if (fComplain)
     1211                    Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON);
     1212                return (MPARAM)FALSE;
     1213            }
     1214            pThis->NewOptions.fPEOneObject = (ULONG)WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT, BM_QUERYCHECK, NULL, NULL);
     1215            if (pThis->NewOptions.fPEOneObject > 2)
     1216            {
     1217                if (fComplain)
     1218                    Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON);
     1219                return (MPARAM)FALSE;
     1220            }
     1221            if (!WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
     1222            {
     1223                if (fComplain)
     1224                {
     1225                    Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);
     1226                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_PE_INFOLEVEL));
     1227                }
     1228                return (MPARAM)FALSE;
     1229            }
     1230            pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */
     1231
     1232            /* Elf */
     1233            pThis->NewOptions.fElf = WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;
     1234            if (!WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
     1235            {
     1236                if (fComplain)
     1237                {
     1238                    Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);
     1239                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_ELF_INFOLEVEL));
     1240                }
     1241                return (MPARAM)FALSE;
     1242            }
     1243            //pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */
     1244            /* UNIX Shell Scripts */
     1245            pThis->NewOptions.fUNIXScript = WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_QUERYCHECK, NULL, NULL) != 0;
     1246            /* JAVA */
     1247            pThis->NewOptions.fJava = WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_QUERYCHECK, NULL, NULL) != 0;
     1248            /* REXX Scripts */
     1249            pThis->NewOptions.fREXXScript = WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_QUERYCHECK, NULL, NULL) != 0;
     1250
     1251            /*
     1252             * OS/2 Loader Fixes.
     1253             */
     1254            pThis->NewOptions.fDllFixes = WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_QUERYCHECK, NULL, NULL) != 0;
     1255            pThis->NewOptions.fForcePreload = WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_QUERYCHECK, NULL, NULL) != 0;
     1256
     1257            /*
     1258             * Heaps
     1259             */
     1260            /* Resident */
     1261            if (!WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
     1262            {
     1263                if (fComplain)
     1264                {
     1265                    Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE);
     1266                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_RES_MAX));
     1267                }
     1268                return (MPARAM)FALSE;
     1269            }
     1270            pThis->NewOptions.cbResHeapMax = ul*1024;
     1271            /* Swappable */
     1272            if (!WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
     1273            {
     1274                if (fComplain)
     1275                {
     1276                    Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE);
     1277                    WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_SWP_MAX));
     1278                }
     1279                return (MPARAM)FALSE;
     1280            }
     1281            pThis->NewOptions.cbSwpHeapMax = ul*1024;
     1282
     1283            /*
     1284             * Check if there is any change and set the fDirty flag accordingly.
     1285             */
     1286            pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0;
     1287            return (MPARAM)TRUE;
     1288        }
     1289
     1290
     1291    }
     1292
     1293    /*
     1294     * Return thru the default dialog procedure.
     1295     */
     1296    return WinDefDlgProc(hwnd, msg, mp1, mp2);
     1297}
     1298#endif
     1299
     1300
    7361301/**
    7371302 * Pops up a message box displaying a message from the message table.
Note: See TracChangeset for help on using the changeset viewer.