Search PATHEXT instead of 3 hardcoded values

Better to search the PATHEXT variable instead of hard-coding an incomplete list for Windows executables. A default fallback consisting of XP's default value is also introduced just in case. The fallback value is hardcoded as a constant at the top of the file.

It also results in simpler code.