Use _putenv_s instead of setenv on MSVC

This fixes commit 9194bc9174f98a11458d138cda7794550e262418