Replace old wprintf with fwprintf
Add missing header for DEBUGCODE macro