Change the way to convert wchar_t* to char* in CopyToCharArrayN()