Do not use a local dependent mb->wc conversion

This commit is contained in:
Kovid Goyal 2012-11-07 12:59:26 +05:30
parent 1bc9ce513d
commit f397686804

View File

@ -534,8 +534,8 @@ winutil_eject_drive(PyObject *self, PyObject *args) {
if (!PyArg_ParseTuple(args, "c", &letter)) return NULL;
if (mbtowc(&DriveLetter, &letter, 1) == -1) {
PyErr_SetString(PyExc_ValueError, "Failed to convert drive letter to wchar");
if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, &letter, 1, &DriveLetter, 1) == 0) {
PyErr_SetFromWindowsErr(0);
return NULL;
}