Or, even simpler (and AFAIK modern Windows does that too): if the running application doesn't say in its application manifest "I'm a modern application which understands the new things from operating system versions A, B, C and features X, Y, Z", you know it's a legacy application and you can activate the relevant compatibility shims.