[OpenSIPStack] RegistrationDatabase and user rights in Windows
Brought to you by:
joegenbaclor
From: H.Kropf <mai...@gl...> - 2007-12-04 14:36:04
|
I suggest to use the following code:for Win NT / 2k / XP //-------------------------------------------------------------------------- // uses c:\Documents and Settings\[User]\OSS\registry\ //-------------------------------------------------------------------------- char dir[MAX_PATH+1]; SecureZeroMemory(dir, sizeof(dir)); SHGetSpecialFolderPath(NULL, (LPSTR)dir, CSIDL_APPDATA, TRUE); PathAppend(dir, "OSS"); if( !PathFileExists( dir ) ) _mkdir((LPCSTR)dir); PathAppend(dir, "registry"); if( !PathFileExists( pb_path ) ) _mkdir(dir); //-------------------------------------------------------------------------- instead of //-------------------------------------------------------------------------- // uses c:\Program Files\[program name]\registry\ . Whether the user has the rights to create this folder here? //-------------------------------------------------------------------------- OString dir = PProcess::Current().GetFile().GetDirectory() + "registry"; if( !PFile::Exists( dir.c_str() ) ) PDirectory::Create( dir.c_str() ); //-------------------------------------------------------------------------- in //======== RegisterSessionManager.cxx ======== RegistrationDatabase::RegistrationDatabase() { #if HAS_CPPSQLITE m_HasContactRecovery = PrepareContactRecoveryDB( "ContactRecovery.sqlite" ); #else m_HasContactRecovery = TRUE; OString dir = PProcess::Current().GetFile().GetDirectory() + "registry"; if( !PFile::Exists( dir.c_str() ) ) PDirectory::Create( dir.c_str() ); m_RegRecoveryDIR = dir.c_str(); #endif } |