6

I've to support a legacy application, originally created for Windows NT 4 (32-bit), but still running fine under Windows 10 (64-bit), provided all of the compatibility settings are done. The problem is that these have to be done mostly by hand.

I'm trying to figure out how to build a program or script that I could deliver for that purpose. I already know that the compatibility settings are stored in the registry under HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers or HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers respectively (depending whether the settings are applied to all or just a single user), by adding values whose names are the application paths like for instance

C:\Program Files (x86)\SomeApp\SomeBinary.exe 

adding contents like (for enabling compatibility to Windows XP Service Pack 3)

WINXPSP3

as observed on Windows 7, or

~ WINXPSP3

as observed on Windows 8.1 (and Windows 8)

What I want to understand before shipping such a tool is:

What is the purpose or meaning of the tilde sign starting the value contents?

I'm searching for it for months (Google, Bing) but by now, I found nothing but questions. There's only a guess that it as well could be meaningless(?):

When compatibility mode is set via Properties, Windoze places a tilde (~) followed by a space before the value, e.g. "~ WINXPSP3". Yet it seems to work (or not work as the case may be) regardless of the tilde.

But most suggestions about adjusting compatibility settings seem to take much care of this magic char:

Note that there is a space between the tilde and the HIGHDPIAWARE.

Is there anybody who really knows something about it?

1

1 Answer 1

1

I was looking into this same thing and found this (emphasis mine):

If the value contains the sequence tilde [~], then the value is interpreted as a Null-delimited list of strings (REG_MULTI_SZ). For example, to specify a list containing the three strings a, b and c, use "a[~]b[~]c".

The sequence [~] within the value separates the individual strings and is interpreted and stored as a Null character.

If a [~] precedes the string list, the strings are to be appended to any existing registry value strings. If an appending string already occurs in the registry value, the original occurrence of the string is removed.

If a [~] follows the end of the string list, the strings are to be prepended to any existing registry value strings. If a prepending string already occurs in the registry value, the original occurrence of the string is removed.

If a [~] is at both the beginning and the end or at neither the beginning nor the end of the string list, the strings are to replace any existing registry value strings.

Otherwise, the value is interpreted and stored as a string (REG_SZ).

Source: the article Registry Table (Windows) in the Installer Database Reference

So it appears that the tilde character just appends or prepends string values.

2
  • Interesting point, not sure if it's really the answer. This does not help to understand why it first appeared in Win8, another point is that the compatibility switches themselves are separated by space (exactly as the ~ at the beginning is separated). Another open question: What could this mean the strings are to be appended to any existing registry value strings ?? appended where for instance?
    – Wolf
    Jul 12, 2016 at 14:08
  • 2
    Finally, and sadly, I found this not helpful. There's is only a syntactic match, but the meaning cannot be related, because they are working on different "platforms": My question is about static registry values in a system, your answer is about enabling an installer to make changes to such keys on the target system.
    – Wolf
    Jan 12, 2017 at 11:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .