Languages :: Delphi :: How to back up registry in Win98se/winXP with Delphi? |
|||
| By: collegeBoy |
Date: 08/04/2003 00:00:00 |
Points: 125 | Status: Answered Quality : Excellent |
|
Hey everyone, I have some problems about that backuping. If you can, please answer me. This should be an Api funkcion or smth. Best regards to everyone! |
|||
| By: VGR | Date: 08/04/2003 06:29:00 | Type : Answer |
|
| my PersonalBackup software does it. On Win95/98 you can just copy the config/* files on NT/XP/2K you've to SaveKey using a TRegistry object, after having got the required SE_BACKUP_NAME privilege regards |
|||
| By: TheFalklands | Date: 09/04/2003 05:34:00 | Type : Comment |
|
| Use these codes to backup the Registry's any branch: winexec('regedit /e c:\goomoo.reg HKEY_LOCAL_MACHINE\Software\Microsoft',sw_show); |
|||
| By: VGR | Date: 09/04/2003 05:53:00 | Type : Comment |
|
| it won't work if the user hasn't the required privilege. This requires some programming. PersonalBackup is at <A HREF="http://www.edainworks.com">www.edainworks.com</a> |
|||
| By: digitaltree | Date: 09/04/2003 07:27:00 | Type : Comment |
|
| Try this: No 1.use regedit uses shellapi shellexecute(handle,'open','regedit.exe',' /e YourWantExportKey YourBackUpFilename','',sw_hide) No 2.Use windows API RegSaveKey or RegRestoreKey The RegSaveKey function saves the specified key and all of its subkeys and values to a new file. LONG RegSaveKey( HKEY hKey, // handle of key where save begins LPCTSTR lpFile, // address of filename to save to LPSECURITY_ATTRIBUTES lpSecurityAttributes // address of security structure ); The RegRestoreKey function reads the registry information in a specified file and copies it over the specified key. This registry information may be in the form of a key and multiple levels of subkeys. LONG RegRestoreKey( HKEY hKey, // handle of key where restore begins LPCTSTR lpFile, // address of filename containing saved tree DWORD dwFlags // optional flags ); example code: procedure TFormMain.ButtonExportClick(Sender: TObject); var RootKey,phKey: hKey; KeyName,sKeyFileName: String; FileName: array [0..255] of char; begin RootKey := HKEY_CURRENT_USER; KeyName := 'software\mysoft\abc'; RegOpenKeyEx(RootKey, PChar(KeyName), 0, KEY_ALL_ACCESS, phKey); sKeyFileName := 'c:\tempReg'; StrPCopy(FileName,sKeyFileName); //or use pchar if RegSaveKey(phKey, FileName, nil)= 0 then ShowMessage('BACKUP OK!') else ShowMessage('BACKUP ERROR!'); RegCloseKey(phKey); end; procedure TFormMain.ButtonImportClick(Sender: TObject); var //Restore from file RootKey,phKey: hKey; KeyName,sKeyFileName: String; FileName: array [0..255] of char; begin RootKey := HKEY_CURRENT_USER; KeyName := 'software\mySoft\abc'; RegOpenKeyEx(RootKey, PChar(KeyName), 0, KEY_ALL_ACCESS, phKey); sKeyFileName := 'c:\tempReg'; StrPCopy(FileName,sKeyFileName); if RegRestoreKey(phKey, FileName,0)= 0 then ShowMessage('RESTORE OK!') else ShowMessage('RESTORE ERROR!'); RegCloseKey(phKey); end; No 3.Use TRegistry's savekey and restorekey var reg : Tregistry; begin reg := Tregistry.Create; reg.rootkey := HKEY_CURRENT_USER; reg.Savekey('\Software\Wom','d:\test1\Wom'); end; |
|||
| By: VGR | Date: 09/04/2003 07:34:00 | Type : Comment |
|
| one more time, this SaveKey call won't work if the user the program runs at doesn't have the required NT privilege |
|||
| By: collegeBoy | Date: 22/04/2003 02:02:00 | Type : Comment |
|
| Thanx for all of you |
|||
|
Do register to be able to answer |
|||
©2012 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








