Perhaps this is a bug in mingw?
What if you move the defines to the top? Before including windows.h...

Should work.