none
WEC7 - Removing Activesync caused the registry not to persist as it used to RRS feed

  • Question

  • Hi everyone

    Up to now I've been running my image with ActiveSync built in.

    My C#.NET app has been using Registry.SetValue to set registry values. Up to now it has worked fine.

    However I've noticed that with ActiveSync removed from the build, the persistence of the registry has changed.

    With ActiveSync built in I could change a registry value and virtually turn the device off straight away knowing values will be retained next time the device is switched on.

    Now I need to change the setting and leave it a minute or so before switching off the device to get the registry to retain the value.

    Any idea whats going on? Why did it work fine with ActiveSync in the build, even when it wasn't being used.

    (How can I tell if the registry uses lazy flushing and could this be the problem?

    As I'm using C# what would be the best way to ensure that a registry value being changed actually persisted?

    Regards
    Terry

    Monday, September 7, 2015 4:32 PM

Answers

  • Terry:

    An app that changes values in the registry really should call the native function RegFlushKey() or RegistryKey.Flush() or RegistryKey.Close().

    You should check the following in the registry:

    [HKEY_LOCAL_MACHINE\init\BootVars]
        "RegistryFlags"=dword:1

    Which would cause the registry to flush when a registry key is closed.

    and:

    [HKEY_LOCAL_MACHINE\init\BootVars]
        "RegistryFlags"=dword:2

    which would disable a background thread that flushes the registry automatically.



    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Eurotech

    • Marked as answer by Terence P Thursday, September 17, 2015 12:27 PM
    Thursday, September 10, 2015 11:18 PM
    Moderator

All replies

  • Hi Terry,

    What I can think of is when you remove Active Sync what is the default client driver being used by the USB Function?

    You can compare the NK.bin images or reginit.ini files with Active Sysnc and Without Active Sync.

    That may give you some clues.

    Best Regards,

    GSR

    Tuesday, September 8, 2015 8:39 AM
  • Hi GSR

    Thanks for the info

    Out of interest where is the best place in the registry for placing my application registry entries?

    I've put mine in:-

    [HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\MyProduct]

    Would I be better off putting them somewhere else?

    Regards
    Terry

    Tuesday, September 8, 2015 3:33 PM
  • Hi Terry,

    Just as a side note, when selecting any component to add to your OS from the catalog it often comes with dependencies.  If you right click and see "Show dependencies" you can see all of the other items it drags in and anything that requires it as well. When you remove an item, likely some of the dependencies are removed as well.

    Looking at these dependencies might help you identify what lower component was removed that you require.

    Sincerely,

    IoTGirl

    Tuesday, September 8, 2015 4:35 PM
    Moderator
  • Hi IoTGirl

    Thanks for the info. I'll give it a go.

    Regards
    Terry

    Wednesday, September 9, 2015 8:01 AM
  • Hi Terry,

    While it can be tedious, you can try either:

    1. Removing the child items bit by bit - Working to not working

    2. Adding back the child items bit by bit - Not working to working

    I suspect the names of the items will also be a clue as to which are important for memory management.

    Good luck!

    Sincerely,

    IoTGirl

    Wednesday, September 9, 2015 5:18 PM
    Moderator
  • As far as where to put your data in the registry goes, the key that you mention make a lot of sense - heck it is well thought out.



    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Eurotech

    Thursday, September 10, 2015 11:07 PM
    Moderator
  • Terry:

    An app that changes values in the registry really should call the native function RegFlushKey() or RegistryKey.Flush() or RegistryKey.Close().

    You should check the following in the registry:

    [HKEY_LOCAL_MACHINE\init\BootVars]
        "RegistryFlags"=dword:1

    Which would cause the registry to flush when a registry key is closed.

    and:

    [HKEY_LOCAL_MACHINE\init\BootVars]
        "RegistryFlags"=dword:2

    which would disable a background thread that flushes the registry automatically.



    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Eurotech

    • Marked as answer by Terence P Thursday, September 17, 2015 12:27 PM
    Thursday, September 10, 2015 11:18 PM
    Moderator
  • Bruce, IoTGirl

    Thanks for the info.

    In the end I call RegFlushKey() which does the trick (not sure what removing ActiveSync did to saving to registry)

    Regards
    Terry 

    Thursday, September 17, 2015 12:27 PM