Change EnvironmentError to OSError.
Fix bug when inserting WIC adapters.
Windows console allocation.