Autorun.exe in Windows Mobile device storage card

by Mobile Packager Team 8. March 2009 07:36

Windows Mobile supports a feature to detect a newly inserted storage card and automatically load an application from the storage card into the memory of the Windows Mobile device. It also detects when the storage card removed from the mobile device and notifies the application that was loaded when the storage card was inserted to remove itself and perform a clelanup action.

The implementation simplicity of this feature is provided by renaming any executable application to Autorun.exe. This will make the renamed application(autorun.exe) ready to be launched automatically upon insertion of a storage card. However, after renaming the file, the file itself must reside in reside in a particular folder in the storage card. For example "\2577\autorun.exe" is valid auto run location for ARM processor based devices.

Processor Type       Autorun Folder on Storage Card
SH3                          10003
MIPS                         4000
ARM (SA1100)           2577
ARM (720)                 1824
x86                           686

If Windows Mobile was unable to find an autorun.exe under the special folder for the its processor type, it then checks for "\0\autorun.exe".

Note that autrun.exe does not directly run from the storage card. It is first copied to \windows" or "\windows\autorun\<storage card name>" folder on the mobile device by the Windows Mobile OS before it is launched.

In summary the steps are as follows (Because the device emulator is the one environment share in common, we will use that to demonstrate this feature).

  1. Rename file to autorun.exe.
    (Note in Mobile Packager this can be done by setting the output name to "autorun.exe" or by manually going to the output folder and renaming the generated output file for the current project).
  2. Copy the autorun.exe to a storage card under the correct subfolder ("\2577" for emulator)

  3. Insert the storage card into the the mobile device.
    To do this on the emulator you have to share the parent folder that contains the device specifc folder. In this example it will be "C:\Documents and Settings\Admin\My Documents\Mobile Packager Tests\Autorun Test\Output\Mobile".

    As soon as you click on the "OK" button of the "Emulator Propeties" window, the emulator simulates that as a storage card insertion and therefore will launch the autorun.exe that you created using Mobile Packager.

On a final note, because there can only be one aturun.exe in a given folder, you can't have multiple autorun executables to install separate applications. However, using Mobile Packager you can bundle your installation packages, cab files files and other items into one executable and this executable will be your autorun.exe.


Comments are closed

All Right Reserved © 2007-2013 Mobile Packager.