Fixes naming conflict with windows.h

Also fixes a small warning about an unused variable.
Merge pull request #3316 from CIB/master

Fixes naming conflict with windows.h