This post is a case study of backup and restore one application called XCamera which is a camera application with it’s own driver included.
After analysis, I found the components I think it should be backup for restoring.
Files in \Program Files\XCamera | The application install folder. There are lot of exe, dll and ini files in this folder. |
Two driver files in \Windows folder | File camera.dll and backlight.dll. There are drivers run by device.exe. |
A link file in \Windows\開始功能表\程式集 | The shortcut LNK file. |
Files in \Windows\AppMgr\[XCamera ….] | Looks like some files created by AppMgr. I am not sure what they are, but they should be backup. |
Registry | XCamera does not user hive, we only need to backup system hive. |
So, here is the procedure to backup system for XCamera.
- Backup registry using RegSaveKey()
- Backup all files listed in above table
I don’t get any problem on backup process (). So, let’s clean boot the device and start our restore procedure.
- Find devices use camera.dll and backlight.dll, de-active them. (procedure in [Driver file replacement])
- Using CopyFile() API to replace camera.dll and backlight.dll (original files are INROM file, after this copy, they becomes NORMAL files)
- Create \windows\AppMgr\[XCamera …] folder and copy backup files into that folder
- Create \Program Files\XCamera folder and copy backup files into that folder
- Copy backup system hive file to “My Documents” folder and using RegReplaceKey() function to restore it.
- Reboot device
There are two things cause you need to reboot the device: First, the de-actived devices will be active again after reboot (Of course, you can active them by yourself). Second, the RegReplaceKey() API will un-mount system hive, you need to reboot the device and OS will use your hive to replace system hive.
After reboot, I can see XCamera in 程式集, and it can be run normally.
But, I found another problem on this procedure. After restore, I cannot find the application XCamera in application manager, that means I cannot uninstall and upgrade the application.
Looks like application manager using other resource on disk. Maybe database??? I think I found my next topic…
沒有留言:
張貼留言