Subject: RE: CPP API Problem
Its a dll so the following are the first two methods. The firstis the open method and the second one is trying to get the
database list. The second method fails on the NSFDBOpen
call.
JNIEXPORT void JNICALL Java_Notes_Open
(JNIEnv *env, jobject obj)
{
STATUS error = NOERROR;
char ** args = (char **)malloc(2);
// get the ini file to use from the registry.
// Need to have an argument list of two arguments
// because the api is normally called by passing in
// argc and argv where argv[0] is the executable
// and argv[1] is the ini file.
args[0] = getRegistryValue
("SOFTWARE\\JavaSoft\\Prefs\\astis\\nid", "notesini");
args[1] = args[0];
// Initialise notes environment.
error = NotesInitExtended( 2, args );
// If notes has not been initialised
if ( error )
{
DWORD dw = GetLastError();
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL, dw, MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL );
log(false, (char *)lpMsgBuf);
ThrowNotesException(env, error, "NotesInitExtended", 0 );
return;
}
}
void ReadServerDBs(struct ServerSearch *searchInfo )
{
// Path to the server data directory
char serverPath[MAXPATH];
// Handle to the database data directory
DBHANDLE dataPath;
// Operation result of NOTES commands
STATUS error = NOERROR;
// Compose the full network pathname to the directory
error = OSPathNetConstruct(NULL, searchInfo->server,
searchInfo->path, serverPath);
if ( error )
{
ThrowNotesException( searchInfo->env,
error, "OSPathNetConstruct", searchInfo->path );
return;
}
// Open the directory.
error = NSFDbOpen (serverPath, &dataPath);
if ( error )
{
ThrowNotesException( searchInfo->env,
error, "NSFDbOpen", serverPath );
return;
}
…
TIA
Vlad