Problem adding aliases to IDAPI 16-Bit (Resend)

I am having a problem with adding aliases to IDAPI. For discussion sake
assume that we are working with 16-Bit IDAPI and the full path of the
configuration file is C:\IDAPI\IDAPI.CFG. What seems to be happening is
there is a copy of IDAPI.CFG on disk and there is a copy of IDAPI.CFG in
memory. The problem is that the two copies do not always match. Follow the
procedure below to duplicate the problem:

1. Start up BDECFG (Borland 16-Bit IDAPI configuration program).

2. Create a new alias called JUNK

3. Save the configuration and exit BDECFG

4. Start up BDECFG and verify that JUNK is still there and then close

5. Execute my little test application. My app will add two aliases
(MYALIAS1 & MYALIAS2). The code for it is listed at the end of this note.
You will notice
that it is pretty simple. The first loop searches for existence of MYALIAS1
& MYALIAS2. If either is found they are deleted. After that, MYALIAS1 &
MYALIAS2 are added back in.

6. Start up BDECFG and view the aliases. You will notice that JUNK is

What seems to have happened is that the copy of IDAPI.CFG in memory (i.e.
the copy that my test application was working with for this session) did not
know anything about JUNK in the first place (i.e. it does not match what
is on disk). Thus when my test application was executed, it overwrote
IDAPI.CFG on disk with IDAPI.CFG in memory.  As a result, the JUNK alias
gets lost.

I need a way of telling my test application to get a fresh copy of IDAPI.CFG
from disk. That way, I am sure no aliases will get removed.

Can anyone offer some advice on this matter?
Thank You,

Below is a copy of the source for my test application:

int main()
hDBICur hCur;
CURProps TblProps; // Table properties
pBYTE pRecBuf; // Record buffer
DBINAME szDatabase; // String to contain the driver name
BOOL bIsBlank; // Is the field blank?
DBDesc dbDesc; // Database descriptor



CHKERR(DbiGetCursorProps(hCur, &TblProps));

pRecBuf = (pBYTE) malloc(TblProps.iRecBufSize * sizeof(BYTE));
if (pRecBuf == NULL)
printf("Could not allocate memory","Error");



while (DbiGetNextRecord(hCur, dbiNOLOCK, pRecBuf, NULL) == DBIERR_NONE)
CHKERR(DbiGetField(hCur, 1, pRecBuf, (pBYTE) szDatabase, &bIsBlank));
CHKERR(DbiGetDatabaseDesc(szDatabase, &dbDesc));
// Display the information about the database.
if ((strcmp(dbDesc.szName,"MYALIAS1")==0) ||
DbiDeleteAlias(NULL, dbDesc.szName);


// Clean up.


return 0;