SHGetAppCompatFlags

Declaration

Parameters

The dwMask argument tells which flags are being
queried. The following flags are defined. Names are reproduced from corresponding
registry values (see below).

Flag

Name

0x00000001

CONTEXTMENUFLUSHNOWAITALWAYS

0x00000002

DOCOBJECT

0x00000004

CORELINTERNETENUMOLDCREATEVIEWWNDWIN95DEFVIEW

0x00000008

MYCOMPUTERFIRST

0x00000010

OLDREGITEMGDN

0x00000040

LOADCOLUMNHANDLER

0x00000080

ANSI

0x00000100

0x00000200

WIN95SHLEXEC

0x00000400

STAROFFICE5PRINTER

0x00000800

NOVALIDATEFSIDS

0x00001000

FILEOPENNEEDSEXT

0x00002000

WIN95BINDTOOBJECT

0x00004000

IGNOREENUMRESET

0x00010000

ANSIDISPLAYNAMES

0x00020000

FILEOPENBOGUSCTRLID

0x00040000

FORCELFNIDLIST

0x01000000

0x02000000

RETURNALLATTRIBS

0x04000000

NODEFVIEWMSGPUMP

It is not presently intended that this page will describe what each of these
flags is for, just what this function does to report them.

Return Value

The function returns the compatibility flags for the current process. Flags can
be returned that were not requested.

Behaviour

There are two sets of compatibilty flags. All but 0x00000100 and 0x01000000 are
determined from the name of the current process’s executable and possbily also from
its product version as found in the executable’s version resources. The other two
flags are determined from window class names.

Filename Flags

The filename flags are evaluated just once per process, when this function is
first called with any of these flags in the given mask. If the process is marked
(in its executable header) as requiring Windows 5.00 or higher, then none of these
compatibilty flags apply to it and no identification is attempted.

For the function to identify the process correctly, the process’s fully-qualified
pathname must not exceed 80 characters. Failure to meet this condition is here treated
as producing undefined behaviour.

Where a filename comes with a version constraint, the compatibility flags do
not apply unless version information can be read from the executable, without exceeding
0x1000 bytes, and contains a product version from any of the following version-information
values:

\StringFileInfo\040904E4\ProductVersion

\StringFileInfo\040704E4\ProductVersion

\StringFileInfo\040904B0\ProductVersion

\StringFileInfo\04090000\ProductVersion

\StringFileInfo\100904B0\ProductVersion

\StringFileInfo\041104B0\ProductVersion

\StringFileInfo\041D04B0\ProductVersion

Built-In Constraints

Many applications have hard-coded compatibility flags.

Filename

Version

Compatibility Flags

ABCMM.EXE

LOADCOLUMNHANDLER

AUTORUN.EXE

4.00.950

ANSI

AUTORUN.EXE

4.10.1998

ANSI

CORELDRW.EXE

major version == 7

OLDREGITEMGDN

DAD9.EXE

major version == 9

CORELINTERNETENUM

FILLER51.EXE

OLDREGITEMGDN

HOTDOG4.EXE

DOCOBJECT

MSMONEY.EXE

7.05.1107

WIN95SHLEXEC

PDEXPLO.EXE

major version == 1;
major version == 2

CONTEXTMENUMYCOMPUTERFIRST

PDEXPLO.EXE

major version == 3

MYCOMPUTERFIRSTOLDREGITEMGDN

PDXWIN32.EXE

CONTEXTMENUCORELINTERNETENUMOLDREGITEMGDN

PFIM80.EXE

CONTEXTMENUCORELINTERNETENUMOLDREGITEMGDN

POWERPNT.EXE

major version == 8

WIN95SHLEXEC

PP70.EXE

LOADCOLUMNHANDLER

PP80.EXE

LOADCOLUMNHANDLER

PRWIN70.EXE

CONTEXTMENUCORELINTERNETENUM

PRWIN8.EXE

CORELINTERNETENUMOLDREGITEMGDN

PRWIN9.EXE

major version == 9

CORELINTERNETENUM

PS80.EXE

CONTEXTMENUCORELINTERNETENUMOLDREGITEMGDN

PS80.EXE

OLDREGITEMGDN

QFINDER.EXE

CORELINTERNETENUMOLDREGITEMGDN

QPW.EXE

major version == 7

CONTEXTMENU

QPW.EXE

major version == 8

ANSIDISPLAYNAMESCORELINTERNETENUMOLDREGITEMGDN

QPW.EXE

major version == 9

CORELINTERNETENUM

RNAAPP.EXE

CONTEXTMENU

SITEBUILDER.EXE

CONTEXTMENUCORELINTERNETENUMOLDREGITEMGDN

SIZEMGR.EXE

major version == 3

CORELINTERNETENUMOLDREGITEMGDN

softice.EXE

major version == 5

STAROFFICE5PRINTER

SMARTCTR.EXE

96.0

CONTEXTMENU

UA80.EXE

CONTEXTMENUCORELINTERNETENUMOLDREGITEMGDN

UE32.EXE

2.00.0.0

OLDREGITEMGDN

WPWIN7.EXE

CONTEXTMENUCORELINTERNETENUM

WPWIN8.EXE

CORELINTERNETENUMOLDREGITEMGDN

WPWIN9.EXE

major version == 9

CORELINTERNETENUM

Note that PS80.EXE appears twice in the function’s tables but since neither entry
has version criteria, only the first is ever matched.

Registry Settings

All processes can also have compatibility flags set through the registry, in
the following key and in each of its subkeys:

The names of any subkeys are irrelevant. Their purpose is just to allow multiple
definitions for the one process, most notably because different compatibility flags
are required for different versions of the application.

Within each key, data for a value named RequiredFile
may specify a file (or pathname relative to the directory that contains the process’s
executable) such that compatibility flags defined in this key are to apply only
if the specified file exists. String data is intended, but the function accepts
data of other types, with bytes interpreted as ANSI characters.

Data for a value named Version may specify any
number of version constraints, such that compatibility flags defined in the key
apply only if the process’s executable satisfies at least one of the version constraints.
Again, string data is intended, but data of other types is accepted, with bytes
interpreted as ANSI characters. The data is a sequence of constraints separated
by semicolons. If the first character in a constraint is 0x01, then the characters
that follow specify a major version, to be matched against the product version up
to but not including the first period or comma. In general however, the constraint
is to match the whole of the product version, but with an asterisk allowed in the
constraint as a wildcard which matches all remaining characters in the product version.

Other values anticipated in the key represent the compatibility flags. To each
flag, there corresponds one or more registry values, as listed above. If the value
is readable, whatever its data, then the application has that flag. The function
tests for each of the defined values and returns the combination. If the application
also has hard-coded compatibility flags, then the two sets of flags are combined.

Window Class Name Flags

The window class name flags are evaluated just once per process, when this function
is first called with either of these flags in the given mask. If among the windows
that exist at the time is any whose class name begins with either “bosa_sdm_” or
“File Open Message Window”, then both compatibility flags 0x00000100 and 0x01000000
apply.

The returned compatibility flags include the 0x80000000 bit if the window class
name flags have yet been evaluated.

Availability

The SHGetAppCompatFlags function is exported from
SHLWAPI.DLL as ordinal 461 in the version 5.00 from Windows 2000 and Internet Explorer
5.01, and higher.

Though this function dates from as long ago as 1999, it was still not documented
by Microsoft as late as the January 2007 edition of the Windows Vista Software Development
Kit (SDK).