Ignore:
Timestamp:
Apr 17, 2001, 2:26:28 AM (24 years ago)
Author:
bird
Message:

Second iteration of the kFile* classes and interfaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/common/kFileLX.cpp

    r5053 r5531  
    1 /* $Id: kFileLX.cpp,v 1.4 2001-02-02 08:45:41 bird Exp $
     1/* $Id: kFileLX.cpp,v 1.5 2001-04-17 00:26:11 bird Exp $
    22 *
    33 *
     
    6464
    6565
    66 
     66/*******************************************************************************
     67*   Global Variables                                                           *
     68*******************************************************************************/
     69#if 0
     70static kFileLX tst((kFile*)NULL);
     71#endif
     72
     73
     74/**
     75 * Internal worker which lookup the name corresponding to an ordinal.
     76 * @returns Success indicator.
     77 * @param   iOrdinal ( >= 0).
     78 * @param   pszBuffer.
     79 */
    6780BOOL kFileLX::queryExportName(int iOrdinal, char *pszBuffer)
    6881{
     
    119132
    120133    /* create filemapping */
    121     pvBase = kFileFormatBase::readfile(pszFilename);
     134    pvBase = kFile::readFile(pszFilename);
    122135    if (pvBase == NULL)
    123136        throw(1);
     
    192205
    193206
    194 BOOL kFileLX::queryModuleName(char *pszBuffer)
     207/**
     208 * Query for the module name.
     209 * @returns Success indicator. TRUE / FALSE.
     210 * @param   pszBuffer   Pointer to buffer which to put the name into.
     211 * @param   cchBuffer   Size of the buffer (defaults to 260 chars).
     212 */
     213BOOL kFileLX::moduleGetName(char *pszBuffer, int cchBuffer/*= 260*/)
    195214{
    196215    /* The module name is the 0 ordinal entry in resident name table */
     216    assert(cchBuffer >= 255);
    197217    return queryExportName(0, pszBuffer);
    198218}
    199219
    200220
    201 
    202 BOOL kFileLX::findFirstExport(PEXPORTENTRY pExport)
     221/**
     222 * Finds the first exports.
     223 * @returns   Success indicator. TRUE / FALSE.
     224 * @param     pExport  Pointer to export structure.
     225 */
     226BOOL kFileLX::exportFindFirst(kExportEntry *pExport)
    203227{
    204228    struct b32_bundle * pBundle = (struct b32_bundle*)((char*)pvBase + pe32->e32_enttab + offLXHdr);
     
    239263                {
    240264                    case ENTRY16:
    241                         pExport->offset = pEntry->e32_variant.e32_offset.offset16;
     265                        pExport->ulOffset = pEntry->e32_variant.e32_offset.offset16;
    242266                        break;
    243267
    244268                    case ENTRY32:
    245                         pExport->offset = pEntry->e32_variant.e32_offset.offset32;
     269                        pExport->ulOffset = pEntry->e32_variant.e32_offset.offset32;
    246270                        break;
    247271
    248272                    case GATE16:
    249                         pExport->offset = pEntry->e32_variant.e32_callgate.offset;
     273                        pExport->ulOffset = pEntry->e32_variant.e32_callgate.offset;
    250274                        break;
    251275                    default:
     
    260284                pExpState->pe32     = pEntry;
    261285                pExpState->iOrdinal = iOrdinal;
     286                pExport->ulAddress = ~0UL; /* TODO */
    262287                return TRUE;
    263288            }
     
    270295
    271296
    272 
    273 BOOL kFileLX::findNextExport(PEXPORTENTRY pExport)
     297/**
     298 * Finds the next export.
     299 * @returns   Success indicator. TRUE / FALSE.
     300 * @param     pExport  Pointer to export structure.
     301 */
     302BOOL kFileLX::exportFindNext(kExportEntry *pExport)
    274303{
    275304    static int      acbEntry[] =
     
    283312
    284313    PEXPSTATE pExpState = (PEXPSTATE)pExport->pv;
     314    pExport->ulAddress = ~0UL; /* TODO */
    285315
    286316    /*
     
    303333            pExport->achName[0] = '\0';
    304334
    305         /* offset */
     335        /* ulOffset */
    306336        switch (pExpState->pb32->b32_type & ~TYPEINFO)
    307337        {
    308338            case ENTRY16:
    309                 pExport->offset = pExpState->pe32->e32_variant.e32_offset.offset16;
     339                pExport->ulOffset = pExpState->pe32->e32_variant.e32_offset.offset16;
    310340                break;
    311341
    312342            case ENTRY32:
    313                 pExport->offset = pExpState->pe32->e32_variant.e32_offset.offset32;
     343                pExport->ulOffset = pExpState->pe32->e32_variant.e32_offset.offset32;
    314344                break;
    315345
    316346            case GATE16:
    317                 pExport->offset = pExpState->pe32->e32_variant.e32_callgate.offset;
     347                pExport->ulOffset = pExpState->pe32->e32_variant.e32_callgate.offset;
    318348                break;
    319349        }
     
    360390            {
    361391                case ENTRY16:
    362                     pExport->offset = pExpState->pe32->e32_variant.e32_offset.offset16;
     392                    pExport->ulOffset = pExpState->pe32->e32_variant.e32_offset.offset16;
    363393                    break;
    364394
    365395                case ENTRY32:
    366                     pExport->offset = pExpState->pe32->e32_variant.e32_offset.offset32;
     396                    pExport->ulOffset = pExpState->pe32->e32_variant.e32_offset.offset32;
    367397                    break;
    368398
    369399                case GATE16:
    370                     pExport->offset = pExpState->pe32->e32_variant.e32_callgate.offset;
     400                    pExport->ulOffset = pExpState->pe32->e32_variant.e32_callgate.offset;
    371401                    break;
    372402                default:
     
    384414    free(pExport->pv);
    385415    pExport->pv = NULL;
     416    return FALSE;
     417}
     418
     419
     420/**
     421 * Frees resources associated with the communicatin area.
     422 * It's not necessary to call this when exportFindNext has return FALSE.
     423 * @param   pExport     Communication area which has been successfully
     424 *                      processed by findFirstExport.
     425 */
     426void kFileLX::exportFindClose(kExportEntry *pExport)
     427{
     428    free(pExport->pv);
     429    pExport->pv = NULL;
     430    return;
     431}
     432
     433
     434/**
     435 * Lookup information on a spesific export given by ordinal number.
     436 * @returns Success indicator.
     437 * @param   pExport     Communication area containing export information
     438 *                      on successful return.
     439 * @remark  stub
     440 */
     441BOOL kFileLX::exportLookup(unsigned long ulOrdinal, kExportEntry *pExport)
     442{
     443    assert(!"not implemented.");
     444    ulOrdinal = ulOrdinal;
     445    pExport = pExport;
     446    return FALSE;
     447}
     448
     449/**
     450 * Lookup information on a spesific export given by name.
     451 * @returns Success indicator.
     452 * @param   pExport     Communication area containing export information
     453 *                      on successful return.
     454 * @remark  stub
     455 */
     456BOOL kFileLX::exportLookup(const char *  pszName, kExportEntry *pExport)
     457{
     458    assert(!"not implemented.");
     459    pszName = pszName;
     460    pExport = pExport;
    386461    return FALSE;
    387462}
Note: See TracChangeset for help on using the changeset viewer.