The same reason as the previous one for Windows mobile registry. This post is the notes of Windows mobile file system study.
FILE ATTRIBUTE
Theoretically, we can scan all files and folders in root system, and then using GetFileAttributes to get the attribute. And of course we can use the attribute to differentiate the file is stored in ROM image, writable root file system or external media storage (like SD card).
FILE_ATTRIBUTE_INROM | Indicate the file store in ROM image. It’s read-only and cannot be modified. And we don’t need to worry about it on backup function. |
FILE_ATTRIBUTE_SYSTEM | The file is used by the OS. |
FILE_ATTRIBUTE_HIDDEN | The file or directory is hidden. I am not sure if we can find hidden file using FindFirstFile API. |
FILE_ATTRIBUTE_ARCHIVE | MSDN says application use this attribute to mark files for backup or removal. I am not really understand what he means. I need more study on this, maybe that relative with backup and restore function we wanted. |
FILE_ATTRIBUTE_TEMPORARY | Temp files, we can ignore them for backup function. |
There are more attributes list in MSDN, I don’t know if I miss anything important for backup application. I need more testing on real device for detail.
SCAN STORAGE
I had write a testing code to scan all storages on my mobile device follow the sample here.
And I get output like this:
Store: SMFLASH
Part: Name(Part00) Vol() FS(BOOT) ATT(0)
Part: Name(Part01) Vol() FS(RAWFS) ATT(0)
Part: Name(Part02) Vol() FS(imgfs.dll) ATT(16)
Part: Name(Part03) Vol() FS(fatfsd.dll) ATT(16)
Store: DSK1:
Part: Name(Part00) Vol(\Storage Card) FS(fatfsd.dll) ATT(16)
I can see I have one SD card using FAT file system and mounted on “\Storage Card”. And the internal storage is SMFLASH with 4 partitions.
I can understand that we don’t need to care about partition 0 and 1, but I still cannot know which is the root file system we are using. (The partition attribute 16 means READONLY, AUTOFORMAT and MOUNTED.)
Ps. The sample code using library storeapi.lib, this library does not exists in Windows Mobile SDK. I got it from WM616 adapter kit.
FILE SYSTEM BACKUP PLAN
Theoretically, if we can list all files which are not store in ROM image, then we can create the file backup image for later restore.
I had wrote a test application which scan all files in root file system to find out the files and directories does not store in ROM image using API FindFirstFile and FindNextFile.
But we still have issues need to be solve:
1. When mobile OS running, lot of files were been locked for read (for example: driver dll in windows folder). I cannot copy those files for creating backup image.
2. Like previous issue, of course the running (locked) files cannot be write for restoring.
沒有留言:
張貼留言