Changeset 21579 for trunk/src


Ignore:
Timestamp:
Feb 25, 2011, 7:28:08 PM (14 years ago)
Author:
dmik
Message:

odincrt: Fixed a tiny typo in DosQueryModuleHandleStrict() that could sometimes cause 100% CPU load at application startup eventually leading to SYS1808 due to stack overflow. Closes #31.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/odincrt/dos.cpp

    r21425 r21579  
    3838    return stricmp(fullFname, modFname) == 0 && stricmp(fullExt, modExt) == 0;
    3939}
     40
    4041static BOOL walkModules(QSPTRREC *pPtrRec, USHORT hmteStart,
    4142                        PCSZ pszModname, PHMODULE pHmod)
     
    4344    QSLREC *pLibRec = pPtrRec->pLibRec;
    4445
    45     while (pLibRec) {
    46         // It happens that for some modules ctObj is > 0 but pbjInfo is
    47         // NULL. This seems to be an OS/2 FP13 bug. Here is the solution from
    48         // winimagepe2lx.cpp. We need it too because of pNextRec.
     46    while (pLibRec)
     47    {
     48        // It happens that for some modules ctObj is > 0 but pObjInfo is
     49        // NULL and pNextRec points right to the object table instead of the
     50        // next record. This seems to be an OS/2 FP13 bug. Here is the solution
     51        // from winimagepe2lx.cpp. We need it too because of pNextRec.
    4952        if (pLibRec->ctObj > 0 && pLibRec->pObjInfo == NULL)
    5053        {
     
    7376                    return TRUE;
    7477            }
     78
     79            // break the loop since we already walked the module in question
     80            break;
    7581        }
    7682        pLibRec = (QSLREC *)pLibRec->pNextRec;
     
    8995    *pHmod = NULLHANDLE;
    9096
    91     // In LIBPATHSTRICT=T mode, there mey be more than one module with the
     97    // In LIBPATHSTRICT=T mode, there may be more than one module with the
    9298    // given name loaded into the memory. For this reason, when looking for a
    9399    // module by its basename, we first walk the modules belonging to the
     
    105111    QSPTRREC *pPtrRec = (QSPTRREC *)buf;
    106112    QSPREC *pProcRec = pPtrRec->pProcRec;
     113
     114    // first walk the EXE's imported modules
    107115    if (!walkModules(pPtrRec, pProcRec->hMte, pszModname, pHmod))
    108116    {
    109         arc = ERROR_INVALID_NAME;
    110         for (USHORT i = 0; i < pProcRec->cLib; ++i) {
     117        arc = ERROR_MOD_NOT_FOUND;
     118
     119        // next, walk the modules loaded by the process
     120        for (USHORT i = 0; i < pProcRec->cLib; ++i)
     121        {
    111122            USHORT hmte = pProcRec->pLibRec[i];
    112123            if (walkModules(pPtrRec, hmte, pszModname, pHmod))
Note: See TracChangeset for help on using the changeset viewer.