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/kFileDef.cpp

    r4804 r5531  
    2929#include "kFile.h"
    3030#include "kFileFormatBase.h"
     31#include "kInterfaces.h"
    3132#include "kFileDef.h"
     33
     34/*******************************************************************************
     35*   Global Variables                                                           *
     36*******************************************************************************/
     37#if 0
     38static kFileDef tst((kFile*)NULL);
     39#endif
    3240
    3341
     
    522530/**
    523531 * Query for the module name.
    524  * @returns   Success indicator. TRUE / FALSE.
    525  * @param     pszBuffer  Pointer to buffer which to put the name into.
    526  */
    527 BOOL  kFileDef::queryModuleName(char *pszBuffer)
    528 {
     532 * @returns Success indicator. TRUE / FALSE.
     533 * @param   pszBuffer   Pointer to buffer which to put the name into.
     534 * @param   cchBuffer   Size of the buffer (defaults to 260 chars).
     535 */
     536BOOL  kFileDef::moduleGetName(char *pszBuffer, int cchSize/* = 260*/)
     537{
     538    int cch;
    529539    if (pszModName == NULL)
    530540        return FALSE;
    531541
    532     strcpy(pszBuffer, pszModName);
     542    cch = strlen(pszModName) + 1;
     543    if (cch > cchSize)
     544        return FALSE;
     545    memcpy(pszBuffer, pszModName, cch);
    533546
    534547    return TRUE;
     
    540553 * @returns   Success indicator. TRUE / FALSE.
    541554 * @param     pExport  Pointer to export structure.
    542  * @remark
    543  */
    544 BOOL  kFileDef::findFirstExport(PEXPORTENTRY pExport)
     555 */
     556BOOL  kFileDef::exportFindFirst(kExportEntry *pExport)
    545557{
    546558    if (pExports != NULL && pExport != NULL)
    547559    {
    548560        pExport->ulOrdinal = pExports->ulOrdinal;
     561        pExport->achName[0] = '\0';
    549562        if (pExports->pszName != NULL)
    550563            strcpy(&pExport->achName[0], pExports->pszName);
    551         else
    552             pExport->achName[0] = '\0';
     564
     565        pExport->achIntName[0] = '\0';
    553566        if (pExports->pszIntName)
    554567            strcpy(&pExport->achIntName[0], pExports->pszIntName);
    555         else
    556             pExport->achIntName[0] = '\0';
     568
     569        pExport->ulAddress = pExport->iObject = pExport->ulOffset = ~0UL;
    557570        pExport->pv = (void*)pExports->pNext;
    558571    }
     
    567580 * @returns   Success indicator. TRUE / FALSE.
    568581 * @param     pExport  Pointer to export structure.
    569  * @remark
    570  */
    571 BOOL  kFileDef::findNextExport(PEXPORTENTRY pExport)
     582 */
     583BOOL  kFileDef::exportFindNext(kExportEntry *pExport)
    572584{
    573585    if (pExport != NULL && pExport->pv != NULL)
     
    576588
    577589        pExport->ulOrdinal = pExp->ulOrdinal;
     590        pExport->achName[0] = '\0';
    578591        if (pExp->pszName != NULL)
    579592            strcpy(&pExport->achName[0], pExp->pszName);
    580         else
    581             pExport->achName[0] = '\0';
     593        pExport->achIntName[0] = '\0';
    582594        if (pExp->pszIntName)
    583595            strcpy(&pExport->achIntName[0], pExp->pszIntName);
    584         else
    585             pExport->achIntName[0] = '\0';
     596        pExport->ulAddress = pExport->iObject = pExport->ulOffset = ~0UL;
    586597        pExport->pv = (void*)pExp->pNext;
    587598    }
     
    589600        return FALSE;
    590601    return TRUE;
     602}
     603
     604
     605/**
     606 * Frees resources associated with the communicatin area.
     607 * It's not necessary to call this when exportFindNext has return FALSE.
     608 * (We don't allocate anything so it's not a problem ;-)
     609 * @param   pExport     Communication area which has been successfully
     610 *                      processed by findFirstExport.
     611 */
     612void kFileDef::exportFindClose(kExportEntry *pExport)
     613{
     614    pExport = pExport;
     615    return;
     616}
     617
     618
     619/**
     620 * Lookup information on a spesific export given by ordinal number.
     621 * @returns Success indicator.
     622 * @param   pExport     Communication area containing export information
     623 *                      on successful return.
     624 * @remark  stub
     625 */
     626BOOL kFileDef::exportLookup(unsigned long ulOrdinal, kExportEntry *pExport)
     627{
     628    assert(!"not implemented.");
     629    ulOrdinal = ulOrdinal;
     630    pExport = pExport;
     631    return FALSE;
     632}
     633
     634/**
     635 * Lookup information on a spesific export given by name.
     636 * @returns Success indicator.
     637 * @param   pExport     Communication area containing export information
     638 *                      on successful return.
     639 * @remark  stub
     640 */
     641BOOL kFileDef::exportLookup(const char *  pszName, kExportEntry *pExport)
     642{
     643    assert(!"not implemented.");
     644    pszName = pszName;
     645    pExport = pExport;
     646    return FALSE;
    591647}
    592648
Note: See TracChangeset for help on using the changeset viewer.