Implement the calculation of stack bounds on windows. Fixes #11624.