Changeset 3579 for trunk/kStuff/kLdr


Ignore:
Timestamp:
Sep 2, 2007, 11:40:41 PM (18 years ago)
Author:
bird
Message:

error code cleanup.

Location:
trunk/kStuff/kLdr
Files:
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/kStuff/kLdr/Makefile.kmk

    r3578 r3579  
    120120        kLdrDyldOS.c \
    121121        kLdrDyLdSem.c \
    122         kLdrErr.c \
    123122        kLdrMisc.c \
    124123        kLdrMod.c \
     
    136135kLdr_LIBS += \
    137136        $(PATH_LIB)/kRdrStatic$(SUFF_LIB) \
    138         $(PATH_LIB)/kHlpBareStatic$(SUFF_LIB)
    139 
    140 kLdrErr.c_DEPS = $(PATH_TARGET)/kldrErrConsts.h
    141 kLdrErr.c_INCS = $(PATH_TARGET)
     137        $(PATH_LIB)/kHlpBareStatic$(SUFF_LIB) \
     138        $(PATH_LIB)/kErrStatic$(SUFF_LIB)
    142139
    143140#
     
    222219
    223220
    224 #
    225 # Generate case statements for kLdrErrStr().
    226 #
    227 $(PATH_TARGET)/kldrErrConsts.h: ../include/k/kLdr.h Makefile.kmk | $(call DIRDEP,$(PATH_TARGET))
    228         $(RM) -f $@
    229         $(SED) \
    230                 -e '/^#define  *\(KLDR_ERR_[^ ()]*\) .*$$/!d' \
    231                 -e 's/^#define  *\(KLDR_ERR_[^ ()]*\) .*$$/ERR_CONST(\1)/' \
    232                 -e '/KLDR_ERR_BASE/d' \
    233                 -e '/KLDR_ERR_[^_]*_BASE/d' \
    234                 ../include/k/kLdr.h > $@
    235 
     221
  • trunk/kStuff/kLdr/kLdr-os2.def

    r3578 r3579  
    108108
    109109    ; Error APIs:
    110     _kLdrErrStr
     110    _kErrStr
    111111
    112112
  • trunk/kStuff/kLdr/kLdr-win.def

    r3578 r3579  
    107107
    108108    ; Error APIs:
    109     kLdrErrStr
     109    kErrName
    110110
  • trunk/kStuff/kLdr/kLdrDyld.c

    r3576 r3579  
    253253                          | KLDRDYLD_LOAD_FLAGS_RECURSIVE_INIT
    254254                          | KLDRYDLD_LOAD_FLAGS_SPECIFIC_MODULE))
    255         kldrDyldFailure(KLDR_ERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags);
     255        kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad fFlags=%#x", pArgs->fFlags);
    256256    if (    pArgs->enmSearch <= KLDRDYLD_SEARCH_INVALID
    257257        ||  pArgs->enmSearch >= KLDRDYLD_SEARCH_END)
    258         kldrDyldFailure(KLDR_ERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch);
     258        kldrDyldFailure(KERR_INVALID_PARAMETER, "Bad enmSearch=%d", pArgs->enmSearch);
    259259
    260260    /*
     
    461461 *
    462462 * @returns 0 on success and pszName filled with the name.
    463  * @returns KLDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.
     463 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure.
    464464 * @param   hMod        The module handle.
    465465 * @param   pszName     Where to put the name.
     
    492492 *
    493493 * @returns 0 on success and pszFilename filled with the name.
    494  * @returns KLDR_ERR_INVALID_HANDLE or KLDR_ERR_BUFFER_OVERFLOW on failure.
     494 * @returns KERR_INVALID_HANDLE or KERR_BUFFER_OVERFLOW on failure.
    495495 * @param   hMod            The module handle.
    496496 * @param   pszFilename     Where to put the filename.
     
    523523 *
    524524 * @returns 0 on success and pValue and pfKind set.
    525  * @returns KLDR_ERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure.
     525 * @returns KERR_INVALID_HANDLE or KLDR_ERR_SYMBOL_NOT_FOUND on failure.
    526526 * @param   hMod                The module handle.
    527527 * @param   uSymbolOrdinal      The symbol ordinal. This is ignored if pszSymbolName is non-zero.
     
    542542        *pValue = 0;
    543543    if (!pfKind && !pValue)
    544         return KLDR_ERR_INVALID_PARAMETER;
     544        return KERR_INVALID_PARAMETER;
    545545    KLDRDYLD_VALIDATE_HKLDRMOD(hMod);
    546546    K_VALIDATE_OPTIONAL_STRING(pszSymbolName);
     
    10731073 * Records the module.
    10741074 *
    1075  * @return 0 on success, KLDR_ERR_NO_MEMORY if we can't expand the table.
     1075 * @return 0 on success, KERR_NO_MEMORY if we can't expand the table.
    10761076 * @param   pMod        The module to record.
    10771077 */
     
    10871087        void *pvNew = kHlpAlloc(cNew * sizeof(g_papStackMods[0]));
    10881088        if (!pvNew)
    1089             return KLDR_ERR_NO_MEMORY;
     1089            return KERR_NO_MEMORY;
    10901090        kHlpMemCopy(pvNew, pvOld, g_cStackMods * sizeof(g_papStackMods[0]));
    10911091        g_papStackMods = (PPKLDRDYLDMOD)pvNew;
  • trunk/kStuff/kLdr/kLdrDyldFind.c

    r3578 r3579  
    620620        return 0;
    621621    /** @todo deal with return codes properly. */
    622     if (rc >= KLDR_ERR_BASE && rc <= KLDR_ERR_END)
     622    if (rc >= KERR_BASE && rc <= KERR_END)
    623623        return rc;
    624624
     
    772772 * Resolve default search method, prefix and suffix.
    773773 *
    774  * @returns 0 on success, KLDR_ERR_INVALID_PARAMETER on failure.
     774 * @returns 0 on success, KERR_INVALID_PARAMETER on failure.
    775775 * @param   penmSearch  The search method. In/Out.
    776776 * @param   ppszPrefix  The prefix. In/Out.
     
    828828        default:
    829829            KLDRDYLDFIND_ASSERT(!"invalid search method");
    830             return KLDR_ERR_INVALID_PARAMETER;
     830            return KERR_INVALID_PARAMETER;
    831831    }
    832832
  • trunk/kStuff/kLdr/kLdrDyldMod.c

    r3578 r3579  
    182182    {
    183183        kLdrModClose(pRawMod);
    184         rc = KLDR_ERR_NO_MEMORY;
     184        rc = KERR_NO_MEMORY;
    185185    }
    186186    return rc;
     
    762762        pMod->papPrereqs = (PPKLDRDYLDMOD)kHlpAllocZ(sizeof(pMod->papPrereqs[0]) * cPrereqs);
    763763        if (!pMod->papPrereqs)
    764             return KLDR_ERR_NO_MEMORY;
     764            return KERR_NO_MEMORY;
    765765        pMod->cPrereqs = cPrereqs;
    766766    }
     
    12241224 * Gets the module name.
    12251225 *
    1226  * @returns 0 on success, KLDR_ERR_BUFFER_OVERFLOW on failure.
     1226 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure.
    12271227 * @param   pMod            The module.
    12281228 * @param   pszName         Where to store the name.
     
    12371237        pszName[cch - 1] = '\0';
    12381238    }
    1239     return cchName <= pMod->pMod->cchName ? KLDR_ERR_BUFFER_OVERFLOW : 0;
     1239    return cchName <= pMod->pMod->cchName ? KERR_BUFFER_OVERFLOW : 0;
    12401240}
    12411241
     
    12441244 * Gets the module filename.
    12451245 *
    1246  * @returns 0 on success, KLDR_ERR_BUFFER_OVERFLOW on failure.
     1246 * @returns 0 on success, KERR_BUFFER_OVERFLOW on failure.
    12471247 * @param   pMod            The module.
    12481248 * @param   pszFilename     Where to store the filename.
     
    12571257        pszFilename[cch - 1] = '\0';
    12581258    }
    1259     return cchFilename <= pMod->pMod->cchFilename ? KLDR_ERR_BUFFER_OVERFLOW : 0;
     1259    return cchFilename <= pMod->pMod->cchFilename ? KERR_BUFFER_OVERFLOW : 0;
    12601260}
    12611261
  • trunk/kStuff/kLdr/kLdrInternal.h

    r3578 r3579  
    329329            ||  (hMod)->u32MagicTail != KLDRDYMOD_MAGIC) \
    330330        { \
    331             return KLDR_ERR_INVALID_HANDLE; \
     331            return KERR_INVALID_HANDLE; \
    332332        } \
    333333    } while (0)
  • trunk/kStuff/kLdr/kLdrMisc.c

    r3573 r3579  
    5959        case KLDRARCH_X86_16:
    6060            if (enmCpu < KLDRCPU_FIRST_X86_16 || enmCpu > KLDRCPU_LAST_X86_16)
    61                 return KLDR_ERR_INVALID_PARAMETER;
     61                return KERR_INVALID_PARAMETER;
    6262
    6363            /* intel? */
     
    8383        case KLDRARCH_X86_32:
    8484            if (enmCpu < KLDRCPU_FIRST_X86_32 || enmCpu > KLDRCPU_LAST_X86_32)
    85                 return KLDR_ERR_INVALID_PARAMETER;
     85                return KERR_INVALID_PARAMETER;
    8686
    8787            /* blend? */
     
    111111        case KLDRARCH_AMD64:
    112112            if (enmCpu < KLDRCPU_FIRST_AMD64 || enmCpu > KLDRCPU_LAST_AMD64)
    113                 return KLDR_ERR_INVALID_PARAMETER;
     113                return KERR_INVALID_PARAMETER;
    114114
    115115            /* blend? */
  • trunk/kStuff/kLdr/kLdrMod.c

    r3578 r3579  
    7070/** Return / crash validation of a module argument. */
    7171#define KLDRMOD_VALIDATE(pMod) \
    72     KLDRMOD_VALIDATE_EX(pMod, KLDR_ERR_INVALID_PARAMETER)
     72    KLDRMOD_VALIDATE_EX(pMod, KERR_INVALID_PARAMETER)
    7373
    7474/** Return / crash validation of a module argument. */
     
    263263    KLDRMOD_VALIDATE(pMod);
    264264    if (!puValue && !pfKind)
    265         return KLDR_ERR_INVALID_PARAMETER;
     265        return KERR_INVALID_PARAMETER;
    266266    if (puValue)
    267267        *puValue = 0;
     
    300300 *
    301301 * @returns 0 and name in pszName on success.
    302  *          On buffer overruns KLDR_ERR_BUFFER_OVERFLOW will be returned.
     302 *          On buffer overruns KERR_BUFFER_OVERFLOW will be returned.
    303303 *          On other failures and appropriate error code is returned.
    304304 * @param   pMod            The module.
     
    421421    KLDRMOD_VALIDATE(pMod);
    422422    if (!pAddrRsrc && !pcbRsrc)
    423         return KLDR_ERR_INVALID_PARAMETER;
     423        return KERR_INVALID_PARAMETER;
    424424    if (pAddrRsrc)
    425425        *pAddrRsrc = NIL_KLDRADDR;
  • trunk/kStuff/kLdr/kLdrModLX.c

    r3578 r3579  
    273273    pModLX = (PKLDRMODLX)kHlpAlloc(cb);
    274274    if (!pModLX)
    275         return KLDR_ERR_NO_MEMORY;
     275        return KERR_NO_MEMORY;
    276276    *ppModLX = pModLX;
    277277
     
    938938    pv = kHlpAlloc(pModLX->Hdr.e32_fixupsize);
    939939    if (!pv)
    940         return KLDR_ERR_NO_MEMORY;
     940        return KERR_NO_MEMORY;
    941941
    942942    off = pModLX->Hdr.e32_objtab + pModLX->Hdr.e32_ldrsize;
     
    12161216        if (cchName)
    12171217            pszName[cchName - 1] = '\0';
    1218         rc = KLDR_ERR_BUFFER_OVERFLOW;
     1218        rc = KERR_BUFFER_OVERFLOW;
    12191219    }
    12201220
  • trunk/kStuff/kLdr/kLdrModMachO.c

    r3578 r3579  
    280280    pbLoadCommands = kHlpAlloc(s.Hdr32.sizeofcmds);
    281281    if (!pbLoadCommands)
    282         return KLDR_ERR_NO_MEMORY;
     282        return KERR_NO_MEMORY;
    283283    rc = kRdrRead(pRdr, pbLoadCommands, s.Hdr32.sizeofcmds,
    284284                        s.Hdr32.magic == IMAGE_MACHO32_SIGNATURE
     
    305305    pModMachO = (PKLDRMODMACHO)kHlpAlloc(cb);
    306306    if (!pModMachO)
    307         return KLDR_ERR_NO_MEMORY;
     307        return KERR_NO_MEMORY;
    308308    *ppModMachO = pModMachO;
    309309    pModMachO->pbLoadCommands = pbLoadCommands;
     
    639639
    640640                        default:
    641                             return KLDR_ERR_INVALID_PARAMETER;
     641                            return KERR_INVALID_PARAMETER;
    642642                    }
    643643
     
    925925
    926926                        default:
    927                             return KLDR_ERR_INVALID_PARAMETER;
     927                            return KERR_INVALID_PARAMETER;
    928928                    }
    929929
     
    21402140        if (cbSyms / cbSym != pModMachO->cSymbols)
    21412141            return KLDR_ERR_SIZE_OVERFLOW;
    2142         rc = KLDR_ERR_NO_MEMORY;
     2142        rc = KERR_NO_MEMORY;
    21432143        pvSyms = kHlpAlloc(cbSyms);
    21442144        if (pvSyms)
     
    22212221    paFixups = (macho_relocation_info_t *)kHlpAlloc(cbFixups);
    22222222    if (!paFixups)
    2223         return KLDR_ERR_NO_MEMORY;
     2223        return KERR_NO_MEMORY;
    22242224
    22252225    /* read the fixups. */
  • trunk/kStuff/kLdr/kLdrModNative.c

    r3578 r3579  
    305305    pModNative = (PKLDRMODNATIVE)kHlpAlloc(cb);
    306306    if (!pModNative)
    307         return KLDR_ERR_NO_MEMORY;
     307        return KERR_NO_MEMORY;
    308308
    309309    /* KLDRMOD */
     
    766766        if (cchName)
    767767            pszName[cchName - 1] = '\0';
    768         rc = KLDR_ERR_BUFFER_OVERFLOW;
     768        rc = KERR_BUFFER_OVERFLOW;
    769769    }
    770770
  • trunk/kStuff/kLdr/kLdrModPE.c

    r3578 r3579  
    205205    pModPE = (PKLDRMODPE)kHlpAlloc(cb);
    206206    if (!pModPE)
    207         return KLDR_ERR_NO_MEMORY;
     207        return KERR_NO_MEMORY;
    208208    *ppModPE = pModPE;
    209209
     
    10501050        if (cchName)
    10511051            pszName[cchName - 1] = '\0';
    1052         rc = KLDR_ERR_BUFFER_OVERFLOW;
     1052        rc = KERR_BUFFER_OVERFLOW;
    10531053    }
    10541054
  • trunk/kStuff/kLdr/testcase/tst-3-driver.c

    r2967 r3579  
    120120    rc = kLdrModOpen(pszFile, &pMod);
    121121    if (rc)
    122         return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, kLdrErrStr(rc));
     122        return Failure("kLdrModOpen(%s,) -> %#d (%s)\n", pszFile, rc, kErrName(rc));
    123123
    124124    /* get bits. */
     
    163163                        }
    164164                        else
    165                             Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, kLdrErrStr(rc));
     165                            Failure("kLdrModRelocateBits(,,, + 0x22000,,,) -> %#x (%s)\n", rc, kErrName(rc));
    166166                    }
    167167                    else
    168                         Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, kLdrErrStr(rc));
     168                        Failure("kLdrModRelocateBits(,, + 0x22000,,,,) -> %#x (%s)\n", rc, kErrName(rc));
    169169                }
    170170                else
     
    172172            }
    173173            else
    174                 Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, kLdrErrStr(rc));
     174                Failure("kLdrModQuerySymbol -> %#x (%s)\n", rc, kErrName(rc));
    175175        }
    176176        else
    177             Failure("kLdrModGetBits -> %#x (%s)\n", rc, kLdrErrStr(rc));
     177            Failure("kLdrModGetBits -> %#x (%s)\n", rc, kErrName(rc));
    178178        free(pvBits);
    179179    }
     
    184184    rc = kLdrModClose(pMod);
    185185    if (rc)
    186         Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, kLdrErrStr(rc));
     186        Failure("kLdrModOpen(%s,) -> %#x (%s)\n", pszFile, rc, kErrName(rc));
    187187    return 0;
    188188}
  • trunk/kStuff/kLdr/tstkLdrMod.c

    r3571 r3579  
    3030*******************************************************************************/
    3131#include <k/kLdr.h>
     32#include <k/kErr.h>
     33#include <k/kErrors.h>
     34
    3235#include <stdarg.h>
    3336#include <stdio.h>
     
    116119    rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    117120    if (rc)
    118         return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kLdrErrStr(rc));
     121        return Failure("failed to get image bits, rc=%d (%s) (a)", rc, kErrName(rc));
    119122    if (TestMemComp(pvBits2, pvBits, cbImage))
    120123        return Failure("relocation test failed, mismatching bits (a)");
     
    125128    rc = kLdrModRelocateBits(pMod, pvBits2, 0x1000, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    126129    if (rc)
    127         return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kLdrErrStr(rc));
     130        return Failure("failed to relocate, rc=%d (%s) (b1)", rc, kErrName(rc));
    128131    rc = kLdrModRelocateBits(pMod, pvBits2, (KUPTR)pvBits, 0x1000, BasicTestsGetImport, NULL);
    129132    if (rc)
    130         return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kLdrErrStr(rc));
     133        return Failure("failed to relocate, rc=%d (%s) (b2)", rc, kErrName(rc));
    131134    if (TestMemComp(pvBits2, pvBits, cbImage))
    132135        return Failure("relocation test failed, mismatching bits (b)");
     
    138141    rc = kLdrModRelocateBits(pMod, pvBits, 0x1000000, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    139142    if (rc)
    140         return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kLdrErrStr(rc));
     143        return Failure("failed to relocate, rc=%d (%s) (c1)", rc, kErrName(rc));
    141144    memset(pvBits2, 0xfe, cbImage);
    142145    rc = kLdrModGetBits(pMod, pvBits2, 0x1000000, BasicTestsGetImport, NULL);
    143146    if (rc)
    144         return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, kLdrErrStr(rc));
     147        return Failure("failed to get image bits, rc=%d (%s) (c1)", rc, kErrName(rc));
    145148    if (TestMemComp(pvBits2, pvBits, cbImage))
    146149        return Failure("relocation test failed, mismatching bits (c1)");
     
    149152    rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0x1010000, 0x1000000, BasicTestsGetImport, NULL);
    150153    if (rc)
    151         return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kLdrErrStr(rc));
     154        return Failure("failed to relocate, rc=%d (%s) (c2)", rc, kErrName(rc));
    152155    memset(pvBits2, 0xef, cbImage);
    153156    rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL);
    154157    if (rc)
    155         return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kLdrErrStr(rc));
     158        return Failure("failed to get image bits, rc=%d (%s) (c2)", rc, kErrName(rc));
    156159    if (TestMemComp(pvBits2, pvBits, cbImage))
    157160        return Failure("relocation test failed, mismatching bits (c2)");
     
    160163    rc = kLdrModRelocateBits(pMod, pvBits, MY_BASEADDRESS, ~(KUPTR)0x1010000, BasicTestsGetImport, NULL);
    161164    if (rc)
    162         return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kLdrErrStr(rc));
     165        return Failure("failed to relocate, rc=%d (%s) (c3)", rc, kErrName(rc));
    163166    memset(pvBits2, 0xef, cbImage);
    164167    rc = kLdrModGetBits(pMod, pvBits2, MY_BASEADDRESS, BasicTestsGetImport, NULL);
    165168    if (rc)
    166         return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, kLdrErrStr(rc));
     169        return Failure("failed to get image bits, rc=%d (%s) (c3)", rc, kErrName(rc));
    167170    if (TestMemComp(pvBits2, pvBits, cbImage))
    168171        return Failure("relocation test failed, mismatching bits (c3)");
     
    171174    rc = kLdrModRelocateBits(pMod, pvBits, ~(KUPTR)0 / 2 - 0x10000, MY_BASEADDRESS, BasicTestsGetImport, NULL);
    172175    if (rc)
    173         return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kLdrErrStr(rc));
     176        return Failure("failed to relocate, rc=%d %(s) (c4)", rc, kErrName(rc));
    174177    memset(pvBits2, 0xdc, cbImage);
    175178    rc = kLdrModGetBits(pMod, pvBits2, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL);
    176179    if (rc)
    177         return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kLdrErrStr(rc));
     180        return Failure("failed to get image bits, rc=%d (%s) (c4)", rc, kErrName(rc));
    178181    if (TestMemComp(pvBits2, pvBits, cbImage))
    179182        return Failure("relocation test failed, mismatching bits (c4)");
     
    182185    rc = kLdrModRelocateBits(pMod, pvBits, (KUPTR)pvBits, ~(KUPTR)0 / 2 - 0x10000, BasicTestsGetImport, NULL);
    183186    if (rc)
    184         return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kLdrErrStr(rc));
     187        return Failure("failed to relocate, rc=%d (%s) (c5)", rc, kErrName(rc));
    185188    memset(pvBits2, 0xcd, cbImage);
    186189    rc = kLdrModGetBits(pMod, pvBits2, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    187190    if (rc)
    188         return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kLdrErrStr(rc));
     191        return Failure("failed to get image bits, rc=%d (%s) (c5)", rc, kErrName(rc));
    189192    if (TestMemComp(pvBits2, pvBits, cbImage))
    190193        return Failure("relocation test failed, mismatching bits (c5)");
     
    217220                                &uValue2, &fKind2);
    218221        if (rc)
    219             return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kLdrErrStr(rc));
     222            return Failure("Couldn't find symbol %#x (%.*s) by ordinal. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc));
    220223        if (uValue != uValue2)
    221224            return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/ord)  pvBits=%p",
     
    233236                                NULL, NULL, &uValue2, &fKind2);
    234237        if (rc)
    235             return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kLdrErrStr(rc));
     238            return Failure("Couldn't find symbol %#x (%.*s) by name. rc=%d (%s)", iSymbol, cchSymbol, pchSymbol, rc, kErrName(rc));
    236239        if (uValue != uValue2)
    237240            return Failure("Symbol %#x (%.*s): Value mismatch %016" PRI_KLDRADDR " != %016" PRI_KLDRADDR " (enum!=query/name) pvBits=%p",
     
    294297        rc = kLdrModGetImport(pMod, pvBits, i, szImportModule, sizeof(szImportModule));
    295298        if (rc)
    296             return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, kLdrErrStr(rc), szImportModule);
     299            return Failure("failed to get import module name, rc=%d (%s). (%.260s)", rc, kErrName(rc), szImportModule);
    297300        printf("import #%d: '%s'\n", i, szImportModule);
    298301    }
     
    307310    rc = kLdrModGetStackInfo(pMod, pvBits, MY_BASEADDRESS, &StackInfo);
    308311    if (rc)
    309         return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     312        return Failure("kLdrModGetStackInfo failed with rc=%d (%s)", rc, kErrName(rc));
    310313    printf("Stack: Address=%016" PRI_KLDRADDR "   LinkAddress=%016" PRI_KLDRADDR "\n"
    311314           "       cbStack=%016" PRI_KLDRSIZE " cbStackThread=%016" PRI_KLDRSIZE "\n",
     
    326329    rc = kLdrModQueryMainEntrypoint(pMod, pvBits, MY_BASEADDRESS, &MainEPAddress);
    327330    if (rc)
    328         return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     331        return Failure("kLdrModQueryMainEntrypoint failed with rc=%d (%s)", rc, kErrName(rc));
    329332    printf("Entrypoint: %016" PRI_KLDRADDR "\n", MainEPAddress);
    330333    if (MainEPAddress == ~(KLDRADDR)42)
     
    344347        printf("NO Debugger Information\n");
    345348    else
    346         return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     349        return Failure("kLdrModHasDbgInfo failed with rc=%d (%s)", rc, kErrName(rc));
    347350    rc = kLdrModEnumDbgInfo(pMod, pvBits, BasicTestEnumDbgInfoCallback, NULL);
    348351    if (rc)
    349         return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     352        return Failure("kLdrModEnumDbgInfo failed with rc=%d (%s)", rc, kErrName(rc));
    350353
    351354
     
    379382    rc = kLdrModEnumSymbols(pMod, pvBits, MY_BASEADDRESS, 0, BasicTestsEnumSymCallback, pvBits);
    380383    if (rc)
    381         return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, kLdrErrStr(rc));
     384        return Failure("kLdrModEnumSymbols failed with rc=%d (%s)", rc, kErrName(rc));
    382385
    383386
     
    488491    rc = kLdrModGetBits(pMod, pvBits, (KUPTR)pvBits, BasicTestsGetImport, NULL);
    489492    if (rc)
    490         return Failure("failed to get image bits, rc=%d (%s)", rc, kLdrErrStr(rc));
     493        return Failure("failed to get image bits, rc=%d (%s)", rc, kErrName(rc));
    491494
    492495    /*
     
    523526    rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL);
    524527    if (rc)
    525         return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     528        return Failure("kLdrModFixupMapping (a) failed, rc=%d (%s)", rc, kErrName(rc));
    526529
    527530    rc = kLdrModReload(pMod);
    528531    if (rc)
    529         return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     532        return Failure("kLdrModReload (a) failed, rc=%d (%s)", rc, kErrName(rc));
    530533
    531534    rc = kLdrModReload(pMod);
    532535    if (rc)
    533         return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     536        return Failure("kLdrModReload (b) failed, rc=%d (%s)", rc, kErrName(rc));
    534537
    535538    rc = kLdrModFixupMapping(pMod, BasicTestsGetImport, NULL);
    536539    if (rc)
    537         return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     540        return Failure("kLdrModFixupMapping (b) failed, rc=%d (%s)", rc, kErrName(rc));
    538541
    539542    rc = kLdrModAllocTLS(pMod);
    540543    if (rc)
    541         return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     544        return Failure("kLdrModAllocTLS (a) failed, rc=%d (%s)", rc, kErrName(rc));
    542545    kLdrModFreeTLS(pMod);
    543546
    544547    rc = kLdrModAllocTLS(pMod);
    545548    if (rc)
    546         return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     549        return Failure("kLdrModAllocTLS (b) failed, rc=%d (%s)", rc, kErrName(rc));
    547550    kLdrModFreeTLS(pMod);
    548551
     
    553556    rc = BasicTestsSub2(pMod, NULL);
    554557    if (rc)
    555         return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     558        return Failure("BasicTestsSub2 in Map2 failed, rc=%d (%s)", rc, kErrName(rc));
    556559    return 0;
    557560}
     
    568571    rc = kLdrModMap(pMod);
    569572    if (rc)
    570         return Failure("kLdrModMap failed, rc=%d (%s)", rc, kLdrErrStr(rc));
     573        return Failure("kLdrModMap failed, rc=%d (%s)", rc, kErrName(rc));
    571574    rc = BasicTestsSubMap2(pMod);
    572575    rc2 = kLdrModUnmap(pMod);
    573576    if (rc2)
    574577    {
    575         Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, kLdrErrStr(rc2));
     578        Failure("kLdrModUnmap failed, rc=%d (%s)", rc2, kErrName(rc2));
    576579        rc = rc ? rc : rc2;
    577580    }
     
    601604        rc2 = kLdrModClose(pMod);
    602605        if (rc2)
    603             Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, kLdrErrStr(rc));
     606            Failure("failed to close '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc));
    604607        if (rc2 && !rc)
    605608            rc = rc2;
    606609    }
    607610    else
    608         Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, kLdrErrStr(rc));
     611        Failure("Failed to open '%s', rc=%d (%s)", pszFilename, rc, kErrName(rc));
    609612    return rc ? 1 : 0;
    610613}
Note: See TracChangeset for help on using the changeset viewer.