I think you can leave the check for _MSC_VER and remove __MINGW32__, use my macro HAVE_STRNCPY_S instead.