Reputation: 6615
Using Visual Studio 2005 and C# (CF v2.0). The following code deletes a registry key fine on Windows CE 6.0:
RegistryKey key_test = Registry.LocalMachine.CreateSubKey("Test");
RegistryKey key_users = key_test.CreateSubKey("Users");
key_users.DeleteSubKey("User1"); // Yes, this key does exist!
key_users.Flush();
// Now power down the device; on power up, key is gone
But exactly the same code fails to delete the key on Windows CE 5.0. After calling "DeleteSubKey" and then checking the registry manually, the key appears to have disappeared. But when you power the device back up...the key has returned!
I can detect the operating system, so I then tried a variation for Windows CE 5.0:
key_users.DeleteSubKeyTree("User1"); // DeleteSubKey also fails
key_users.Close();
but this also failed to delete the key. Again, the key appears to go but after powering the device back up, the key is back. I've encapsulated the above code in try-catch blocks and no exceptions are raised, the code runs ok, just doesn't work. Any ideas? Do I need to do something extra on Windows CE 5.0 that I am missing? Adding keys is no problem, a simple "Flush" adds the key.
Upvotes: 1
Views: 1255
Reputation: 2210
Seems that your ce5 device does not have permanent registry. Did you try to create a key? It is still there after a reboot?
Upvotes: 1