Registry Data Not Being Flushed to Disk Regularly

P

Paul Nash

Hi,

We are experiencing problems with our Windows XP Embedded system after hard
resets or power loss. Our application uses the registry as a small database
and thus writes data to the registry often. However we have found that data
which has been written to the registry can sometimes be lost after a hard
reset. This can even occur with data which has been written to the registry
over 2 days prior to the reset or power loss.

I decided to try and analyse when data was being written to the software
hive by the operating system and then compare this to Windows 2000 Server. I
used filemon from SysInternals to monitor both XPe and Win2K and regedit to
write data into the registry.

On Win2K you can see that the services.exe process performs a flush file
operation on C:\winnt\system32\config\software soon after data is written to
the registry.

On Windows XPe I did not see any file operations at all by any process on
C:\windows\system32\config\software. This may be because the SysInternals
tool cannot catch these file writes or that the interval between flushes is
very large.

So the question I have is what mechanism does XPe use to flush registry to
disk? and how often should it be occuring? And how can I verify that this is
occuring correctly?

We have tried using RegFlushKey in our application but the performance
impact this has on XPe is not acceptable.

Regards,

Paul Nash
 
S

Slobodan Brcin \(eMVP\)

Hi Paul,

You should use API call: RegFlushKey
We have tried using RegFlushKey in our application but the performance
impact this has on XPe is not acceptable.

Sorry but registry is not meant to be used that way, or there is a performance penalty you must pay.
Why don't you use file for your config data?

Or if you are stuck too much with registry concept then use RegSaveKey, RegLoadKey to export/import memory registry content to small
file.

Do import when you start program. And export instead of flush.

BTW: Consider creating regular config file that is not related to registry in any way.

Regards,
Slobodan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do have an opinion on the effectiveness of Microsoft Windows Mobile and Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
P

Paul Nash

The registry load/unload idea may work for us, thanks, but it will require
alot of work to change our application and write our own timed flush
mechasim using unload.

However I would have thought that XPe would flush registry data to disk at
intervals of much less than 2 days. Do you know how I can get hold of more
information about the interval between flushes for registry data on XPe?

Thanks,

Paul

Slobodan Brcin (eMVP) said:
Hi Paul,

You should use API call: RegFlushKey


Sorry but registry is not meant to be used that way, or there is a
performance penalty you must pay.
Why don't you use file for your config data?

Or if you are stuck too much with registry concept then use RegSaveKey,
RegLoadKey to export/import memory registry content to small
file.

Do import when you start program. And export instead of flush.

BTW: Consider creating regular config file that is not related to registry in any way.

Regards,
Slobodan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
 
K

KM

Paul,

I agree with Slobodan that you must call RegFlushKey. Basically it is the way to make sure the registry gets "persistent" on any
Windows OSs that uses hive base registry.

If the performance is not good on your platform, you may want to call the API by a timer and test different timer timeouts to see
what is acceptable for your platform requirements. You may lose some data sometimes but may improve the performance. It is a
trade-off after all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top