mingw: move common functionality to win32.h