avoid _wcsupr overflow so using _wcsupr_s and wcscpy_s

this is to avoid _wcsupr overflow so using _wcsupr_s and wcscpy_s, those build warnings in vs