Changed the #ifdefs to target WIN API and to have if define logic