This function will search for the first storage card and construct the path that would be used to look for an autorun file. It is not necessary that the autorun file or directory actually be present on the storage card, but one or more storage cards must be inserted for this function to succeed.

BOOL SHGetAutoRunPath (
  LPTSTR pAutoRunPath 


Reference to a user-allocated string (must be allocated to at least MAX_PATH characters). If successful, the full pathname to the autorun directory will be copied here (for example, \Storage Card 1\ sh3\autorun.exe).

Return Values

Returns TRUE if an autorun file was detected and its path was successfully constructed and copied to pAutoRunPath.

Returns FALSE if no autorun file was detected and a path could not be copied. Either the input parameter is invalid, a storage card is not currently inserted, or there is no autorun file on the storage card(s).


This function returns a string of the form \Storage Card 1\sh3\autorun.exe.

Autorun will look for the file autorun.exe in an appropriate subdirectory, which should be named using the numeric processor value. The processor values, for processors like Mips or SH3, are the same as those found in winnt.h. The following table provides processor values for each of the supported processor types.

CPU name CPU type value
SH3 10003
MIPS 4000
ARM (SA1100) 2577
ARM (720) 1824
x86 686

In addition, if autorun.exe is not found in the processor-specific subdirectory, SHGetAutoRunPath will return \<Storage Card>\0\autorun.exe, which indicates a special processor type of 0 for a CEF executable. For example, if the storage card contained 4000\autorun.exe and 0\autorun.exe, the executable file in 4000\ would be run on a MIPS device; on an SH3 device, the executable file in 0\ would be run. As with the old name-based implementation, you may make these folders hidden to avoid cluttering up the folder view in applications like the File Explorer.

After autorun.exe begins to run, it is sometimes useful for it to know which directory it is running from, so that other files may be copied and different decisions can be made.

Note   Multiple storage cards are supported.


Pocket PC: Windows Mobile 2000 and later
OS Versions: Windows CE 3.0 and later
Header: aygshell.h
Library: aygshell.lib

Send feedback on this topic to the authors.

© 2005 Microsoft Corporation. All rights reserved.