ReactOS  0.4.13-dev-259-g5ca9c9c
mimeintl.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "objbase.h"
#include "ole2.h"
#include "mimeole.h"
#include "mlang.h"
#include "wine/list.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "inetcomm_private.h"
Include dependency graph for mimeintl.c:

Go to the source code of this file.

Classes

struct  charset_entry
 
struct  internat_impl
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (inetcomm)
 
static internat_implimpl_from_IMimeInternational (IMimeInternational *iface)
 
static HRESULT get_mlang (IMultiLanguage **ml)
 
static HRESULT WINAPI MimeInternat_QueryInterface (IMimeInternational *iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI MimeInternat_AddRef (IMimeInternational *iface)
 
static ULONG WINAPI MimeInternat_Release (IMimeInternational *iface)
 
static HRESULT WINAPI MimeInternat_SetDefaultCharset (IMimeInternational *iface, HCHARSET hCharset)
 
static HRESULT WINAPI MimeInternat_GetDefaultCharset (IMimeInternational *iface, LPHCHARSET phCharset)
 
static HRESULT mlang_getcodepageinfo (UINT cp, MIMECPINFO *mlang_cp_info)
 
static HRESULT WINAPI MimeInternat_GetCodePageCharset (IMimeInternational *iface, CODEPAGEID cpiCodePage, CHARSETTYPE ctCsetType, LPHCHARSET phCharset)
 
static HRESULT mlang_getcsetinfo (const char *charset, MIMECSETINFO *mlang_info)
 
static HCHARSET add_charset (struct list *list, MIMECSETINFO *mlang_info, HCHARSET handle)
 
static HRESULT WINAPI MimeInternat_FindCharset (IMimeInternational *iface, LPCSTR pszCharset, LPHCHARSET phCharset)
 
static HRESULT WINAPI MimeInternat_GetCharsetInfo (IMimeInternational *iface, HCHARSET hCharset, LPINETCSETINFO pCsetInfo)
 
static HRESULT WINAPI MimeInternat_GetCodePageInfo (IMimeInternational *iface, CODEPAGEID cpiCodePage, LPCODEPAGEINFO pCodePageInfo)
 
static HRESULT WINAPI MimeInternat_CanConvertCodePages (IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest)
 
static HRESULT WINAPI MimeInternat_DecodeHeader (IMimeInternational *iface, HCHARSET hCharset, LPCSTR pszData, LPPROPVARIANT pDecoded, LPRFC1522INFO pRfc1522Info)
 
static HRESULT WINAPI MimeInternat_EncodeHeader (IMimeInternational *iface, HCHARSET hCharset, LPPROPVARIANT pData, LPSTR *ppszEncoded, LPRFC1522INFO pRfc1522Info)
 
static HRESULT WINAPI MimeInternat_ConvertBuffer (IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPBLOB pIn, LPBLOB pOut, ULONG *pcbRead)
 
static HRESULT WINAPI MimeInternat_ConvertString (IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPPROPVARIANT pIn, LPPROPVARIANT pOut)
 
static HRESULT WINAPI MimeInternat_MLANG_ConvertInetReset (IMimeInternational *iface)
 
static HRESULT WINAPI MimeInternat_MLANG_ConvertInetString (IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPCSTR pSource, int *pnSizeOfSource, LPSTR pDestination, int *pnDstSize)
 
static HRESULT WINAPI MimeInternat_Rfc1522Decode (IMimeInternational *iface, LPCSTR pszValue, LPSTR pszCharset, ULONG cchmax, LPSTR *ppszDecoded)
 
static HRESULT WINAPI MimeInternat_Rfc1522Encode (IMimeInternational *iface, LPCSTR pszValue, HCHARSET hCharset, LPSTR *ppszEncoded)
 
HRESULT MimeInternational_Construct (IMimeInternational **internat)
 
HRESULT WINAPI MimeOleGetInternat (IMimeInternational **internat)
 
HRESULT WINAPI MimeOleFindCharset (LPCSTR name, LPHCHARSET charset)
 
HRESULT WINAPI MimeOleGetCharsetInfo (HCHARSET hCharset, LPINETCSETINFO pCsetInfo)
 
HRESULT WINAPI MimeOleGetDefaultCharset (LPHCHARSET charset)
 

Variables

static IMimeInternationalVtbl mime_internat_vtbl
 
static internat_implglobal_internat
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file mimeintl.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 22 of file mimeintl.c.

Function Documentation

◆ add_charset()

static HCHARSET add_charset ( struct list list,
MIMECSETINFO *  mlang_info,
HCHARSET  handle 
)
static

Definition at line 225 of file mimeintl.c.

226 {
228 
229  WideCharToMultiByte(CP_ACP, 0, mlang_info->wszCharset, -1,
230  charset->cs_info.szName, sizeof(charset->cs_info.szName), NULL, NULL);
231  charset->cs_info.cpiWindows = mlang_info->uiCodePage;
232  charset->cs_info.cpiInternet = mlang_info->uiInternetEncoding;
233  charset->cs_info.hCharset = handle;
234  charset->cs_info.dwReserved1 = 0;
235  list_add_head(list, &charset->entry);
236 
237  return charset->cs_info.hCharset;
238 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
CFF_Charset charset
Definition: cffcmap.c:138
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
Definition: mimeintl.c:44
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: _list.h:228

Referenced by MimeInternat_FindCharset().

◆ get_mlang()

static HRESULT get_mlang ( IMultiLanguage **  ml)
inlinestatic

Definition at line 66 of file mimeintl.c.

67 {
68  return CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
69  &IID_IMultiLanguage, (void **)ml);
70 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234

Referenced by MimeInternat_CanConvertCodePages(), MimeInternat_ConvertBuffer(), MimeInternat_ConvertString(), mlang_getcodepageinfo(), and mlang_getcsetinfo().

◆ impl_from_IMimeInternational()

static internat_impl* impl_from_IMimeInternational ( IMimeInternational *  iface)
inlinestatic

Definition at line 61 of file mimeintl.c.

62 {
63  return CONTAINING_RECORD(iface, internat_impl, IMimeInternational_iface);
64 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by MimeInternat_AddRef(), MimeInternat_FindCharset(), MimeInternat_GetCharsetInfo(), MimeInternat_GetDefaultCharset(), MimeInternat_Release(), and MimeInternat_SetDefaultCharset().

◆ MimeInternat_AddRef()

static ULONG WINAPI MimeInternat_AddRef ( IMimeInternational *  iface)
static

Definition at line 86 of file mimeintl.c.

87 {
89  return InterlockedIncrement(&This->refs);
90 }
static internat_impl * impl_from_IMimeInternational(IMimeInternational *iface)
Definition: mimeintl.c:61
#define InterlockedIncrement
Definition: armddk.h:53

◆ MimeInternat_CanConvertCodePages()

static HRESULT WINAPI MimeInternat_CanConvertCodePages ( IMimeInternational *  iface,
CODEPAGEID  cpiSource,
CODEPAGEID  cpiDest 
)
static

Definition at line 313 of file mimeintl.c.

315 {
316  HRESULT hr;
317  IMultiLanguage *ml;
318 
319  TRACE("(%p)->(%d, %d)\n", iface, cpiSource, cpiDest);
320 
321  /* Could call mlang.IsConvertINetStringAvailable() to avoid the COM overhead if need be. */
322 
323  hr = get_mlang(&ml);
324  if(SUCCEEDED(hr))
325  {
326  hr = IMultiLanguage_IsConvertible(ml, cpiSource, cpiDest);
327  IMultiLanguage_Release(ml);
328  }
329 
330  return hr;
331 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:66
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeInternat_ConvertBuffer()

static HRESULT WINAPI MimeInternat_ConvertBuffer ( IMimeInternational *  iface,
CODEPAGEID  cpiSource,
CODEPAGEID  cpiDest,
LPBLOB  pIn,
LPBLOB  pOut,
ULONG pcbRead 
)
static

Definition at line 351 of file mimeintl.c.

354 {
355  HRESULT hr;
356  IMultiLanguage *ml;
357 
358  TRACE("(%p)->(%d, %d, %p, %p, %p)\n", iface, cpiSource, cpiDest, pIn, pOut, pcbRead);
359 
360  *pcbRead = 0;
361  pOut->cbSize = 0;
362 
363  /* Could call mlang.ConvertINetString() to avoid the COM overhead if need be. */
364 
365  hr = get_mlang(&ml);
366  if(SUCCEEDED(hr))
367  {
368  DWORD mode = 0;
369  UINT in_size = pIn->cbSize, out_size;
370 
371  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, pIn->pBlobData, &in_size,
372  NULL, &out_size);
373  if(hr == S_OK) /* S_FALSE means the conversion could not be performed */
374  {
376  if(!pOut->pBlobData)
377  hr = E_OUTOFMEMORY;
378  else
379  {
380  mode = 0;
381  in_size = pIn->cbSize;
382  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, pIn->pBlobData, &in_size,
383  pOut->pBlobData, &out_size);
384 
385  if(hr == S_OK)
386  {
387  *pcbRead = in_size;
388  pOut->cbSize = out_size;
389  }
390  else
391  CoTaskMemFree(pOut->pBlobData);
392  }
393  }
394  IMultiLanguage_Release(ml);
395  }
396 
397  return hr;
398 }
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT hr
Definition: shlfolder.c:183
BYTE * pBlobData
Definition: nspapi.h:59
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:66
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
ULONG cbSize
Definition: nspapi.h:58
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG in_size
Definition: file.c:100
GLenum mode
Definition: glext.h:6217
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeInternat_ConvertString()

static HRESULT WINAPI MimeInternat_ConvertString ( IMimeInternational *  iface,
CODEPAGEID  cpiSource,
CODEPAGEID  cpiDest,
LPPROPVARIANT  pIn,
LPPROPVARIANT  pOut 
)
static

Definition at line 400 of file mimeintl.c.

403 {
404  HRESULT hr;
405  int src_len;
406  IMultiLanguage *ml;
407 
408  TRACE("(%p)->(%d, %d, %p %p)\n", iface, cpiSource, cpiDest, pIn, pOut);
409 
410  switch(pIn->vt)
411  {
412  case VT_LPSTR:
413  if(cpiSource == CP_UNICODE) cpiSource = GetACP();
414  src_len = strlen(pIn->u.pszVal);
415  break;
416  case VT_LPWSTR:
417  cpiSource = CP_UNICODE;
418  src_len = strlenW(pIn->u.pwszVal) * sizeof(WCHAR);
419  break;
420  default:
421  return E_INVALIDARG;
422  }
423 
424  hr = get_mlang(&ml);
425  if(SUCCEEDED(hr))
426  {
427  DWORD mode = 0;
428  UINT in_size = src_len, out_size;
429 
430  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, (BYTE*)pIn->u.pszVal, &in_size,
431  NULL, &out_size);
432  if(hr == S_OK) /* S_FALSE means the conversion could not be performed */
433  {
434  out_size += (cpiDest == CP_UNICODE) ? sizeof(WCHAR) : sizeof(char);
435 
436  pOut->u.pszVal = CoTaskMemAlloc(out_size);
437  if(!pOut->u.pszVal)
438  hr = E_OUTOFMEMORY;
439  else
440  {
441  mode = 0;
442  in_size = src_len;
443  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, (BYTE*)pIn->u.pszVal, &in_size,
444  (BYTE*)pOut->u.pszVal, &out_size);
445 
446  if(hr == S_OK)
447  {
448  if(cpiDest == CP_UNICODE)
449  {
450  pOut->u.pwszVal[out_size / sizeof(WCHAR)] = 0;
451  pOut->vt = VT_LPWSTR;
452  }
453  else
454  {
455  pOut->u.pszVal[out_size] = '\0';
456  pOut->vt = VT_LPSTR;
457  }
458  }
459  else
460  CoTaskMemFree(pOut->u.pszVal);
461  }
462  }
463  IMultiLanguage_Release(ml);
464  }
465  return hr;
466 }
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:66
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
UINT WINAPI GetACP(VOID)
Definition: nls.c:2169
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG in_size
Definition: file.c:100
unsigned char BYTE
Definition: mem.h:68
GLenum mode
Definition: glext.h:6217
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
#define CP_UNICODE
Definition: stg_prop.c:81
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeInternat_DecodeHeader()

static HRESULT WINAPI MimeInternat_DecodeHeader ( IMimeInternational *  iface,
HCHARSET  hCharset,
LPCSTR  pszData,
LPPROPVARIANT  pDecoded,
LPRFC1522INFO  pRfc1522Info 
)
static

Definition at line 333 of file mimeintl.c.

337 {
338  FIXME("stub\n");
339  return E_NOTIMPL;
340 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeInternat_EncodeHeader()

static HRESULT WINAPI MimeInternat_EncodeHeader ( IMimeInternational *  iface,
HCHARSET  hCharset,
LPPROPVARIANT  pData,
LPSTR ppszEncoded,
LPRFC1522INFO  pRfc1522Info 
)
static

Definition at line 342 of file mimeintl.c.

346 {
347  FIXME("stub\n");
348  return E_NOTIMPL;
349 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeInternat_FindCharset()

static HRESULT WINAPI MimeInternat_FindCharset ( IMimeInternational *  iface,
LPCSTR  pszCharset,
LPHCHARSET  phCharset 
)
static

Definition at line 240 of file mimeintl.c.

242 {
244  HRESULT hr = MIME_E_NOT_FOUND;
246 
247  TRACE("(%p)->(%s, %p)\n", iface, debugstr_a(pszCharset), phCharset);
248 
249  *phCharset = NULL;
250 
252 
254  {
255  if(!lstrcmpiA(charset->cs_info.szName, pszCharset))
256  {
257  *phCharset = charset->cs_info.hCharset;
258  hr = S_OK;
259  break;
260  }
261  }
262 
263  if(hr == MIME_E_NOT_FOUND)
264  {
265  MIMECSETINFO mlang_info;
266 
268  hr = mlang_getcsetinfo(pszCharset, &mlang_info);
270 
271  if(SUCCEEDED(hr))
272  *phCharset = add_charset(&This->charsets, &mlang_info,
273  UlongToHandle(InterlockedIncrement(&This->next_charset_handle)));
274  }
275 
277  return hr;
278 }
CFF_Charset charset
Definition: cffcmap.c:138
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
HRESULT hr
Definition: shlfolder.c:183
Definition: mimeintl.c:44
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
static HCHARSET add_charset(struct list *list, MIMECSETINFO *mlang_info, HCHARSET handle)
Definition: mimeintl.c:225
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
#define UlongToHandle(ul)
Definition: basetsd.h:97
uint32_t entry
Definition: isohybrid.c:63
static internat_impl * impl_from_IMimeInternational(IMimeInternational *iface)
Definition: mimeintl.c:61
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static HRESULT mlang_getcsetinfo(const char *charset, MIMECSETINFO *mlang_info)
Definition: mimeintl.c:204
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeInternat_GetCharsetInfo()

static HRESULT WINAPI MimeInternat_GetCharsetInfo ( IMimeInternational *  iface,
HCHARSET  hCharset,
LPINETCSETINFO  pCsetInfo 
)
static

Definition at line 280 of file mimeintl.c.

282 {
284  HRESULT hr = MIME_E_INVALID_HANDLE;
286 
287  TRACE("(%p)->(%p, %p)\n", iface, hCharset, pCsetInfo);
288 
290 
292  {
293  if(charset->cs_info.hCharset == hCharset)
294  {
295  *pCsetInfo = charset->cs_info;
296  hr = S_OK;
297  break;
298  }
299  }
300 
302 
303  return hr;
304 }
CFF_Charset charset
Definition: cffcmap.c:138
HRESULT hr
Definition: shlfolder.c:183
Definition: mimeintl.c:44
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
uint32_t entry
Definition: isohybrid.c:63
static internat_impl * impl_from_IMimeInternational(IMimeInternational *iface)
Definition: mimeintl.c:61
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ MimeInternat_GetCodePageCharset()

static HRESULT WINAPI MimeInternat_GetCodePageCharset ( IMimeInternational *  iface,
CODEPAGEID  cpiCodePage,
CHARSETTYPE  ctCsetType,
LPHCHARSET  phCharset 
)
static

Definition at line 163 of file mimeintl.c.

166 {
167  HRESULT hr;
168  MIMECPINFO mlang_cp_info;
169 
170  TRACE("(%p)->(%d, %d, %p)\n", iface, cpiCodePage, ctCsetType, phCharset);
171 
172  *phCharset = NULL;
173 
174  hr = mlang_getcodepageinfo(cpiCodePage, &mlang_cp_info);
175  if(SUCCEEDED(hr))
176  {
177  const WCHAR *charset_nameW = NULL;
178  char *charset_name;
179  DWORD len;
180 
181  switch(ctCsetType)
182  {
183  case CHARSET_BODY:
184  charset_nameW = mlang_cp_info.wszBodyCharset;
185  break;
186  case CHARSET_HEADER:
187  charset_nameW = mlang_cp_info.wszHeaderCharset;
188  break;
189  case CHARSET_WEB:
190  charset_nameW = mlang_cp_info.wszWebCharset;
191  break;
192  default:
193  return MIME_E_INVALID_CHARSET_TYPE;
194  }
195  len = WideCharToMultiByte(CP_ACP, 0, charset_nameW, -1, NULL, 0, NULL, NULL);
196  charset_name = HeapAlloc(GetProcessHeap(), 0, len);
197  WideCharToMultiByte(CP_ACP, 0, charset_nameW, -1, charset_name, len, NULL, NULL);
198  hr = IMimeInternational_FindCharset(iface, charset_name, phCharset);
199  HeapFree(GetProcessHeap(), 0, charset_name);
200  }
201  return hr;
202 }
#define WideCharToMultiByte
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT mlang_getcodepageinfo(UINT cp, MIMECPINFO *mlang_cp_info)
Definition: mimeintl.c:148

◆ MimeInternat_GetCodePageInfo()

static HRESULT WINAPI MimeInternat_GetCodePageInfo ( IMimeInternational *  iface,
CODEPAGEID  cpiCodePage,
LPCODEPAGEINFO  pCodePageInfo 
)
static

Definition at line 306 of file mimeintl.c.

308 {
309  FIXME("stub\n");
310  return E_NOTIMPL;
311 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeInternat_GetDefaultCharset()

static HRESULT WINAPI MimeInternat_GetDefaultCharset ( IMimeInternational *  iface,
LPHCHARSET  phCharset 
)
static

Definition at line 129 of file mimeintl.c.

130 {
132  HRESULT hr = S_OK;
133 
134  TRACE("(%p)->(%p)\n", iface, phCharset);
135 
136  if(This->default_charset == NULL)
137  {
138  HCHARSET hcs;
139  hr = IMimeInternational_GetCodePageCharset(iface, GetACP(), CHARSET_BODY, &hcs);
140  if(SUCCEEDED(hr))
141  InterlockedCompareExchangePointer(&This->default_charset, hcs, NULL);
142  }
143  *phCharset = This->default_charset;
144 
145  return hr;
146 }
HRESULT hr
Definition: shlfolder.c:183
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetACP(VOID)
Definition: nls.c:2169
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static internat_impl * impl_from_IMimeInternational(IMimeInternational *iface)
Definition: mimeintl.c:61
#define S_OK
Definition: intsafe.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeInternat_MLANG_ConvertInetReset()

static HRESULT WINAPI MimeInternat_MLANG_ConvertInetReset ( IMimeInternational *  iface)
static

Definition at line 468 of file mimeintl.c.

469 {
470  FIXME("stub\n");
471  return E_NOTIMPL;
472 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeInternat_MLANG_ConvertInetString()

static HRESULT WINAPI MimeInternat_MLANG_ConvertInetString ( IMimeInternational *  iface,
CODEPAGEID  cpiSource,
CODEPAGEID  cpiDest,
LPCSTR  pSource,
int pnSizeOfSource,
LPSTR  pDestination,
int pnDstSize 
)
static

Definition at line 474 of file mimeintl.c.

480 {
481  FIXME("stub\n");
482  return E_NOTIMPL;
483 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeInternat_QueryInterface()

static HRESULT WINAPI MimeInternat_QueryInterface ( IMimeInternational *  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 72 of file mimeintl.c.

73 {
74  if (IsEqualGUID(riid, &IID_IUnknown) ||
75  IsEqualGUID(riid, &IID_IMimeInternational))
76  {
77  IMimeInternational_AddRef( iface );
78  *ppobj = iface;
79  return S_OK;
80  }
81 
82  FIXME("interface %s not implemented\n", debugstr_guid(riid));
83  return E_NOINTERFACE;
84 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ MimeInternat_Release()

static ULONG WINAPI MimeInternat_Release ( IMimeInternational *  iface)
static

Definition at line 92 of file mimeintl.c.

93 {
95  ULONG refs;
96 
97  refs = InterlockedDecrement(&This->refs);
98  if (!refs)
99  {
100  charset_entry *charset, *cursor2;
101 
103  {
104  list_remove(&charset->entry);
106  }
107  This->cs.DebugInfo->Spare[0] = 0;
110  }
111 
112  return refs;
113 }
CFF_Charset charset
Definition: cffcmap.c:138
Definition: mimeintl.c:44
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define InterlockedDecrement
Definition: armddk.h:52
uint32_t entry
Definition: isohybrid.c:63
static internat_impl * impl_from_IMimeInternational(IMimeInternational *iface)
Definition: mimeintl.c:61
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ MimeInternat_Rfc1522Decode()

static HRESULT WINAPI MimeInternat_Rfc1522Decode ( IMimeInternational *  iface,
LPCSTR  pszValue,
LPSTR  pszCharset,
ULONG  cchmax,
LPSTR ppszDecoded 
)
static

Definition at line 485 of file mimeintl.c.

489 {
490  FIXME("stub\n");
491  return E_NOTIMPL;
492 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeInternat_Rfc1522Encode()

static HRESULT WINAPI MimeInternat_Rfc1522Encode ( IMimeInternational *  iface,
LPCSTR  pszValue,
HCHARSET  hCharset,
LPSTR ppszEncoded 
)
static

Definition at line 494 of file mimeintl.c.

497 {
498  FIXME("stub\n");
499  return E_NOTIMPL;
500 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeInternat_SetDefaultCharset()

static HRESULT WINAPI MimeInternat_SetDefaultCharset ( IMimeInternational *  iface,
HCHARSET  hCharset 
)
static

Definition at line 115 of file mimeintl.c.

116 {
118 
119  TRACE("(%p)->(%p)\n", iface, hCharset);
120 
121  if(hCharset == NULL) return E_INVALIDARG;
122  /* FIXME check hCharset is valid */
123 
124  InterlockedExchangePointer(&This->default_charset, hCharset);
125 
126  return S_OK;
127 }
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
static internat_impl * impl_from_IMimeInternational(IMimeInternational *iface)
Definition: mimeintl.c:61
#define S_OK
Definition: intsafe.h:59

◆ MimeInternational_Construct()

HRESULT MimeInternational_Construct ( IMimeInternational **  internat)

Definition at line 526 of file mimeintl.c.

527 {
530  global_internat->refs = 0;
532  global_internat->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": global_internat.cs");
533 
537 
539 
540  IMimeInternational_AddRef(*internat);
541  return S_OK;
542 }
#define DWORD_PTR
Definition: treelist.c:76
static internat_impl * global_internat
Definition: mimeintl.c:524
IMimeInternational IMimeInternational_iface
Definition: mimeintl.c:52
struct list charsets
Definition: mimeintl.c:56
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HCHARSET default_charset
Definition: mimeintl.c:58
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
#define S_OK
Definition: intsafe.h:59
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static IMimeInternationalVtbl mime_internat_vtbl
Definition: mimeintl.c:502
CRITICAL_SECTION cs
Definition: mimeintl.c:54
LONG next_charset_handle
Definition: mimeintl.c:57
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852

Referenced by DllMain().

◆ MimeOleFindCharset()

HRESULT WINAPI MimeOleFindCharset ( LPCSTR  name,
LPHCHARSET  charset 
)

Definition at line 553 of file mimeintl.c.

554 {
555  IMimeInternational *internat;
556  HRESULT hr;
557 
558  TRACE("(%s, %p)\n", debugstr_a(name), charset);
559 
560  hr = MimeOleGetInternat(&internat);
561  if(SUCCEEDED(hr))
562  {
563  hr = IMimeInternational_FindCharset(internat, name, charset);
564  IMimeInternational_Release(internat);
565  }
566  return hr;
567 }
CFF_Charset charset
Definition: cffcmap.c:138
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI MimeOleGetInternat(IMimeInternational **internat)
Definition: mimeintl.c:544
Definition: name.c:36
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeOleGetCharsetInfo()

HRESULT WINAPI MimeOleGetCharsetInfo ( HCHARSET  hCharset,
LPINETCSETINFO  pCsetInfo 
)

Definition at line 569 of file mimeintl.c.

570 {
571  IMimeInternational *internat;
572  HRESULT hr;
573 
574  TRACE("(%p, %p)\n", hCharset, pCsetInfo);
575 
576  hr = MimeOleGetInternat(&internat);
577  if(SUCCEEDED(hr))
578  {
579  hr = IMimeInternational_GetCharsetInfo(internat, hCharset, pCsetInfo);
580  IMimeInternational_Release(internat);
581  }
582  return hr;
583 }
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI MimeOleGetInternat(IMimeInternational **internat)
Definition: mimeintl.c:544
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeOleGetDefaultCharset()

HRESULT WINAPI MimeOleGetDefaultCharset ( LPHCHARSET  charset)

Definition at line 585 of file mimeintl.c.

586 {
587  IMimeInternational *internat;
588  HRESULT hr;
589 
590  TRACE("(%p)\n", charset);
591 
592  hr = MimeOleGetInternat(&internat);
593  if(SUCCEEDED(hr))
594  {
595  hr = IMimeInternational_GetDefaultCharset(internat, charset);
596  IMimeInternational_Release(internat);
597  }
598  return hr;
599 }
CFF_Charset charset
Definition: cffcmap.c:138
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI MimeOleGetInternat(IMimeInternational **internat)
Definition: mimeintl.c:544
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeOleGetInternat()

HRESULT WINAPI MimeOleGetInternat ( IMimeInternational **  internat)

Definition at line 544 of file mimeintl.c.

545 {
546  TRACE("(%p)\n", internat);
547 
549  IMimeInternational_AddRef(*internat);
550  return S_OK;
551 }
static internat_impl * global_internat
Definition: mimeintl.c:524
IMimeInternational IMimeInternational_iface
Definition: mimeintl.c:52
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

Referenced by MimeOleFindCharset(), MimeOleGetCharsetInfo(), MimeOleGetDefaultCharset(), test_charset(), test_convert(), test_create(), and test_defaultcharset().

◆ mlang_getcodepageinfo()

static HRESULT mlang_getcodepageinfo ( UINT  cp,
MIMECPINFO *  mlang_cp_info 
)
static

Definition at line 148 of file mimeintl.c.

149 {
150  HRESULT hr;
151  IMultiLanguage *ml;
152 
153  hr = get_mlang(&ml);
154 
155  if(SUCCEEDED(hr))
156  {
157  hr = IMultiLanguage_GetCodePageInfo(ml, cp, mlang_cp_info);
158  IMultiLanguage_Release(ml);
159  }
160  return hr;
161 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:66
LONG HRESULT
Definition: typedefs.h:77
POINT cp
Definition: magnifier.c:61
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by MimeInternat_GetCodePageCharset().

◆ mlang_getcsetinfo()

static HRESULT mlang_getcsetinfo ( const char charset,
MIMECSETINFO *  mlang_info 
)
static

Definition at line 204 of file mimeintl.c.

205 {
207  BSTR bstr = SysAllocStringLen(NULL, len - 1);
208  HRESULT hr;
209  IMultiLanguage *ml;
210 
211  MultiByteToWideChar(CP_ACP, 0, charset, -1, bstr, len);
212 
213  hr = get_mlang(&ml);
214 
215  if(SUCCEEDED(hr))
216  {
217  hr = IMultiLanguage_GetCharsetInfo(ml, bstr, mlang_info);
218  IMultiLanguage_Release(ml);
219  }
220  SysFreeString(bstr);
221  if(FAILED(hr)) hr = MIME_E_NOT_FOUND;
222  return hr;
223 }
CFF_Charset charset
Definition: cffcmap.c:138
HRESULT hr
Definition: shlfolder.c:183
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
#define CP_ACP
Definition: compat.h:99
OLECHAR * BSTR
Definition: compat.h:1934
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:66
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
#define MultiByteToWideChar
Definition: compat.h:100
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by MimeInternat_FindCharset().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( inetcomm  )

Variable Documentation

◆ global_internat

internat_impl* global_internat
static

Definition at line 524 of file mimeintl.c.

Referenced by MimeInternational_Construct(), and MimeOleGetInternat().

◆ mime_internat_vtbl

IMimeInternationalVtbl mime_internat_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI MimeInternat_Release(IMimeInternational *iface)
Definition: mimeintl.c:92
static HRESULT WINAPI MimeInternat_ConvertString(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPPROPVARIANT pIn, LPPROPVARIANT pOut)
Definition: mimeintl.c:400
static HRESULT WINAPI MimeInternat_SetDefaultCharset(IMimeInternational *iface, HCHARSET hCharset)
Definition: mimeintl.c:115
static HRESULT WINAPI MimeInternat_GetCodePageCharset(IMimeInternational *iface, CODEPAGEID cpiCodePage, CHARSETTYPE ctCsetType, LPHCHARSET phCharset)
Definition: mimeintl.c:163
static HRESULT WINAPI MimeInternat_GetCharsetInfo(IMimeInternational *iface, HCHARSET hCharset, LPINETCSETINFO pCsetInfo)
Definition: mimeintl.c:280
static HRESULT WINAPI MimeInternat_CanConvertCodePages(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest)
Definition: mimeintl.c:313
static HRESULT WINAPI MimeInternat_ConvertBuffer(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPBLOB pIn, LPBLOB pOut, ULONG *pcbRead)
Definition: mimeintl.c:351
static HRESULT WINAPI MimeInternat_EncodeHeader(IMimeInternational *iface, HCHARSET hCharset, LPPROPVARIANT pData, LPSTR *ppszEncoded, LPRFC1522INFO pRfc1522Info)
Definition: mimeintl.c:342
static HRESULT WINAPI MimeInternat_FindCharset(IMimeInternational *iface, LPCSTR pszCharset, LPHCHARSET phCharset)
Definition: mimeintl.c:240
static ULONG WINAPI MimeInternat_AddRef(IMimeInternational *iface)
Definition: mimeintl.c:86
static HRESULT WINAPI MimeInternat_GetDefaultCharset(IMimeInternational *iface, LPHCHARSET phCharset)
Definition: mimeintl.c:129
static HRESULT WINAPI MimeInternat_DecodeHeader(IMimeInternational *iface, HCHARSET hCharset, LPCSTR pszData, LPPROPVARIANT pDecoded, LPRFC1522INFO pRfc1522Info)
Definition: mimeintl.c:333
static HRESULT WINAPI MimeInternat_MLANG_ConvertInetString(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPCSTR pSource, int *pnSizeOfSource, LPSTR pDestination, int *pnDstSize)
Definition: mimeintl.c:474
static HRESULT WINAPI MimeInternat_MLANG_ConvertInetReset(IMimeInternational *iface)
Definition: mimeintl.c:468
static HRESULT WINAPI MimeInternat_Rfc1522Encode(IMimeInternational *iface, LPCSTR pszValue, HCHARSET hCharset, LPSTR *ppszEncoded)
Definition: mimeintl.c:494
static HRESULT WINAPI MimeInternat_GetCodePageInfo(IMimeInternational *iface, CODEPAGEID cpiCodePage, LPCODEPAGEINFO pCodePageInfo)
Definition: mimeintl.c:306
static HRESULT WINAPI MimeInternat_QueryInterface(IMimeInternational *iface, REFIID riid, LPVOID *ppobj)
Definition: mimeintl.c:72
static HRESULT WINAPI MimeInternat_Rfc1522Decode(IMimeInternational *iface, LPCSTR pszValue, LPSTR pszCharset, ULONG cchmax, LPSTR *ppszDecoded)
Definition: mimeintl.c:485

Definition at line 502 of file mimeintl.c.

Referenced by MimeInternational_Construct().