ReactOS 0.4.15-dev-7953-g1f49173
mlang.idl File Reference

Go to the source code of this file.

Classes

interface  MultiLanguage::IMLangCodePages
 
interface  MultiLanguage::IMLangFontLink
 
interface  MultiLanguage::IEnumScript
 
struct  MultiLanguage::IEnumScript::tagSCRIPFONTINFO
 
struct  MultiLanguage::IEnumScript::tagSCRIPTINFO
 
interface  MultiLanguage::IMLangFontLink2
 
struct  MultiLanguage::IMLangFontLink2::tagUNICODERANGE
 
interface  MultiLanguage::IMLangString
 
interface  MultiLanguage::IMLangLineBreakConsole
 
interface  MultiLanguage::IEnumCodePage
 
struct  MultiLanguage::IEnumCodePage::tagMIMECPINFO
 
struct  MultiLanguage::IEnumCodePage::tagMIMECSETINFO
 
interface  MultiLanguage::IMLangConvertCharset
 
class  MultiLanguage::CMLangConvertCharset
 
interface  MultiLanguage::IEnumRfc1766
 
struct  MultiLanguage::IEnumRfc1766::tagRFC1766INFO
 
interface  MultiLanguage::IMultiLanguage
 
interface  MultiLanguage::IMultiLanguage2
 
struct  MultiLanguage::IMultiLanguage2::tagDetectEncodingInfo
 
interface  MultiLanguage::IMultiLanguage3
 
class  MultiLanguage::CMultiLanguage
 

Modules

library  MultiLanguage
 

Functions

 MultiLanguage::importlib ("stdole2.tlb")
 
STDAPI LcidToRfc1766A (LCID, LPSTR, INT)
 
STDAPI LcidToRfc1766W (LCID, LPWSTR, INT)
 
STDAPI Rfc1766ToLcidA (LCID *, LPCSTR)
 
STDAPI Rfc1766ToLcidW (LCID *, LPCWSTR)
 
STDAPI GetGlobalFontLinkObject (void **unknown)
 
STDAPI IsConvertINetStringAvailable (DWORD, DWORD)
 
STDAPI ConvertINetString (LPDWORD, DWORD, DWORD, LPCSTR, LPINT, LPSTR, LPINT)
 
STDAPI ConvertINetMultiByteToUnicode (LPDWORD, DWORD, LPCSTR, LPINT, LPWSTR, LPINT)
 
STDAPI ConvertINetUnicodeToMultiByte (LPDWORD, DWORD, LPCWSTR, LPINT, LPSTR, LPINT)
 

Function Documentation

◆ ConvertINetMultiByteToUnicode()

STDAPI ConvertINetMultiByteToUnicode ( LPDWORD  pdwMode,
DWORD  dwEncoding,
LPCSTR  pSrcStr,
LPINT  pcSrcSize,
LPWSTR  pDstStr,
LPINT  pcDstSize 
)

Definition at line 952 of file mlang.c.

959{
960 INT src_len = -1;
961
962 TRACE("%p %d %s %p %p %p\n", pdwMode, dwEncoding,
963 debugstr_a(pSrcStr), pcSrcSize, pDstStr, pcDstSize);
964
965 if (!pcDstSize)
966 return E_FAIL;
967
968 if (!pcSrcSize)
969 pcSrcSize = &src_len;
970
971 if (!*pcSrcSize)
972 {
973 *pcDstSize = 0;
974 return S_OK;
975 }
976
977 /* forwarding euc-jp to EUC-JP */
978 if (dwEncoding == 51932)
979 dwEncoding = 20932;
980
981 switch (dwEncoding)
982 {
983 case CP_UNICODE:
984 if (*pcSrcSize == -1)
985 *pcSrcSize = lstrlenW((LPCWSTR)pSrcStr);
986 *pcDstSize = min(*pcSrcSize, *pcDstSize);
987 *pcSrcSize *= sizeof(WCHAR);
988 if (pDstStr)
989 memmove(pDstStr, pSrcStr, *pcDstSize * sizeof(WCHAR));
990 break;
991
992 case 50220:
993 case 50221:
994 case 50222:
995 *pcDstSize = ConvertJISJapaneseToUnicode(pSrcStr,*pcSrcSize,pDstStr,*pcDstSize);
996 break;
997 case 50932:
998 *pcDstSize = ConvertUnknownJapaneseToUnicode(pSrcStr,*pcSrcSize,pDstStr,*pcDstSize);
999 break;
1000
1001 default:
1002 if (*pcSrcSize == -1)
1003 *pcSrcSize = lstrlenA(pSrcStr);
1004
1005 if (pDstStr)
1006 *pcDstSize = MultiByteToWideChar(dwEncoding, 0, pSrcStr, *pcSrcSize, pDstStr, *pcDstSize);
1007 else
1008 *pcDstSize = MultiByteToWideChar(dwEncoding, 0, pSrcStr, *pcSrcSize, NULL, 0);
1009 break;
1010 }
1011
1012 if (!*pcDstSize)
1013 return E_FAIL;
1014
1015 return S_OK;
1016}
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
static UINT ConvertUnknownJapaneseToUnicode(LPCSTR input, DWORD count, LPWSTR output, DWORD out_count)
Definition: mlang.c:853
static UINT ConvertJISJapaneseToUnicode(LPCSTR input, DWORD count, LPWSTR output, DWORD out_count)
Definition: mlang.c:833
#define CP_UNICODE
Definition: stg_prop.c:74
#define S_OK
Definition: intsafe.h:52
#define debugstr_a
Definition: kernel32.h:31
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define min(a, b)
Definition: monoChain.cc:55
#define TRACE(s)
Definition: solgame.cpp:4
int32_t INT
Definition: typedefs.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ ConvertINetString()

STDAPI ConvertINetString ( LPDWORD  pdwMode,
DWORD  dwSrcEncoding,
DWORD  dwDstEncoding,
LPCSTR  pSrcStr,
LPINT  pcSrcSize,
LPSTR  pDstStr,
LPINT  pcDstSize 
)

Definition at line 1103 of file mlang.c.

1112{
1113 TRACE("%p %d %d %s %p %p %p\n", pdwMode, dwSrcEncoding, dwDstEncoding,
1114 debugstr_a(pSrcStr), pcSrcSize, pDstStr, pcDstSize);
1115
1116 if (dwSrcEncoding == CP_UNICODE)
1117 {
1118 INT cSrcSizeW;
1119 if (pcSrcSize && *pcSrcSize != -1)
1120 {
1121 cSrcSizeW = *pcSrcSize / sizeof(WCHAR);
1122 pcSrcSize = &cSrcSizeW;
1123 }
1124 return ConvertINetUnicodeToMultiByte(pdwMode, dwDstEncoding, (LPCWSTR)pSrcStr, pcSrcSize, pDstStr, pcDstSize);
1125 }
1126 else if (dwDstEncoding == CP_UNICODE)
1127 {
1128 HRESULT hr = ConvertINetMultiByteToUnicode(pdwMode, dwSrcEncoding, pSrcStr, pcSrcSize, (LPWSTR)pDstStr, pcDstSize);
1129 *pcDstSize *= sizeof(WCHAR);
1130 return hr;
1131 }
1132 else
1133 {
1134 INT cDstSizeW;
1135 LPWSTR pDstStrW;
1136 HRESULT hr;
1137
1138 TRACE("convert %s from %d to %d\n", debugstr_a(pSrcStr), dwSrcEncoding, dwDstEncoding);
1139
1140 hr = ConvertINetMultiByteToUnicode(pdwMode, dwSrcEncoding, pSrcStr, pcSrcSize, NULL, &cDstSizeW);
1141 if (hr != S_OK)
1142 return hr;
1143
1144 pDstStrW = HeapAlloc(GetProcessHeap(), 0, cDstSizeW * sizeof(WCHAR));
1145 hr = ConvertINetMultiByteToUnicode(pdwMode, dwSrcEncoding, pSrcStr, pcSrcSize, pDstStrW, &cDstSizeW);
1146 if (hr == S_OK)
1147 hr = ConvertINetUnicodeToMultiByte(pdwMode, dwDstEncoding, pDstStrW, &cDstSizeW, pDstStr, pcDstSize);
1148
1149 HeapFree(GetProcessHeap(), 0, pDstStrW);
1150 return hr;
1151 }
1152}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
HRESULT hr
Definition: shlfolder.c:183
static CONVERTINETMULTIBYTETOUNICODE ConvertINetMultiByteToUnicode
Definition: win_iconv.c:705
static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
Definition: win_iconv.c:706
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ ConvertINetUnicodeToMultiByte()

STDAPI ConvertINetUnicodeToMultiByte ( LPDWORD  pdwMode,
DWORD  dwEncoding,
LPCWSTR  pSrcStr,
LPINT  pcSrcSize,
LPSTR  pDstStr,
LPINT  pcDstSize 
)

Definition at line 1018 of file mlang.c.

1025{
1026 INT destsz, size;
1027 INT src_len = -1;
1028
1029 TRACE("%p %d %s %p %p %p\n", pdwMode, dwEncoding,
1030 debugstr_w(pSrcStr), pcSrcSize, pDstStr, pcDstSize);
1031
1032 if (!pcDstSize)
1033 return S_OK;
1034
1035 if (!pcSrcSize)
1036 pcSrcSize = &src_len;
1037
1038 destsz = (pDstStr) ? *pcDstSize : 0;
1039 *pcDstSize = 0;
1040
1041 if (!pSrcStr || !*pcSrcSize)
1042 return S_OK;
1043
1044 if (*pcSrcSize == -1)
1045 *pcSrcSize = lstrlenW(pSrcStr);
1046
1047 /* forwarding euc-jp to EUC-JP */
1048 if (dwEncoding == 51932)
1049 dwEncoding = 20932;
1050
1051 if (dwEncoding == CP_UNICODE)
1052 {
1053 if (*pcSrcSize == -1)
1054 *pcSrcSize = lstrlenW(pSrcStr);
1055
1056 size = min(*pcSrcSize, destsz) * sizeof(WCHAR);
1057 if (pDstStr)
1058 memmove(pDstStr, pSrcStr, size);
1059
1060 if (size >= destsz)
1061 goto fail;
1062 }
1063 else if (dwEncoding == 50220 || dwEncoding == 50221 || dwEncoding == 50222)
1064 {
1065 size = ConvertJapaneseUnicodeToJIS(pSrcStr, *pcSrcSize, NULL, 0);
1066 if (!size)
1067 goto fail;
1068
1069 if (pDstStr)
1070 {
1071 size = ConvertJapaneseUnicodeToJIS(pSrcStr, *pcSrcSize, pDstStr,
1072 destsz);
1073 if (!size)
1074 goto fail;
1075 }
1076
1077 }
1078 else
1079 {
1080 size = WideCharToMultiByte(dwEncoding, 0, pSrcStr, *pcSrcSize,
1081 NULL, 0, NULL, NULL);
1082 if (!size)
1083 goto fail;
1084
1085 if (pDstStr)
1086 {
1087 size = WideCharToMultiByte(dwEncoding, 0, pSrcStr, *pcSrcSize,
1088 pDstStr, destsz, NULL, NULL);
1089 if (!size)
1090 goto fail;
1091 }
1092 }
1093
1094 *pcDstSize = size;
1095 return S_OK;
1096
1097fail:
1098 *pcSrcSize = 0;
1099 *pcDstSize = 0;
1100 return E_FAIL;
1101}
#define WideCharToMultiByte
Definition: compat.h:111
static UINT ConvertJapaneseUnicodeToJIS(LPCWSTR input, DWORD count, LPSTR output, DWORD out_count)
Definition: mlang.c:901
GLsizeiptr size
Definition: glext.h:5919
#define debugstr_w
Definition: kernel32.h:32

◆ GetGlobalFontLinkObject()

STDAPI GetGlobalFontLinkObject ( void **  unknown)

Definition at line 3999 of file mlang.c.

4000{
4001 if (!unknown) return E_INVALIDARG;
4002
4003 FIXME("%p: stub\n", unknown);
4004
4005 return S_FALSE;
4006}
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define S_FALSE
Definition: winerror.h:2357

Referenced by test_GetGlobalFontLinkObject().

◆ IsConvertINetStringAvailable()

STDAPI IsConvertINetStringAvailable ( DWORD  dwSrcEncoding,
DWORD  dwDstEncoding 
)

Definition at line 1179 of file mlang.c.

1182{
1183 UINT src_family, dst_family;
1184
1185 TRACE("%d %d\n", dwSrcEncoding, dwDstEncoding);
1186
1187 if (GetFamilyCodePage(dwSrcEncoding, &src_family) != S_OK ||
1188 GetFamilyCodePage(dwDstEncoding, &dst_family) != S_OK)
1189 return S_FALSE;
1190
1191 if (src_family == dst_family) return S_OK;
1192
1193 /* we can convert any codepage to/from unicode */
1194 if (src_family == CP_UNICODE || dst_family == CP_UNICODE) return S_OK;
1195
1196 return S_FALSE;
1197}
static HRESULT GetFamilyCodePage(UINT uiCodePage, UINT *puiFamilyCodePage)
Definition: mlang.c:1154
unsigned int UINT
Definition: ndis.h:50

◆ LcidToRfc1766A()

STDAPI LcidToRfc1766A ( LCID  lcid,
LPSTR  pszRfc1766,
INT  nChar 
)

Definition at line 1253 of file mlang.c.

1257{
1258 TRACE("%04x %p %u\n", lcid, pszRfc1766, nChar);
1259 if (!pszRfc1766)
1260 return E_INVALIDARG;
1261
1262 return lcid_to_rfc1766A(lcid, pszRfc1766, nChar);
1263}
static HRESULT lcid_to_rfc1766A(LCID lcid, LPSTR rfc1766, INT len)
Definition: mlang.c:1199

◆ LcidToRfc1766W()

STDAPI LcidToRfc1766W ( LCID  lcid,
LPWSTR  pszRfc1766,
INT  nChar 
)

Definition at line 1265 of file mlang.c.

1269{
1270 TRACE("%04x %p %u\n", lcid, pszRfc1766, nChar);
1271 if (!pszRfc1766)
1272 return E_INVALIDARG;
1273
1274 return lcid_to_rfc1766W(lcid, pszRfc1766, nChar);
1275}
static HRESULT lcid_to_rfc1766W(LCID lcid, LPWSTR rfc1766, INT len)
Definition: mlang.c:1226

Referenced by GetAcceptLanguagesW().

◆ Rfc1766ToLcidA()

STDAPI Rfc1766ToLcidA ( LCID lcid,
LPCSTR  rfc1766A 
)

Definition at line 1319 of file mlang.c.

1320{
1321 WCHAR rfc1766W[MAX_RFC1766_NAME + 1];
1322
1323 if (!rfc1766A)
1324 return E_INVALIDARG;
1325
1326 MultiByteToWideChar(CP_ACP, 0, rfc1766A, -1, rfc1766W, MAX_RFC1766_NAME);
1327 rfc1766W[MAX_RFC1766_NAME] = 0;
1328
1329 return Rfc1766ToLcidW(lcid, rfc1766W);
1330}
#define CP_ACP
Definition: compat.h:109
HRESULT WINAPI Rfc1766ToLcidW(LCID *pLocale, LPCWSTR pszRfc1766)
Definition: mlang.c:1299

◆ Rfc1766ToLcidW()

STDAPI Rfc1766ToLcidW ( LCID pLocale,
LPCWSTR  pszRfc1766 
)

Definition at line 1299 of file mlang.c.

1300{
1301 IEnumRfc1766 *enumrfc1766;
1302 HRESULT hr;
1303
1304 TRACE("(%p, %s)\n", pLocale, debugstr_w(pszRfc1766));
1305
1306 if (!pLocale || !pszRfc1766)
1307 return E_INVALIDARG;
1308
1309 hr = EnumRfc1766_create(0, &enumrfc1766);
1310 if (FAILED(hr))
1311 return hr;
1312
1313 hr = lcid_from_rfc1766(enumrfc1766, pLocale, pszRfc1766);
1314 IEnumRfc1766_Release(enumrfc1766);
1315
1316 return hr;
1317}
static HRESULT lcid_from_rfc1766(IEnumRfc1766 *iface, LCID *lcid, LPCWSTR rfc1766)
Definition: mlang.c:1277
static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum)
Definition: mlang.c:2443
#define FAILED(hr)
Definition: intsafe.h:51

Referenced by Rfc1766ToLcidA().