Trevin Corkery Trevin Corkery - 3 months ago 15
C++ Question

Any program that determines lowest OS required for your application to run?

Alright if my title was not clear enough, I am targeting the Windows OS and just wanted to know if there was some type of program that would let me know what "OS" or higher someone needs to run my application, for example:

Example functions used in application:
OpenFile - Minimum Supported Client: Windows XP
BCryptEncrypt - Minimum supported client: Windows Vista
...

Scan completed! Result: Minimum supported client: Windows Vista.


I know there are is an application called DependencyWalker but from what I can tell that only shows dependant .dlls. Are there any best practices or methods for determining a good minimum Operating System requirement?

Answer

Such an API checker could exist. I'm not aware of any that exists though, and I suspect I know why.

It's almost certainly because it would be wrong too often.

For example, if your program uses CreateProcess() to run PowerShell, it would fail on Windows 98, but how would a tool detect that you're calling a nonexistent program? Or, if your program is calling a COM interface that doesn't exist: that wouldn't be visible in the export or import tables, either. Same with functions that are loaded dynamically at runtime using GetProcAddress().

Note that this doesn't mean the problem is impossible to solve in practical cases. However, the program is impossible to solve for all cases, and requires some pretty heavy-duty static analysis to work for most practical cases. Only unrealistic cases, like the ones you mentioned, would be trivial.