none
App exits after starting via OSDesign.reg in WEC7 RRS feed

  • Question

  • Followed code example from Bruce on how to detect disk insertion and run exes from disk. Everything works great when I boot with debug image but not when I boot the retail image. I have tried waiting unto 20 seconds before running app and it still exits.

    Any ideas on what is going on or how to debug this?

    The first app CopyTuiApp does its thing and exits but the FlashStickControl app should not exit?

    PID:05F10052 TID:05940046 Creating Thread...
    PID:05F10052 TID:05940046 Creating Thread...
    PID:05F10052 TID:0481006E Thread Created... Sleeping
    PID:05F10052 TID:049F006E Thread Created... Sleeping
    PID:05F10052 TID:0481006E Done Sleeping...
    PID:05F10052 TID:0481006E Creating Process PID:05F10052 TID:0481006E CopyTuiApp.exePID:05F10052 TID:0481006E
    PID:05F10052 TID:0481006E Thread Exiting...
    PID:057C000E TID:057A000E [HeartBeat] [1] 1::20B8
    PID:057C000E TID:057A000E [PerfCount] 0::5
    PID:057C000E TID:057A000E [HeartBeat] [1] 2::3448
    PID:057C000E TID:057A000E [PerfCount] 0::5
    PID:057C000E TID:057A000E [HeartBeat] [1] 3::47D9
    PID:057C000E TID:057A000E [PerfCount] 0::5
    PID:057C000E TID:057A000E [HeartBeat] [1] 4::5B6A
    PID:057C000E TID:057A000E [PerfCount] 0::5
    PID:05F10052 TID:049F006E Done Sleeping...
    PID:05F10052 TID:049F006E Creating Process PID:05F10052 TID:049F006E FlashStickControl.exePID:05F10052 TID:049F006E
    PID:05F10052 TID:049F006E Thread Exiting...
    PID:057C000E TID:057A000E [HeartBeat] [1] 5::6F38

    Wednesday, January 31, 2018 6:29 PM

Answers

  • What is a "startup register entry", if not HKLM\Init?

    Your app is doing something prior to the system being ready for the app to do something.  Only you know what your app is doing.

    If it were me, I would do the following (but not necessarily at the same time):

    1. Instrument the code with debug messages to see what code runs and what code does not.   I usually add RETAILMSG(1, "1\n");  and increment the number.
    2. Add a call to Sleep(10000); very early in the code.

    Bruce Eitman
    Senior Engineer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Synopsys

    Friday, February 2, 2018 2:35 PM
    Moderator
  • Mark:

    Take a look at http://geekswithblogs.net/BruceEitman/archive/2008/06/13/windows-ce-monitoring-for-disk-insertion-to-add-support-for.aspx.  Same code could be used for what you are doing - that is waiting for a disk to become available.  You could run the wait code in a separate thread and signal the main thread to go using a critical section or mutex when the disk is started.

    Note the problem that you may have is that your code might see the disk before it is fully mounted and ready to read.


    Bruce Eitman
    Senior Engineer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Synopsys

    Monday, February 5, 2018 3:32 PM
    Moderator

All replies

  • Thursday, February 1, 2018 2:19 AM
    Moderator
  • I am running this thru a startup register entry instead of an AutoLaunch init/startup. Is this acceptible.

    I am adding a WaitForAPIReady for DEVMGR to the MonitorForNewDisks function.

    I see that the MonitorForNewDisks function is called just before the process exits.

    Thursday, February 1, 2018 2:13 PM
  • Show us some code so we know what you are doing.

    In the GuruCE iMX6 BSP we have an autoexec component that can be configured through the registry. It can wait for storage mounts, wait for a valid IP address, and wait for all .NET CF components are ready. It can start applications, but also kill some, and has a fallback mechanism in case a run item fails.

    Config looks like this:

    [HKEY_LOCAL_MACHINE\init]
        "Launch199"="AutoExec.exe"   ; Start at boot
        
        ;"Launch50"=""   ; Remove explorer shell start
            
    [HKEY_LOCAL_MACHINE\Autoexec]
        ;"Wait4Mount"=multi_sz:"USDHC2"
        "Wait4Net"=dword:1
        "Wait4CF"=dword:0
        
    [HKEY_LOCAL_MACHINE\Autoexec\Run]
        ;"Kill"=multi_sz:"explorer.exe"
    #if $(_WINCEOSVER)=="700"
        "Run"=multi_sz:"\\Windows\\conmanclient2.exe"
    #endif $(_WINCEOSVER)=="700"
    #if $(_WINCEOSVER)=="800"
        "Run"=multi_sz:"\\Windows\\conmanclient3.exe"
    #endif $(_WINCEOSVER)=="800"
    
    [HKEY_LOCAL_MACHINE\Autoexec\Fallback]
        ;"Kill"=multi_sz:"MinShell.exe"
        ;"Run"=multi_sz:"\\Windows\\explorer.exe"
        

    In the above example we've configured it to autostart conmanclient so our customers can debug their applications using Visual Studio.

    If you show us your code, we can most likely better help you.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: https://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    NXP Proven Partner
    https://guruce.com
    Consultancy, training and development services.

    Interested in WEC on i.MX6?
    Get the only 100% stable and best performing i.MX6 BSP for WEC7 and WEC2013 here: https://guruce.com/imx6

    Thursday, February 1, 2018 10:14 PM
    Moderator
  • What is a "startup register entry", if not HKLM\Init?

    Your app is doing something prior to the system being ready for the app to do something.  Only you know what your app is doing.

    If it were me, I would do the following (but not necessarily at the same time):

    1. Instrument the code with debug messages to see what code runs and what code does not.   I usually add RETAILMSG(1, "1\n");  and increment the number.
    2. Add a call to Sleep(10000); very early in the code.

    Bruce Eitman
    Senior Engineer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Synopsys

    Friday, February 2, 2018 2:35 PM
    Moderator
  • Thanks so much for all the ideas and info.  I added some RETAILMSG calls and found out my app was not terminating it was just not getting a notice when the flash drive was plugged in. The was only with retail because the debug build would make the notification. I really wish Visual Studio would not just load everything that builds when doing debug builds because it make it hard to figure out why your retail build runs differently. My customer decided they did not need this feature so they changed the requirement on me. I just need to check for the existance of an exe on the flash drive at boottime, if so run the exe.

    BTW, by talking about startup I had added Keys and values to HKLM/Startup in my OSDesign registry to run a process with process delay, that was what I was talking about with the startup terminology before.

    Friday, February 2, 2018 2:43 PM
  • Mark, if you want to thank people for helping you then the nice way to do that is to vote for helpful responses and mark responses as answers.  This gives MSDN credit to the people helping you and helps people in the future find helpful answers.

    Bruce Eitman
    Senior Engineer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Synopsys

    Monday, February 5, 2018 2:27 PM
    Moderator
  • The problem was no detection of the inserted flash drive while running retail. Since this worked in debug I am assuming some catalog item was missing that was not loaded in the retail version.
    Monday, February 5, 2018 2:37 PM
  • Mark:

    Take a look at http://geekswithblogs.net/BruceEitman/archive/2008/06/13/windows-ce-monitoring-for-disk-insertion-to-add-support-for.aspx.  Same code could be used for what you are doing - that is waiting for a disk to become available.  You could run the wait code in a separate thread and signal the main thread to go using a critical section or mutex when the disk is started.

    Note the problem that you may have is that your code might see the disk before it is fully mounted and ready to read.


    Bruce Eitman
    Senior Engineer
    Bruce.Eitman AT Synopsys DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Synopsys

    Monday, February 5, 2018 3:32 PM
    Moderator