BOOL CReg::SaveSettings(LPCTSTR pFile, LPCTSTR pBak) {_STTEX(); char cfg[ CWF_STRSIZE ]; char path[ CWF_STRSIZE ]; CWinFile::GetExePath( path ); BOOL saved = FALSE; // Save backup configuration if ( pBak != NULL ) { CWinFile::BuildPath( cfg, path, pBak ); saved = SaveRegFile( cfg ); } // end if // Save configuration if ( pFile != NULL ) { CWinFile::BuildPath( cfg, path, pFile ); saved = ( SaveRegFile( cfg ) || saved ); } // end if return TRUE; }
BOOL CReg::RestoreSettings(LPCTSTR pFile, LPCTSTR pBak, BOOL bSafety ) {_STTEX(); char cfg[ CWF_STRSIZE ]; char path[ CWF_STRSIZE ]; CWinFile::GetExePath( path ); BOOL loaded = FALSE; if ( pFile != NULL ) { // Load configuration CWinFile::BuildPath( cfg, path, "pFile" ); loaded = LoadRegFile( cfg ); // Set the safety if needed if ( bSafety ) { Set( "Settings", "RunTimes", (DWORD)1 ); SaveRegFile( cfg ); } // end if } // end if // Protect against file damage DWORD runs = 0; if ( pBak != NULL && ( !loaded || !Get( "Settings", "RunTimes", &runs ) ) ) { CWinFile::BuildPath( cfg, path, pBak ); loaded = LoadRegFile( cfg ); // Set the safety if needed if ( bSafety ) { Set( "Settings", "RunTimes", (DWORD)1 ); SaveRegFile( cfg ); } // end if } // end if return loaded; }
static int SetRegString_File( char *szRegName , char *szString ) { smREG_STRING *RegString = GetRegString_File( szRegName ); if ( RegString ) { //기존꺼 변경 lstrcpy( RegString->szRegString , szString ); } else { //신규 추가 lstrcpy( smRegBuff.RegString[ smRegBuff.nCount ].szRegPath , szRegName ); lstrcpy( smRegBuff.RegString[ smRegBuff.nCount ].szRegString , szString ); smRegBuff.nCount++; } SaveRegFile(); //파일로 저장 return TRUE; }
BOOL CReg::SaveRegFile(LPCTSTR pFile, LPCTSTR pKey, LPCTSTR pHeader) {_STTEX(); return SaveRegFile( CPFile( pFile, pKey, GENERIC_WRITE, TRUE ), pKey, pHeader ); }
BOOL CReg::SaveRegFile(CPipe &pipe, LPCTSTR pKey, LPCTSTR pHeader) {_STTEX(); return SaveRegFile( &pipe, pKey, pHeader ); }
DWORD CReg::Save(LPCTSTR pFile) {_STTEX(); return SaveRegFile( pFile ); }