Applied patches from johnnypops to recent branch

Refs: #2157

git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/win-stdio-2157-4@43039 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb