Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

static const KU8 * kldrModLXDoNameTableLookupByName ( const KU8 *  pbNameTable,
KI32  cbNameTable,
const char *  pchSymbol,
KSIZE  cchSymbol 
) [static]

Lookup a name table entry by name.

Returns:
Pointer to the name table entry if found.

NULL if not found.

Parameters:
pbNameTable Pointer to the name table that should be searched.
cbNameTable The size of the name table.
pchSymbol The name of the symbol we're looking for.
cchSymbol The length of the symbol name.

Definition at line 783 of file kLdrModLX.c.

References NULL.

Referenced by kldrModLXDoNameLookup().

{
    /*
     * Determin the namelength up front so we can skip anything which doesn't matches the length.
     */
    KU8 cbSymbol8Bit = (KU8)cchSymbol;
    if (cbSymbol8Bit != cchSymbol)
        return NULL; /* too long. */

    /*
     * Walk the name table.
     */
    while (*pbNameTable != 0 && cbNameTable > 0)
    {
        const KU8 cbName = *pbNameTable;

        cbNameTable -= cbName + 1 + 2;
        if (cbNameTable < 0)
            break;

        if (    cbName == cbSymbol8Bit
            &&  !kHlpMemComp(pbNameTable + 1, pchSymbol, cbName))
            return pbNameTable;

        /* next entry */
        pbNameTable += cbName + 1 + 2;
    }

    return NULL;
}


Generated by  Doxygen 1.6.0   Back to index