Ignore:
Timestamp:
Jul 21, 2000, 11:09:45 PM (25 years ago)
Author:
bird
Message:

Corrections and handling of the updated field in function and file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/database/APIImport.cpp

    r2789 r3882  
    1 /* $Id: APIImport.cpp,v 1.5 2000-02-15 13:31:05 bird Exp $ */
     1/* $Id: APIImport.cpp,v 1.6 2000-07-21 21:09:42 bird Exp $ */
    22/*
    33 *
     
    6666    *           -u:<user>     Userid
    6767    *           -h:<host>     Hostname/IP-address
     68    *           -e[+|-]       Erase functions which wasn't found.
    6869    **************************************************************************/
    6970    if (argc == 1)
     
    8283                    else
    8384                        fprintf(stderr, "warning: option '-d:' requires database name.\n");
     85                    break;
     86
     87                case 'e': /* erase */
     88                case 'E':
     89                    options.fErase = argv[argi][2] != '-';
    8490                    break;
    8591
     
    177183           "    -p:<password> Password.                     default: <empty>\n"
    178184           "    -d:<database> Database to use.              default: Odin32\n"
     185           "    -e[+|-]       Erase functions which wasn't found.\n"
     186           "                                                default: -e-\n"
    179187           "    dll/defnames  List of DLL/Defs to process.\n"
    180188           "\n"
     
    188196           "\t2) function name\n"
    189197           "\t3) function ordinal (If not option 'o-' is specified.)\n"
    190            "This utililty is not destructive but additive. That is, it would not remove any\n"
    191            "rows in the database, only add or update them. On existing functions the\n"
    192            "ordinal value will be updated when 'o+' is specified.\n"
    193198           "\n"
    194            "Copyright (c) 1999 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)",
     199           "Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)",
    195200           MAJOR_VER, MINOR_VER
    196201           );
     
    248253            char    achDataBuffer[0x200];
    249254            char   *pszModuleName = &achDataBuffer[0];
    250             signed short  sDll;
     255            signed long  lDll;
    251256
    252257            /* try create file objects */
     
    271276
    272277                /* find or insert module name */
    273                 if ((sDll = dbCheckInsertDll(pszModuleName)) >= 0)
     278                if ((lDll = dbCheckInsertDll(pszModuleName, DLL_ODIN32_API)) >= 0)
    274279                {
    275                     BOOL   fOk;
     280                    BOOL    fClearUpdateOk = FALSE;
     281                    BOOL    fOk;
    276282                    EXPORTENTRY export;
     283
     284                    /* Clear the update flag for all functions in this DLL. */
     285                    if (pOptions->fErase)
     286                        fClearUpdateOk = dbClearUpdateFlagFunction(lDll, FALSE);
    277287
    278288                    lRc = 0;
     
    313323                            }
    314324                            else
    315                             {
    316                                 fOk = dbInsertUpdateFunction(sDll,
     325                            {   /* Update Database */
     326                                fOk = dbInsertUpdateFunction(lDll,
    317327                                                             &szName[0],
    318328                                                             &szIntName[0],
    319329                                                             export.ulOrdinal,
    320                                                              pOptions->fIgnoreOrdinals && export.ulOrdinal != 0xffffffffUL);
     330                                                             pOptions->fIgnoreOrdinals && export.ulOrdinal != 0xffffffffUL,
     331                                                             FUNCTION_ODIN32_API
     332                                                             );
    321333                                if (fOk)
    322334                                    cFunctions++;
     335                                else
     336                                {
     337                                    fprintf(phLog, "%s: error - dbInsertUpdateFunction failed.\n\terror description: %s \n",
     338                                            pszFilename, dbGetLastErrorDesc());
     339                                    lRc++;
     340                                }
    323341                            }
    324                         }
    325 
    326                         if (!fOk)
    327                         {
    328                             fprintf(phLog, "%s: error - dbInsertUpdateFunction failed.\n\terror description: %s \n",
    329                                     pszFilename, dbGetLastErrorDesc());
    330                             lRc = 1;
    331342                        }
    332343
     
    335346                    }
    336347
     348                    /* Clear the update flag for all functions in this DLL. */
     349                    if (fClearUpdateOk && pOptions->fErase)
     350                        if (!dbDeleteNotUpdatedFunctions(lDll, FALSE))
     351                        {
     352                            fprintf(phLog, "%s: error - dbDeleteNotUpdatedFunctions failed.\n\terror description: %s\n",
     353                                    pszFilename, dbGetLastErrorDesc());
     354                            lRc += 1;
     355                        }
    337356                }
    338357                else
Note: See TracChangeset for help on using the changeset viewer.