Changed WIN32 to _WIN32 and fixed a couple of missing namespace issues.