??? 03/01/08 15:38 Modified: 03/01/08 16:01 Read: times |
#151736 - Things that can be done... Responding to: ???'s previous message |
To "save" configuration file settings from corruption or modification there are a number or things that can be done. The choice of which of these ideas that you select will depend upon just what types of problems that you would desire to prevent from happening.
1) Sometimes the config data can be stored in the file in binary format instead of in text format. It makes it much harder for the typical user to modify the data. 2) You could encrypt the data so as to hide the file content and prevent it from being modified. You could choose to encrypt either a binary or text form of the data. In the end the result still ends up being binary data. 3) Maybe you could add a CRC code or other validity check digits to each item in the configuration data set. Then if something gets corrupted or modified you could detect that this has happened and then have the program revert to a default value for that parameter. 4) You could make sure to validate each parameter as it is read back to ensure that the value is a legitimate value. Check things like type, form, numerical range and so forth. If something is wrong then revert to a default value. 5) If you are concerned about problems of the configuration file getting corrupted while it is being written due to power glitches or program stoppage then one way to retain the most recent information is to use a scheme to store two copies of the configuration file. Each file would require an image verification signature such as a CRC32, Reed Soloman code, or some other scheme. Both files would always be written each time there was a parameter change to be stored but they would be written sequentially such that the first copy is fully updated before the second image update is started. This scheme makes a judgement that if an upset or corruption of one file image were to occur it would likely happen to just one of the two images. At time of read back if the first image is read use its stored values unless the image failed to validate. In the latter case then move onto the second image and load and validate that. If you can use that then load paramaters from there with the knowledge that possibly you are loading a 1x previous version of the configuration data instead of the most recent. Michael Karas |
Topic | Author | Date |
Config File check | 01/01/70 00:00 | |
Yes. Check your input! | 01/01/70 00:00 | |
Confifg File check | 01/01/70 00:00 | |
Things that can be done... | 01/01/70 00:00 | |
Study This Thread | 01/01/70 00:00 |