Cygwin support

Hi, I had to make a couple of tweaks to get this to work on Cygwin.

Tested on Windows 7 64 with Cygwin 64 1.7