42 #if defined UNICODE || defined _UNICODE
44 gpr_char_to_tchar(LPCSTR
input) {
46 int needed = MultiByteToWideChar(CP_UTF8, 0,
input, -1, NULL, 0);
47 if (needed <= 0)
return NULL;
49 MultiByteToWideChar(CP_UTF8, 0,
input, -1,
ret, needed);
54 gpr_tchar_to_char(LPCTSTR
input) {
56 int needed = WideCharToMultiByte(CP_UTF8, 0,
input, -1, NULL, 0, NULL, NULL);
57 if (needed <= 0)
return NULL;
59 WideCharToMultiByte(CP_UTF8, 0,
input, -1,
ret, needed, NULL, NULL);
71 DWORD
status = FormatMessage(
72 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
73 FORMAT_MESSAGE_IGNORE_INSERTS,
74 NULL, (DWORD)messageid, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
75 (LPTSTR)(&tmessage), 0, NULL);
77 message = gpr_tchar_to_char(tmessage);