问题
My Windows CE (Motorola/Symbol) handheld devices have folders named \Software\Microsoft\Windows CE Services below both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE.
HKEY_CURRENT_USER only has one entry, "DeviceFriendlyName"; it is read by the device, as the device is labeled in Windows Explorer with that key's value.
However, what about HKEY_LOCAL_MACHINE? It contains many more keys, such as ExcludeExts, FileSyncPath, GuestOnly, &c.
Why is there a \Software\Microsoft\Windows CE Services in two different places in the registry, and are both read by the device?
There are questions as to whether the values I have in the "ExcludeExts" key (namely: lnk,tmp,cdb,mdb,sdf,sqlite) beneath HKEY_LOCAL_MACHINE are being respected (we don't want files with those extensions being transferred between the device and the PC to which it is connected).
As is so often the case, it works on my machine (sdf files are no longer being synced on my dev machine), but the testing department says it doesn't work for them - sdf files are still being placed in "C:\Users\rompecabeza\Documents\Documents on Rompecabeza's Device" on the PC.
From what I gather, the Registry values are probably not case-sensitive, but to be sure I changed this code:
RegistryKey key =
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows CE
Services");
if (key != null)
{
key.SetValue("GuestOnly", 00000001, RegistryValueKind.DWord);
key.SetValue("ExcludeExts", "lnk,tmp,cdb,mdb,sdf,sqlite",
RegistryValueKind.String);
}
...to this:
RegistryKey key =
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows CE
Services");
if (key != null)
{
key.SetValue("GuestOnly", 00000001, RegistryValueKind.DWord);
key.SetValue("ExcludeExts",
"lnk,tmp,cdb,mdb,sdf,sqlite,LNK,TMP,CDB,MDB,SDF,SQLITE",
RegistryValueKind.String);
}
As noted, though, it worked already on my machine, anyway, even before (perhaps redundantly) uppercasing the extensions.
We are using a variety of devices / OS versions; specifically, we support both Symbol 3090 and Motorola 3190 devices; the former has CE 5.0.1400 installed, the latter 6.0.0
But again, both devices work on my machine - no sdf files are synced from the handheld to the PC on my dev machine (IOW, it works as I want it to for me).
So: should I do this:
RegistryKey key2 =
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Windows
Services");
if (key != null)
{
key.SetValue("GuestOnly", 00000001, RegistryValueKind.DWord);
key.SetValue("ExcludeExts"
|"lnk,tmp,cdb,mdb,sdf,sqlite,LNK,TMP,CDB,MDB,SDF,SQLITE
RegistryValueKind.String);
}
...(replacing "LocalMachine" with "CurrentUser") or would that be redundant (writing these keys/vals to both HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER)?
Here are the current entries in the not-working-for-the-tester handheld device (HKEY_LOCAL_MACHINE):
UPDATE
It may not be the registry settings at all that are the problem; see this for what seems to be the problem.
UPDATE 2
Curiouser and curiouser: there are actually multiple "Windows CE" folders in the registry on the device I'm looking at now, namely:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows CE Services <= It has one registry key, "DeviceFriendlyName"
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services <= several (7) registry keys
HKEY_LOCAL_MACHINE\Windows CE Tools <= It has one registry key, "Platform"
HKEY_LOCAL_MACHINE\Windows CE Services <= it's empty
Is this really necessary? Why are WindowsCE registry folders scattered about like maple leafs (not the hockey team) following an autumn tempest?
UPDATE 3
See this.
来源:https://stackoverflow.com/questions/28328063/which-branches-of-the-registry-does-a-ce-device-read