Windows CE.NET下注冊表相關(guān)技術(shù)
注:關(guān)于基于HIVE的注冊表的實現(xiàn),暫不講解。
下面簡單說明 RegCopyFile和RegRestoreFile的用法。
///使用基于RAM的注冊表,利用RegCopyFile和RegRestoreFile
///實現(xiàn)永久保存注冊表數(shù)據(jù)。
#include
#include
CString strRegBackup = Lhard diskRegBackup.reg;
CString strTmp = Lwindowstemp.reg;
////////導(dǎo)出。在系統(tǒng)關(guān)閉前。
if(! RegCopyFile(strTmp)) ///導(dǎo)出注冊表,用temp.reg做緩沖用。
{
return FALSE;
}
if(! CopyFile(strTmp, strRegBackup, FALSE)) ///把temp.reg再復(fù)制到RegBackup.reg
{
return FALSE;
}
/////////導(dǎo)入。在系統(tǒng)啟動時。
if(! CopyFile(strRegBackup, strTmp, FALSE))
{
return FALSE;
}
if(! RegRestoreFile(strTmp)) ///恢復(fù)注冊表
{
return FALSE;
}
if(! KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL)) ///重新啟動
{
return FALSE;
}
評論