Determine if a database is encrypted

Hi,

I’m trying to determine if a Lotus Notes database is encrypted. I noticed in the Lotus 6.5 C API that there’s a function called NSFDbIsLocallyEncrypted that can be used for this purpose. It seems that in order to call this function, you need to obtain a handle to the database using NSFDbOpen. However, when I call NSFDbOpen on an encrypted database, it fails (with return code 0x1902), preventing me from calling NSFDbIsLocallyEncrypted. Am I trying to use NSFDbIsLocallyEncrypted incorrectly? Is there another way to determine if a database is encrypted? Here’s a code snippet of what I’m doing:

const char* pszDatabase = “sample.nsf”;

DBHANDLE hDatabase;

STATUS lnStatus;

lnStatus = NSFDbOpen(pszDatabase, &hDatabase);

if (lnStatus == NOERROR) {

BOOL bIsEncrypted = FALSE;

lnStatus = NSFDbIsLocallyEncrypted(hDatabase, &bIsEncrypted);

if (lnStatus == NOERROR) {

  if (bIsEncrypted)

     MessageBox(NULL, "Database is encrypted!", "", MB_OK);

}

NSFDbClose(hDatabase);

}