Fix SGR control sequence handling on Windows

This fixes #1032 for me. There is also a semi-related commit attached that fixes the type used for HANDLEs.

The colour of most messages is a bit darker than before, because FOREGROUND_INTENSITY is now only set for bold text. I'm not sure if this is a good thing or not.

![image](https://cloud.githubusercontent.com/assets/162837/4023231/2bdb3cd0-2b80-11e4-953c-0abde2156ac2.png)