Fixes #4268: Move r30720 to v1.7 branch (Some windows cleanups - thanks)

---svn-pre-commit-ignore-below---

r30720 [[BR]]
Some windows cleanups - thanks to Marco Atzeri for the patch

cmr=v1.7.5:reviewer=miked