This came up in the newsgroup yesterday but I think it’s worth noting here as well…
For performance reasons, the system registry is loaded into memory and changes are flushed back to persistent storage periodically. This is great for perf but it also means is that if the user soft resets their device or yanks a battery during the period of time between a registy value changing and those changes being flushed, the changes will be lost when the device is tuned back on.
Developers can prevent this by calling RegFlushKey to force a flush to happen after making registry changes. But what about legacy code that doesn’t call RegFlushKey? Will users need to worry about unexpected things happening whenever they reset or change batteries? Nope. Very few people will ever encounter this scenario of registry changes being lost due to a ton of backwards compatibility work we did around this for Windows Mobile 5.0. On top of flushing after the device has been idle for a certain amount of time, we’ve taken the liberty of identifying the activiites that most commonly precede a device being reset and automatically flush the registry at those times.
Tap the device’s power button. Change a setting in a control panel (including 3rd party control panels) and then hit “OK” (PPC) or “Done” (SP). Install an app through ActiveSync or a CAB on the device. Run and app that resets the device by calling KernelIoCtl or ExitWindowsEx. Any of these things will result in the OS jumping in and flushing the registry.