none
Change autorun path on card insertion

    Question

  • Hi,

    I want to use a neat feature to autorun an application when a sd card insertion is made in my device. I know that using the SHGetAutoRunPath, I can see the autorun path. This path is built with the processor architecture type, and in my case, its 2577 (ARMV4I). However, in my case, the path doesn't points on a removable media, but on the network. The path returned by SHGetAutoRunPath is "\Network\2577\autorun.exe".

    So, since I can generate my image for my device, I would like to change the autorun path to a removable media but I don't know where it's done. Can someone help me find this? I simply want to change the path to "\Storage Card\2577\autorun.exe"

    Thanks for your help!

    Regards


    Ben
    Friday, August 19, 2011 1:54 PM

Answers

  • Ben:

    I think that SHGetAutoRunPath() was created for Windows Mobile to satisfy a specific need.   That need was to handle the one and only removeable storage card.

    On Windows CE device in general, there can be multiple removeable storage cards - so SHGetAutoRunPath() starts to make less and less sense and possibly to the point of being totally useless.  What good is a function that only looks for "the first storage card"?  What does that actually mean?

    What you may want to do is develop your own application to handle running applications on the SD card.   I have provided sample code to do this at http://geekswithblogs.net/BruceEitman/archive/2008/06/13/windows-ce-monitoring-for-disk-insertion-to-add-support-for.aspx


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

    Eurotech Inc.
    www.Eurotech.com
    • Marked as answer by Benlaj1 Monday, August 22, 2011 1:51 PM
    Friday, August 19, 2011 5:24 PM

All replies

  • Ben:

    I think that SHGetAutoRunPath() was created for Windows Mobile to satisfy a specific need.   That need was to handle the one and only removeable storage card.

    On Windows CE device in general, there can be multiple removeable storage cards - so SHGetAutoRunPath() starts to make less and less sense and possibly to the point of being totally useless.  What good is a function that only looks for "the first storage card"?  What does that actually mean?

    What you may want to do is develop your own application to handle running applications on the SD card.   I have provided sample code to do this at http://geekswithblogs.net/BruceEitman/archive/2008/06/13/windows-ce-monitoring-for-disk-insertion-to-add-support-for.aspx


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

    Eurotech Inc.
    www.Eurotech.com
    • Marked as answer by Benlaj1 Monday, August 22, 2011 1:51 PM
    Friday, August 19, 2011 5:24 PM
  • Hello Bruce,

     

    Thanks for your solution, it clearly seems more flexible than the original system in WinMobile/WinCE. Even though I might go with the solution you propose, I'm still interested in the implementation of how to configure what  SHGetAutoRunPath() returns.  This still bugs me but I'm really grateful for your help.

     

    Regards


    Ben
    Monday, August 22, 2011 1:51 PM
  • As a premise, I agree with Bruce on the fact that "SHGetAutoRunPath() starts to make less and less sense and possibly to the point of being totally useless".

    Anyway, SHGetAutoRunPath is implemented in AYGSHELL.DLL the source code of which is not available: you need to step into the assembly code to see what's going on. From what I saw, SHGetAutoRunPath looks in the registry for the string "DataPath" under [HKEY_LOCAL_MACHINE\System\Platform] using the GetDataDirectory function (see %_WINCEROOT%\PRIVATE\WINCEOS\osshell\commctrl\cmncore\inc\miscsvcs.h

    The value is normally set as  "DataPath"="\\" in the platform.reg file. Setting it to "DataPath"="\\Network" in the CE 6.0 emulator the SHGetAutoRunPath returns

    \Storage Card\2577\autorun.exe.

    Note: I configured the emulator so it uses a folder on my PC  and this share is seen as 'Storage Card': with the "DataPath"="\\Network" setting but without 'Storage Card' folder the SHGetAutoRunPath fails. In your case using an actual Storage Card it *may* work.

    Don't ask me why the implementation is this, I have no clue


    Luca Calligaris lucaDOTcalligarisATeurotechDOTcom www.eurotech.com Check my blog: http://lcalligaris.wordpress.com
    Monday, August 22, 2011 3:14 PM
  • Hello Luca,

     

    In my case, I don't even have the "DataPath" value in the registry. One of the first reason why I wanted to get more details about that autorun run feature was because it was not working when setting the directory on the SD card to 2577, which is the architecture type. This is where I learned about SHGetAutoRunPath() and that I saw the "\network" instead of "\Storage Card".

    So, all in all, I still can't see where this is set and my curiosity is still there, but I'm glad to receive your help. Hope that someone will be able to pinpoint the solution.

     

    Regards 


    Ben
    Monday, August 22, 2011 3:58 PM