SHGetAutoRunPath (Windows CE 5.0)

Send Feedback

This function will search for the first storage card and construct the path that is used to look for an autorun file. The autorun file and directory do not need to be present on the storage card, but a storage card must be inserted for this function to succeed.


BOOL SHGetAutoRunPath(  LPTSTR pAutoRunPath);


  • pAutoRunPath
    [out] Pointer to a user-allocated string allocated to at least MAX_PATH characters. If successful, the full path name to the autorun directory will be copied here (for example, \Storage Card 1\2577\autorun.exe).

Return Values

Returns TRUE if a path was successfully constructed and copied to pAutoRunPath. Returns FALSE if a path could not be copied. FALSE indicates that either the input parameter is invalid or a storage card is not currently inserted.


This function returns a string in the form \Storage Card 1\2577\autorun.exe. The operating system (OS) looks for the file autorun.exe in an appropriate subdirectory, which should be named using the microprocessor ID number found in Winnt.h. The following table shows microprocessor IDs for some common microprocessor families.

Microprocessor family Microprocessor ID
All x86 microprocessors 486
SH4 10005

You can call GetSystemInfo to determine the microprocessor type and architecture for your device.

Windows Mobile Remarks

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. Autorun.exe can then determine how to manage files or take actions based on its location in the system.


OS Versions: Windows CE .NET 4.2 and later
Header: windows.h.
Library: aygshell.lib

Windows Mobile Requirements

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

See Also


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.