Re: [OpenSIPStack] RegistrationDatabase and user rights in Windows
Brought to you by:
joegenbaclor
From: Joegen E. B. <joe...@gm...> - 2007-12-04 16:11:23
|
Good suggestion. I think the best place to put this code is as a static method in OSSApplication. Something like OSSApplication::CreateUserFolder() with similar behavior in linux and window. For linux, it would be create in the $(HOME) directory. For windows, it would be Document and Settings. Aside from the registry folder, we have the logs and CALEA folders that are also dynamically created by OpenSBC. A central function would benefit these two as well. Would you be able to patch OSSApplicaiton with this method and behave the same way in linux and windows? I will be glad to add it as your contribution. H.Kropf wrote: > 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 > } > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: The Future of Linux Business White Paper > from Novell. From the desktop to the data center, Linux is going > mainstream. Let it simplify your IT future. > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > _______________________________________________ > opensipstack-devel mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensipstack-devel > > > |