Exemplo n.º 1
0
unsigned        DIGENTRY DIPImpModName( imp_image_handle *ii,
                        imp_mod_handle im, char *buff, unsigned buff_size )
{
    cv_directory_entry  *cde;
    cv_sst_module       *mp;
    const char          *name;
    const char          *start;
    const char          *end;
    unsigned            len;

    if( im == IMH_GBL ) {
        return( NameCopy( buff, GBL_NAME, buff_size, sizeof( GBL_NAME ) - 1 ) );
    }
    cde = FindDirEntry( ii, im, sstModule );

    mp = VMBlock( ii, cde->lfo, cde->cb );
    if( mp == NULL ) return( 0 );
    name = (char *)&mp->SegInfo[mp->cSeg];
    len = *(unsigned_8 *)name;
    ++name;
    start = name;
    end = name + len;
    for( ; len != 0; ) {
        if( IS_PATH_CHAR( *name ) ) {
            start = name + 1;
            end = name + len;
        }
        if( *name == EXT_CHAR )
            end = name;
        ++name;
        --len;
    }
    return( NameCopy( buff, start, buff_size, end - start ) );
}
Exemplo n.º 2
0
size_t DIPIMPENTRY( ModName )( imp_image_handle *ii, imp_mod_handle im,
                                char *buff, size_t buff_size )
{
    char        *name;
    char        *start;
    char        *end;
    size_t      len;

    name = ModPointer( ii, im )->name;
    len = (unsigned char)name[0];
    if( len == 0 ) {
        *buff = '\0';
        return( 0 );
    }
    start = name + len;
    ++name;
    end = start + 1;
    if( *start == ')' ) {
        /* library member */
        --end;
        for( ;; ) {
            --start;
            if( *start == '(' ) {
                break;
            }
        }
        ++start;
    } else {
        /* file name */
        start = name;
        for( ; len > 0; --len ) {
            if( IS_PATH_CHAR( *name ) ) {
                start = name + 1;
                end = name + len;
            }
            if( *name == EXT_CHAR )
                end = name;
            ++name;
        }
    }
    len = end - start;
    if( buff_size > 0 ) {
        --buff_size;
        if( buff_size > len )
            buff_size = len;
        memcpy( buff, start, buff_size );
        buff[buff_size] = '\0';
    }
    return( len );
}
Exemplo n.º 3
0
unsigned DIPENTRY DIPImpModName( imp_image_handle *ii, imp_mod_handle im,
                                char *buff, unsigned max )
{
    char        *name;
    char        *start;
    char        *end;
    unsigned    len;


    name = ModPointer( ii, im )->name;
    len = name[0];
    if( len == 0 ) {
        *buff = '\0';
        return( 0 );
    }
    start = &name[ len ];
    ++name;
    end = start + 1;
    if( *start == ')' ) {
        /* library member */
        --end;
        for( ;; ) {
            --start;
            if( *start == '(' ) break;
        }
        ++start;
    } else {
        /* file name */
        start = name;
        for( ;; ) {
            if( len == 0 ) break;
            if( IS_PATH_CHAR( *name ) ) {
                start = name + 1;
                end = name + len;
            }
            if( *name == EXT_CHAR ) end = name;
            ++name;
            --len;
        }
    }
    len = end - start;
    if( max > 0 ) {
        --max;
        if( max > len ) max = len;
        memcpy( buff, start, max );
        buff[ max ] = '\0';
    }
    return( len );
}
Exemplo n.º 4
0
static void GetModName( char *path, char *buff )
/**********************************************/
/* find the module name from the path         */
/**********************************************/
{
    char    *start;
    char    *end;
    int     ext_found;

    start = end = path;
    ext_found = FALSE;
    while( *path != '\0' ) {
        if( IS_PATH_CHAR( *path ) ) {
            start = path+1;
        } else if( *path == EXT_CHAR ) {
            ext_found = TRUE;
            end = path;
        } else if( *path == '(' ) {
            start = path+1;
            while( *path != ')' )++path;
            end = path;
            ext_found = TRUE;
            goto do_copy;
        }
        ++path;
    }
    if( !ext_found ) {
        end = path;
    }
do_copy:
    while( start < end ) {
        *buff = *start;
        ++start;
        ++buff;
    }
    *buff = '\0';
}
Exemplo n.º 5
0
static void GetModName( const char *path, char *buff )
/****************************************************/
/* find the module name from the path         */
/**********************************************/
{
    const char  *start;
    const char  *end;
    bool        ext_found;

    start = end = path;
    ext_found = false;
    while( *path != '\0' ) {
        if( IS_PATH_CHAR( *path ) ) {
            start = path + 1;
        } else if( *path == EXT_CHAR ) {
            ext_found = true;
            end = path;
        } else if( *path == '(' ) {
            start = path + 1;
            while( *path != ')' )
                ++path;
            end = path;
            ext_found = true;
            goto do_copy;
        }
        ++path;
    }
    if( !ext_found ) {
        end = path;
    }
do_copy:
    while( start < end ) {
        *buff++ = *start++;
    }
    *buff = '\0';
}