Javscript would provide a navigation menu here. HOME

The autorun mechanics

When you insert or remove a temporary volume (normally a memory card) in/out a PocketPC during powered state, the OS looks for a AutoRun.exe in a processor specific directory of the temporary volume. This exe is then copied to Windows dir and will be launched from there. To determine the directory from which autorun.exe has been copied, the programmer can use the function:

BOOL SHGetAutoRunPath (LPTSTR pAutoRunPath);

With the standard autorun.exe feature you can start an application on inserting a memory card automatically. There are many usefull things you can do with this automatic feature.

ITC uses a slightly different approach. There is \Windows\StartUp\RunAutoRun.exe which will lauch an autoexec.exe found in the dir 2577 of the first found temporary volume. This exe will now search for an exe called autoexec.exe in the dir 2577 of the following temporary volumes:
Compact Flash memory card
SD memory card
DiskOnChip (Object store)
Flash File Store (Object store), DiskOnChip or Flash File Store maybe mapped into object store

Overview of ITC devices startup

Order

origin

executable

launches

additional info

custom application

1

HKLM\init

RegSysGen.exe

\Flash File Store\SYSTEM\RegSysGen.exe

should call SignalStarted()

X

2

HKLM\init

PreShell.exe

\Flash File Store\2577\PreShell.exe

can call SignalStarted(), if not OS does not load following apps

X

3

HKLM\init

PostShell.exe

\Flash File Store\2577\PostShell.exe

can call SignalStarted(), if not OS does not load following apps

X

4

\Windows\StartUp

RunAutoRun.exe

\Flash File Store\2577\AutoExec.exe

 

 

5

 

\FFS\2577\AutoExec.exe

\SD MMC Disk\2577\AutoCard.exe
\SStorage Card\2577\AutoCard.exe

launched by first lines in script AutoExec.dat

X

6

 

\FFS\2577\AutoExec.exe

 

script AutoExec.dat

 

7

 

RunAutoRun.exe

\FFS\2577\AutoRun.exe

script AutoRun.dat, will start after AutoExec.exe

 

8

 

 

 

script AutoUser.dat is called in last line of AutoRun.dat

x

 

RunAutoRun will only execute the first found AutoRun.exe! RunAutoRun.exe will not process AutoRun.exe as the OS does when inserting a memory card. An existing AutoRun.exe will be searched for after AutoExec.exe has finished. The executable is searched in the processor specific dir (2577) on temporary volumes in the same order as Autoexec.exe. ITC also provides a AutoRun.exe which uses an dat file as script as AutoExec.dat does. But instead of using AutoExec.dat or AutoRun.dat to customize a device, it is recommended you use AutoCard.exe or AutoUser.dat.

Autoexec.exe processes a 'script' file called autoexec.dat. A typical autoexec.dat looks like this:

You see, that there are additional tools involved. I will try to explain there use.

Signal

This keyword and a string will signal an event, so following applications can wait for the event before they continue. I. e. RunAutoRun.exe will wait for "autoexec_stopped" before it launches AutoRun.exe.

AutoCard

First there are to calls to AutoCard.exe. You can use this to place such an exe onto a memory card and it will then be launched before all other tools listed in autoexec.dat.

CleanHouse

Unfortunately I don't now, what the next tool (CleanHouse) exactly does. Skip this.

FolderCopy

FolderCopy.exe will copy a relative source dir ..\Persistent Copy to the root. You can not specify the source or destination dir. If there are zlib like compressed files, foldercopy will expand them automatically. After copying the files, they get the SYSTEM attribute set. FolderCopy does not copy files with system attribute except you specify -F to force the copying of all files or the hidden file \Windows\_FolderCopy.hst does not exists. The parameters for FolderCopy are -F0|1 to disable/enable forced copy, -LOG=0|1 to disable/enable logging to a file FolderCopy.txt, -MOVE=0|1 to disable/enable moving the files instead of making a copy and -QUIET=0|1 to disable/enable message boxes for fatal errors.

AutoCab

AutoCab.exe will install cab files. To keep track of which cab files have already been installed, AutoCab will set the system attribute on cab files that have been installed. If a cab file is read only, the file will not be deleted. Normally a cab is deleted after it has been installed. AutoCab can be used to install all cab files for a given directory or to install a single cab file. There are several different parameters supported:
-CHKRST=0|1 disable/enbale reset file check. If there is a file called __resetmeplease__.txt in one of the following directories, the device will be booted by autocab.exe.

-FILE=      used to specify single cab files to install
-FORCE      will force the install of all found cab files. Autocab.exe will not check for the system flag of previous installed cabs. You can also force installation by deleting the hidden file \Windows\_AutoCab.hst
-LOG=0|1    disable/enable logging to a text file in the same dir as autocab.exe is running
-MOVE=0|1   disable/enable forced deleting of source cab files, regardless of the read only attribute
-QUIET=0|1  disable/enable showing error message boxes
-SHOW=0|1|2 show no progress information / show default process information / show ITC style process information

If you need a special order in installing the cab files, in example, first sqlce runtimes and then your application, you should either install the cab files separately with one AutoCab line for each cab file. Alternatively you can create an autocab.dat file in the 2577 where AutoCab.exe is located. In this file specify the full qualified file names of the cab files including the directory in the order they should install.

Additionally ITC AutoCab.exe will check for valid calibration data and, for synchronization, if welcome.exe is running.

AutoCab annoyances

Although working with autocab looks like being straight forward, there are some strange side effects. If you work with autocab below 'Flash File Store' and would like to specify the order of cab files to install, you must ensure, that your custom cab files files are NOT dated after the ITC cab files.

If the time stamp of your cab files is newer then the time stamp of the ITC files, the newer cabs will install BEFORE the ITC ones.

If you specify an order by having a list with full qualified cab file names (an autocab.dat) in 'Flash File Store\2577', your 'newer' cabs will install BEFORE and AFTER the ITC cab files. This mostly results in a warning, that a software is already installed as soon as autocab tries to install the cab file again due to the list file. The first install takes place without using the autocab.dat. It looks like autocab launched with '-FILE="\CabFiles"' does also look in 'Flash File Store\Cabfiles' for cabs to install.

If you have a memory card, I recommend you use that as source for the automatic install instead of using the Flash File Store directory. Put your files below CabFiles in the root of your memory card. Create a 2577 dir in the root of the memory card with autocab.exe, autorun.exe, autorun.dat and possibly autocab.dat and autouser.dat. The autorun.dat should look like this:

WAIT 30
EXEC "SDMMC Disk\2577\AutoCab.exe" -NOSHOW=1
CALL "SDMMC Disk\2577\AutoUser.dat"

Replace SDMMC Disk by Storage Card if your memory card is named so. On windows (PocketPC) startup, RunAutoRun.exe will launch autorun.exe in 2577 dir of the memory card automatically after the ffs\2577\autorun.exe. Here is an archived sample of the SDMMC Disk contents. In AutoUser.dat you can specify one or more applications to run automatically (see Autorun for details).

Tracking installed software

Although AutoCab keeps tracking of installed cabs (by setting the SYSTEM attribute), the OS itself stores information about already installed software. A software installation will normally add or change files, change registry settings and so on. If a cab contains a setupdll.dll, this will have four different entry points: install_init, install_exit, uninstall_init, uninstall_exit. As several sw installation cabs have all there own setupdll.dll and the cabs maybe removed, the OS copies these setupdll.dlls to Windows\AppMgr with a name according to the installed sw (ie Microsoft SQLCE 2.0.DLL comes out of the sqlce cab). Below HKLM\Software\Apps the OS keeps track of installed sw for managing issues. The apps listed here are the ones listed when you open Start-Settings-System-Remove Programs. These registry keys remain there also after a program has been removed. To avoid messages about Re-Install, you can write a setupdll that will reset the Instl value to zero (HKLM\Software\App\...) either on Install_Init or Install_Exit.

AutoCopy

(autocopy.exe) is used to copy or move files from one location to another. The Parameters are: AutoCopy [-D["W"]] [-L["X"]] [-M[D]] [-Q[Y]] [-S["Z"]]
-D Used to indicate destination file name and must be fully qualified.
-L Used to indicate fully qualified filename for logging to be enabled.
-M0|1 disable/enable move file to destination rather than copy.
-Q Used to indicate whether a message box should appear when a fatal error occurs. Default is disabled. Y is an integer value.
-S Used to indicate source file name and must be fully qualified. Z is a string value.

AutoRun

After AutoExec has finished, RunAutoRun.exe will call AutoRun.exe. AutoRun.exe uses a script file named autorun.dat. A typical AutoRun.Dat looks like this:

EXEC "Flash File Store\2577\AutoCab.exe" -CHKRST=1 -SHOW=1
CALL "Flash File Store\2577\AutoUser.dat"

As AutoCab here is invoked without a file parameter, it will look for cab files in a relative dir ..\CabFiles for cabs to install. The second line will switch the script execution to a file named AutoUser.dat. This dat file is the third script file used per default. Any customizing should be placed into autouser.dat, it is not recommended to alter the AutoExexc.dat or AutoRun.dat.

Why there are two calls to autocab, one by AutoExec.dat and one by AutoRun.dat?

Simply to avoid you have to touch the ITC files. If you put your cab files into \Flash File Store\CabFiles, they will automatically installed after the ITC ones (which are first copied from FFS\Persistent Copy\CabFiles to \CabFiles and then are installed from there.

Additional ITC tools

AutoReg

AutoReg will load/save registry files in standard reg format.
AutoReg [-D] [-HKey] [-Q] [filename]
-D Delete the registry file after successfully loading it.
-H Save the registry path, and all child entries, to the specific .reg registry file.
-Q Used to indicate whether a message box should appear when a fatal error occurs.

filename Fully qualified filename to read from or write to, encased in double quotes to support spaces in paths or filenames.

 


(1) ITC is


[Counter]