BOOL WINAPI IsCharLowerW( WCHAR wChar) { WORD ctype1info; if (GetStringTypeW(CT_CTYPE1, &wChar, 1, &ctype1info)) { if (ctype1info & C1_LOWER) { return TRUE; } else { return FALSE; } } /* * GetStringTypeW failed! The caller is not expecting * failure, IsCharLowerW does not have a failure indicator, so we * determine the case as best we can. */ RIPMSG1(RIP_WARNING, "IsCharLowerW(L'\\x%.4lx') failed", wChar); if (IS_UNICODE_BLK1(wChar)) { return IsCharLowerA((CHAR)wChar); } else { return FALSE; } }
DWORD WINAPI CharUpperBuffW( LPWSTR pwsz, DWORD cwch) { int cwchT; DWORD i; if (cwch == 0) { return 0; } cwchT = LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, pwsz, cwch, pwsz, cwch); if (cwchT != 0) { return cwchT; } /* * LCMapString failed! The caller is not expecting failure, * CharUpperBuffW does not have a failure indicator, so we * convert the buffer to upper case as best we can. */ RIPMSG1(RIP_WARNING, "CharUpperBuffW(%ls) failed", pwsz); for (i=0; i < cwch; i++) { if (IS_UNICODE_BLK1(pwsz[i]) && IsCharLowerA((char)pwsz[i]) && (pwsz[i] != LATIN_SMALL_LETTER_SHARP_S) && (pwsz[i] != LATIN_SMALL_LETTER_Y_DIAERESIS)) { pwsz[i] += (WCHAR)('A'-'a'); } } return cwch; }
void LocalUpperInit() { for (unsigned int I=0; I<ARRAYSIZE(LowerToUpper); I++) { char CvtStr[]={I,L'\0'},ReverseCvtStr[2]; LowerToUpper[I]=UpperToLower[I]=I; OemToCharA(CvtStr,CvtStr); CharToOemA(CvtStr,ReverseCvtStr); IsUpperOrLower[I]=0; if (IsCharAlphaA(CvtStr[0]) && ReverseCvtStr[0]==static_cast<char>(I)) { IsUpperOrLower[I]=IsCharLowerA(CvtStr[0])?1:(IsCharUpperA(CvtStr[0])?2:0); CharUpperA(CvtStr); CharToOemA(CvtStr,CvtStr); LowerToUpper[I]=CvtStr[0]; CvtStr[0]=I; OemToCharA(CvtStr,CvtStr); CharLowerA(CvtStr); CharToOemA(CvtStr,CvtStr); UpperToLower[I]=CvtStr[0]; } } }