-IsStoreAvailable() Functionality

This commit is contained in:
lsreevatsa
2006-03-08 13:11:43 +00:00
parent 8d6c6a44b9
commit b84d53afb8
4 changed files with 246 additions and 61 deletions

View File

@@ -391,6 +391,75 @@ HMODULE libtmp = NULL;
return libtmp;
}
//
// Checks if store is available...
//
int ProfileManager::IsStoreAvailable()
{
PrintMessage(MESG_DEBUG, "\n IsStoreAvailable : Checking if firefox and its libraries are present ");
libraryPath = GetFirefoxLibPath();
if( !libraryPath )
{
PrintMessage(MESG_ERROR, "\n IsStoreAvailable : Failed to find firefox profile or library path ");
return FPM_FALSE;
}
// First try to load from the library path then try to load from default lib path
// Here we have to first load all dependent libraries and then
// load main library , otherwise face the problems...:)
if( PMLoadLibrary(libraryPath, NSPR_LIBRARY_NAME) )
{
if((libplc=PMLoadLibrary(libraryPath, PLC_LIBRARY_NAME)) )
{
if( PMLoadLibrary(libraryPath, PLDS_LIBRARY_NAME) )
{
if( PMLoadLibrary(libraryPath, SOFTN_LIBRARY_NAME) )
libnss=PMLoadLibrary(libraryPath, NSS_LIBRARY_NAME);
}
}
}
else // try to load library from default library path
{
if( PMLoadLibrary(NULL, NSPR_LIBRARY_NAME) )
{
if((libplc=PMLoadLibrary(NULL, PLC_LIBRARY_NAME)) )
{
if( PMLoadLibrary(NULL, PLDS_LIBRARY_NAME) )
{
if( PMLoadLibrary(NULL, SOFTN_LIBRARY_NAME) )
libnss=PMLoadLibrary(NULL, NSS_LIBRARY_NAME);
}
}
}
}
if( !libnss || !libplc )
{
PrintMessage(MESG_ERROR, "\n IsStoreAvailable : Failed to load the required firefox library");
return FPM_FALSE;
}
// Free the library
if( libnss != NULL )
{
PrintMessage(MESG_DEBUG, "\n IsStoreAvailable : Freeing library libnss.dll");
FREELIBRARY(libnss);
}
if( libplc != NULL )
{
PrintMessage(MESG_DEBUG, "\n IsStoreAvailable : Freeing library libplc.dll");
FREELIBRARY(libplc);
}
return FPM_TRUE;
}