Ignore:
Timestamp:
Sep 4, 2000, 6:40:50 PM (25 years ago)
Author:
bird
Message:

Corrected FATAL error in k32QueryOptionsStatus.cpp. (Forgot SSToDS...)
Improved error messages during init.

Location:
trunk/src/win32k/dev16
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/dev16/d16init.c

    r4164 r4185  
    1 /* $Id: d16init.c,v 1.7 2000-09-02 21:07:55 bird Exp $
     1/* $Id: d16init.c,v 1.8 2000-09-04 16:40:47 bird Exp $
    22 *
    33 * d16init - init routines for both drivers.
     
    4747#include "log.h"
    4848#include "options.h"
    49 
     49#include "errors.h"
    5050
    5151
     
    9898    USHORT          usAction = 0;
    9999    NPSZ            npszErrMsg = NULL;
     100    NPSZ            npszErrMsg2 = NULL;
    100101
    101102    /*
     
    119120            if (rc == NO_ERROR)
    120121            {
    121                 if ((rc = data.Status) == STATUS_DONE)
     122                if (data.usRcInit32 == NO_ERROR)
    122123                {
    123124                    if (!options.fQuiet)
    124125                        printf16("Win32k.sys succesfully initiated!\n");
    125                     pRpOut->Status = pRpOut->rph.Status = data.Status;
     126                    pRpOut->Status = pRpOut->rph.Status = STATUS_DONE;
    126127                }
    127128                else
    128                     npszErrMsg = "Ring-0 initiation failed. rc=%d\n";
     129                {
     130                    /* set correct error message and rc */
     131                    rc = data.usRcInit32;
     132                    npszErrMsg = "Ring-0 initiation failed. rc=%x\n";
     133                    if (rc >= ERROR_D32_FIRST && rc <= ERROR_D32_LAST)
     134                        npszErrMsg2 = GetErrorMsg(data.usRcInit32 + ERROR_PROB_SYM_D32_FIRST - ERROR_D32_FIRST);
     135                }
    129136            }
    130137            else
     
    152159    {
    153160        printf16(npszErrMsg, rc);
    154         pRpOut->Status = pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
     161        if (npszErrMsg2)
     162            printf16("%s\n", npszErrMsg2);
     163        pRpOut->Status = pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_GEN_FAILURE;
    155164    }
    156165
     
    167176 * R0 16-bit initiation.
    168177 * This gets TKSSBase, thunks parameters and calls R0 32-bit initiation function.
    169  * @returns   Status word.
    170  * @param     pRp  Generic IO Control request packet.
     178 * @returns     Status word. We don't fail on R0Init32 but forwards the result
     179 *              using the usRcInit32.
     180 * @param       pRp     Generic IO Control request packet.
    171181 */
    172182USHORT NEAR  R0Init16(PRP_GENIOCTL pRp)
     
    212222                    !DevHelp_VirtToLin(SELECTOROF(rp32init.InitArgs), OFFSETOF(rp32init.InitArgs), (PLIN)&rp32init.InitArgs)
    213223                   )
    214                 {
     224                {   /* call 32-bit init routine and set 32 bit rc. */
    215225                    usRc = CallR0Init32(SSToDS_16(&rp32init));
     226                    ((PD16R0INITDATA)pRp->DataPacket)->usRcInit32 = usRc;
     227
     228                    /* set status to done (success).  (R0Init32 RC is return as usRcInit32.)  */
     229                    usRc = STATUS_DONE;
    216230                }
    217231                else
    218                     usRc |= ERROR_I24_INVALID_PARAMETER;
    219 
    220                 ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc;
     232                    usRc |= STERR | ERROR_I24_INVALID_PARAMETER;
     233
    221234
    222235                /*
    223                  * finished - unlock data and parm
     236                 * finished - unlock data and parm;
    224237                 */
    225238                DevHelp_VMUnLock((LIN)SSToDS_16(&hLockParm[0]));
     
    227240            }
    228241            else
    229                 usRc |= ERROR_I24_INVALID_PARAMETER;
     242                usRc |= STERR | ERROR_I24_INVALID_PARAMETER;
    230243        }
    231244        else
    232             usRc |= ERROR_I24_INVALID_PARAMETER;
     245            usRc |= STERR | ERROR_I24_INVALID_PARAMETER;
    233246    }
    234247    else
    235         usRc |= ERROR_I24_GEN_FAILURE;
     248        usRc |= STERR | ERROR_I24_GEN_FAILURE;
    236249
    237250    return usRc;
  • trunk/src/win32k/dev16/d16strat.c

    r4164 r4185  
    1 /* $Id: d16strat.c,v 1.9 2000-09-02 21:07:56 bird Exp $
     1/* $Id: d16strat.c,v 1.10 2000-09-04 16:40:48 bird Exp $
    22 *
    33 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr)
     
    174174                    if (TKSSBase16 == 0)
    175175                        initGetDosTableData();
    176                     return CallVerifyImportTab32();
     176                    rc = CallVerifyImportTab32();
     177                    if (pRp->DataPacket)
     178                        ((PD16VERIFYIMPORTTABDATA)pRp->DataPacket)->usRc = rc;
     179                    return STATUS_DONE;
    177180                }
    178181                break;
  • trunk/src/win32k/dev16/probkrnl.c

    r4164 r4185  
    1 /* $Id: probkrnl.c,v 1.21 2000-09-02 21:07:56 bird Exp $
     1/* $Id: probkrnl.c,v 1.22 2000-09-04 16:40:48 bird Exp $
    22 *
    33 * Description:   Autoprobes the os2krnl file and os2krnl[*].sym files.
     
    137137};
    138138
    139 char DATA16_GLOBAL  szUsrSym[50] = {0};
     139/**
     140 * szSymbolFile holds the name of the symbol file used.
     141 *
     142 */
     143char DATA16_GLOBAL  szSymbolFile[60] = {0};
     144
     145/**
     146 * iProc holds the number of the procedure which failed during verify.
     147 */
     148int  DATA16_GLOBAL  iProc = -1;         /* The procedure number which failed Verify. */
    140149
    141150
     
    204213
    205214    /*
    206      * ProbeSymFile error messages
     215     * ProbeSymFile error messages + some extra ones.
    207216     */
    208217    {ERROR_PROB_SYM_FILE_NOT_FOUND,     "Sym: Symbol file was not found."},
     
    212221    {ERROR_PROB_SYM_SEG_DEF_SEEK,       "Sym: Failed to seek to a segment definition."},
    213222    {ERROR_PROB_SYM_SEG_DEF_READ,       "Sym: Failed to read a segment definition."},
    214     {ERROR_PROB_SYM_IMPORTS_NOTFOUND,   "Sym: All the imports wasn't found."},
     223    {ERROR_PROB_SYM_IMPORTS_NOTFOUND,   "Sym: Some of the imports wasn't found."},
    215224    {ERROR_PROB_SYM_V_PROC_NOT_FND,     "Sym: Verify failed: Procedure not found."},
    216225    {ERROR_PROB_SYM_V_OBJ_OR_ADDR,      "Sym: Verify failed: Invalid object or address."},
     
    218227    {ERROR_PROB_SYM_V_PROLOG,           "Sym: Verify failed: Invalid prolog."},
    219228    {ERROR_PROB_SYM_V_NOT_IMPL,         "Sym: Verify failed: Not implemented."},
     229    {ERROR_PROB_SYM_V_GETOS2KRNL,       "GetOs2Krnl: failed."},
     230    {ERROR_PROB_SYM_V_NO_SWAPMTE,       "GetOs2Krnl: No Swap MTE."},
     231    {ERROR_PROB_SYM_V_OBJECTS,          "GetOs2Krnl: Too many objects."},
     232    {ERROR_PROB_SYM_V_OBJECT_TABLE,     "GetOs2Krnl: No object table."},
     233    {ERROR_PROB_SYM_V_BUILD_INFO,       "GetOs2Krnl: Build info not found."},
     234    {ERROR_PROB_SYM_V_INVALID_BUILD,    "GetOs2Krnl: Unsupported build."},
     235    {ERROR_PROB_SYM_V_VERIFY,           "importTabInit: Import failed."},
     236    {ERROR_PROB_SYM_V_IPE,              "importTabInit: Internal-Processing-Error."},
     237    {ERROR_PROB_SYM_V_HEAPINIT,         "R0Init32: HeapInit Failed."},
     238    {ERROR_PROB_SYM_V_D32_LDR_INIT,     "R0Init32: ldrInit Failed."},
    220239
    221240    {ERROR_PROB_SYMDB_KRNL_NOT_FOUND,   "SymDB: Kernel was not found."}
     
    253272static int      kargncpy(char *pszTarget, const char *pszArg, unsigned cchMaxlen);
    254273
    255 static const char * GetErrorMsg(short sErr);
    256 
    257274/* Workers */
    258275static int      LookupKrnlEntry(unsigned short usBuild, unsigned short fKernel, unsigned char cObjects);
     
    262279
    263280/* Ouput */
    264 static void     ShowResult(int rc, int iSym);
     281static void     ShowResult(int rc);
    265282
    266283/* Others used while debugging in R3. */
     
    570587 * @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
    571588 */
    572 static const char * GetErrorMsg(short sErr)
     589const char * GetErrorMsg(short sErr)
    573590{
    574591    int i;
     
    639656            rc = VerifyPrologs();
    640657
    641             /* set sym name */
     658            /* set sym name on success or complain on error */
    642659            if (rc == 0)
    643                 kstrcpy(szUsrSym, "Win32k Symbol Database");
     660                kstrcpy(szSymbolFile, "Win32k Symbol Database");
     661            else
     662            {
     663                printf16("Warning: The Win32k Symbol Database entry found.\n"
     664                         "         But, VerifyPrologs() returned rc=0x%x and iProc=%d\n", rc, iProc);
     665                DosSleep(3000);
     666            }
     667
    644668            return rc;
    645669        }
     
    655679 * Verifies the that the addresses in aImportTab are valid.
    656680 * This is done at Ring-0 of course.
    657  * @returns   0 if ok, not 0 if not ok.
     681 * @returns     NO_ERROR (ie. 0) on success. iProc = -1
     682 *              The appropriate OS/2 or Win32k return code on success. iProc
     683 *              is set to the failing procedure (if appliable).
    658684 */
    659685static int VerifyPrologs(void)
     
    664690    USHORT          usAction = 0;
    665691
     692    /* Set the failing procedure number to -1. */
     693    iProc = -1;
     694
     695    /* Open the elf device driver. */
    666696    rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL,
    667697                 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
     
    670700    if (rc == NO_ERROR)
    671701    {
    672         rc = DosDevIOCtl("", "", D16_IOCTL_VERIFYIMPORTTAB, D16_IOCTL_CAT, hDev0);
     702        D16VERIFYIMPORTTABDATA Data = {0};
     703
     704        /* Issue the VerifyImportTab IOCtl call. */
     705        rc = DosDevIOCtl(&Data, "", D16_IOCTL_VERIFYIMPORTTAB, D16_IOCTL_CAT, hDev0);
    673706        DosClose(hDev0);
    674         if (rc != NO_ERROR)
    675         {
    676             register APIRET rc2 = rc & STECODE;
    677             if (rc2 >= ERROR_D32_VERIFYIMPORTTAB_FIRST && rc2 <= ERROR_D32_VERIFYIMPORTTAB_LAST)
    678                 rc = rc2 + ERROR_PROB_SYM_VERIFY_FIRST - ERROR_D32_VERIFYIMPORTTAB_FIRST;
     707        if (rc == NO_ERROR)
     708        {
     709            if (Data.usRc != NO_ERROR)
     710            {
     711                /* set the appropriate return values. */
     712                rc = (Data.usRc & ERROR_D32_ERROR_MASK) + ERROR_PROB_SYM_D32_FIRST;
     713                if (Data.usRc & ERROR_D32_PROC_FLAG)
     714                    iProc = (Data.usRc & ERROR_D32_PROC_MASK) >> ERROR_D32_PROC_SHIFT;
     715            }/* else success */
     716        }
     717        else
     718        {
     719            dprintf(("DosDevIOCtl failed with rc=%d\n", rc));
     720            DosSleep(3000);
    679721        }
    680722    }
     
    682724    {
    683725        dprintf(("DosOpen Failed with rc=%d\n", rc));
    684         DosSleep(2000);
     726        DosSleep(3000);
    685727    }
    686728
     
    10421084 * Shows result of kernelprobing if not quiet or on error.
    10431085 * @param   rc      Return code.
    1044  * @param   iSym    index of .sym-file into static struct.
    10451086 */
    10461087#ifndef EXTRACT
    1047 static void ShowResult(int rc, int iSym)
     1088static void ShowResult(int rc)
    10481089{
    10491090    int i;
     
    10751116         * symbol-file
    10761117         */
    1077         if (rc == NO_ERROR || (rc > ERROR_PROB_SYM_LAST && (szUsrSym[0] != '\0' || apszSym[iSym] != NULL)))
    1078             printf16("    Found symbolfile: %s\n",
    1079                      szUsrSym[0] == '\0' ? apszSym[iSym] : szUsrSym);
     1118        if (rc == NO_ERROR || (rc > ERROR_PROB_SYM_LAST && szSymbolFile[0] != '\0'))
     1119            printf16("    Found symbolfile: %s\n", (NPSZ)szSymbolFile);
    10801120        else if (rc >= ERROR_PROB_SYM_FIRST)
    10811121            printf16("    Failed to find symbolfile!\n");
     
    10861126         * function listing
    10871127         */
    1088         if (options.fLogging || rc != NO_ERROR)
     1128        if (options.fLogging)/* || rc != NO_ERROR)*/
    10891129        {
    10901130            for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
     
    11051145        {
    11061146            const char *psz = GetErrorMsg(rc);
    1107             printf16("ProbeKernel failed with rc=%d.\n", rc);
     1147            printf16("ProbeKernel failed with rc=%d. iProc=%x\n", rc, iProc);
    11081148            if (psz) printf16("%s\n", psz);
    11091149        }
     
    11671207                            && pReqPack->InitArgs[i] != 'm' && pReqPack->InitArgs[i] != 'M'
    11681208                            ) /* -script and -smp is ignored */
    1169                             i += kargncpy(szUsrSym, &pReqPack->InitArgs[i], sizeof(szUsrSym));
     1209                            i += kargncpy(szSymbolFile, &pReqPack->InitArgs[i], sizeof(szSymbolFile));
    11701210                        break;
    11711211
     
    12221262    {
    12231263        rc = 1;
    1224         if (szUsrSym[0] != '\0')
    1225         {
    1226             rc = ProbeSymFile(szUsrSym);
     1264        if (szSymbolFile[0] != '\0')
     1265        {
     1266            rc = ProbeSymFile(szSymbolFile);
    12271267            if (rc)
    12281268            {
    1229                 printf16("Warning: Invalid symbol file specified. Tries defaults.\n");
    1230                 szUsrSym[0] = '\0';
     1269                printf16("Warning: Invalid symbol file specified. rc=%x iProc=%d\n"
     1270                         "         Tries defaults.\n", rc, iProc);
     1271                szSymbolFile[0] = '\0';
     1272                DosSleep(3000);
    12311273            }
    12321274        }
     
    12551297                {
    12561298                    i++;
    1257                     if (rc2 >= ERROR_PROB_SYM_VERIFY_FIRST)
     1299                    if (rc2 >= ERROR_PROB_SYM_D32_FIRST)
    12581300                        rc = rc2;
    12591301                }
    1260                 if (rc == 1 || rc2 == NO_ERROR)
     1302                if (rc == NO_ERROR)
     1303                    kstrcpy(szSymbolFile, apszSym[i]);
     1304                else if (rc == 1 || rc2 == NO_ERROR)
    12611305                    rc = rc2;
    12621306                #endif
     
    12651309    }
    12661310
    1267     /* show the result and set return-value */
    1268     dprintf(("rc=%d; i=%d\n", rc, i));
    1269     ShowResult(rc, i);
    1270 
    1271     /* Copy the symbol file name to szUsrSym. */
    1272     if (szUsrSym[0] == '\0' && apszSym[i] != NULL)
    1273         kstrcpy(szUsrSym, apszSym[i]);
     1311    /* Show the result and set return-value */
     1312    dprintf(("rc=%d(0x%x); i=%d; iProc=%d\n", rc, rc, i, iProc));
     1313    ShowResult(rc);
    12741314
    12751315    return rc;
     
    17141754        int         i;
    17151755
    1716         printf16("/* $Id: probkrnl.c,v 1.21 2000-09-02 21:07:56 bird Exp $\n"
     1756        printf16("/* $Id: probkrnl.c,v 1.22 2000-09-04 16:40:48 bird Exp $\n"
    17171757                 "*\n"
    17181758                 "* Autogenerated kernel symbol database.\n"
Note: See TracChangeset for help on using the changeset viewer.