Move the #ifndef WIN32 to inside the function. Then we can also use it for other OSes.

BTW: I suppose `src/test/test_bitcoin.cpp` and `src/qt/test/test_main.cpp` need this too?