ReactOS  0.4.14-dev-845-g8381e29
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/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 224 of file mimeintl.c.

225 {
227 
228  WideCharToMultiByte(CP_ACP, 0, mlang_info->wszCharset, -1,
229  charset->cs_info.szName, sizeof(charset->cs_info.szName), NULL, NULL);
230  charset->cs_info.cpiWindows = mlang_info->uiCodePage;
231  charset->cs_info.cpiInternet = mlang_info->uiInternetEncoding;
232  charset->cs_info.hCharset = handle;
233  charset->cs_info.dwReserved1 = 0;
234  list_add_head(list, &charset->entry);
235 
236  return charset->cs_info.hCharset;
237 }
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:43
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
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 65 of file mimeintl.c.

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

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 60 of file mimeintl.c.

61 {
62  return CONTAINING_RECORD(iface, internat_impl, IMimeInternational_iface);
63 }
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 85 of file mimeintl.c.

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

◆ MimeInternat_CanConvertCodePages()

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

Definition at line 312 of file mimeintl.c.

314 {
315  HRESULT hr;
316  IMultiLanguage *ml;
317 
318  TRACE("(%p)->(%d, %d)\n", iface, cpiSource, cpiDest);
319 
320  /* Could call mlang.IsConvertINetStringAvailable() to avoid the COM overhead if need be. */
321 
322  hr = get_mlang(&ml);
323  if(SUCCEEDED(hr))
324  {
325  hr = IMultiLanguage_IsConvertible(ml, cpiSource, cpiDest);
326  IMultiLanguage_Release(ml);
327  }
328 
329  return hr;
330 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:65
#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 350 of file mimeintl.c.

353 {
354  HRESULT hr;
355  IMultiLanguage *ml;
356 
357  TRACE("(%p)->(%d, %d, %p, %p, %p)\n", iface, cpiSource, cpiDest, pIn, pOut, pcbRead);
358 
359  *pcbRead = 0;
360  pOut->cbSize = 0;
361 
362  /* Could call mlang.ConvertINetString() to avoid the COM overhead if need be. */
363 
364  hr = get_mlang(&ml);
365  if(SUCCEEDED(hr))
366  {
367  DWORD mode = 0;
368  UINT in_size = pIn->cbSize, out_size;
369 
370  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, pIn->pBlobData, &in_size,
371  NULL, &out_size);
372  if(hr == S_OK) /* S_FALSE means the conversion could not be performed */
373  {
375  if(!pOut->pBlobData)
376  hr = E_OUTOFMEMORY;
377  else
378  {
379  mode = 0;
380  in_size = pIn->cbSize;
381  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, pIn->pBlobData, &in_size,
382  pOut->pBlobData, &out_size);
383 
384  if(hr == S_OK)
385  {
386  *pcbRead = in_size;
387  pOut->cbSize = out_size;
388  }
389  else
390  CoTaskMemFree(pOut->pBlobData);
391  }
392  }
393  IMultiLanguage_Release(ml);
394  }
395 
396  return hr;
397 }
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:420
HRESULT hr
Definition: shlfolder.c:183
BYTE * pBlobData
Definition: nspapi.h:59
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:65
#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:404
#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 399 of file mimeintl.c.

402 {
403  HRESULT hr;
404  int src_len;
405  IMultiLanguage *ml;
406 
407  TRACE("(%p)->(%d, %d, %p %p)\n", iface, cpiSource, cpiDest, pIn, pOut);
408 
409  switch(pIn->vt)
410  {
411  case VT_LPSTR:
412  if(cpiSource == CP_UNICODE) cpiSource = GetACP();
413  src_len = strlen(pIn->u.pszVal);
414  break;
415  case VT_LPWSTR:
416  cpiSource = CP_UNICODE;
417  src_len = lstrlenW(pIn->u.pwszVal) * sizeof(WCHAR);
418  break;
419  default:
420  return E_INVALIDARG;
421  }
422 
423  hr = get_mlang(&ml);
424  if(SUCCEEDED(hr))
425  {
426  DWORD mode = 0;
427  UINT in_size = src_len, out_size;
428 
429  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, (BYTE*)pIn->u.pszVal, &in_size,
430  NULL, &out_size);
431  if(hr == S_OK) /* S_FALSE means the conversion could not be performed */
432  {
433  out_size += (cpiDest == CP_UNICODE) ? sizeof(WCHAR) : sizeof(char);
434 
435  pOut->u.pszVal = CoTaskMemAlloc(out_size);
436  if(!pOut->u.pszVal)
437  hr = E_OUTOFMEMORY;
438  else
439  {
440  mode = 0;
441  in_size = src_len;
442  hr = IMultiLanguage_ConvertString(ml, &mode, cpiSource, cpiDest, (BYTE*)pIn->u.pszVal, &in_size,
443  (BYTE*)pOut->u.pszVal, &out_size);
444 
445  if(hr == S_OK)
446  {
447  if(cpiDest == CP_UNICODE)
448  {
449  pOut->u.pwszVal[out_size / sizeof(WCHAR)] = 0;
450  pOut->vt = VT_LPWSTR;
451  }
452  else
453  {
454  pOut->u.pszVal[out_size] = '\0';
455  pOut->vt = VT_LPSTR;
456  }
457  }
458  else
459  CoTaskMemFree(pOut->u.pszVal);
460  }
461  }
462  IMultiLanguage_Release(ml);
463  }
464  return hr;
465 }
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:420
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define lstrlenW
Definition: compat.h:415
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:65
#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:2180
#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:74
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
#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 332 of file mimeintl.c.

336 {
337  FIXME("stub\n");
338  return E_NOTIMPL;
339 }
#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 341 of file mimeintl.c.

345 {
346  FIXME("stub\n");
347  return E_NOTIMPL;
348 }
#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 239 of file mimeintl.c.

241 {
243  HRESULT hr = MIME_E_NOT_FOUND;
245 
246  TRACE("(%p)->(%s, %p)\n", iface, debugstr_a(pszCharset), phCharset);
247 
248  *phCharset = NULL;
249 
251 
253  {
254  if(!lstrcmpiA(charset->cs_info.szName, pszCharset))
255  {
256  *phCharset = charset->cs_info.hCharset;
257  hr = S_OK;
258  break;
259  }
260  }
261 
262  if(hr == MIME_E_NOT_FOUND)
263  {
264  MIMECSETINFO mlang_info;
265 
267  hr = mlang_getcsetinfo(pszCharset, &mlang_info);
269 
270  if(SUCCEEDED(hr))
271  *phCharset = add_charset(&This->charsets, &mlang_info,
272  UlongToHandle(InterlockedIncrement(&This->next_charset_handle)));
273  }
274 
276  return hr;
277 }
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:43
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:224
#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:60
#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:203
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeInternat_GetCharsetInfo()

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

Definition at line 279 of file mimeintl.c.

281 {
283  HRESULT hr = MIME_E_INVALID_HANDLE;
285 
286  TRACE("(%p)->(%p, %p)\n", iface, hCharset, pCsetInfo);
287 
289 
291  {
292  if(charset->cs_info.hCharset == hCharset)
293  {
294  *pCsetInfo = charset->cs_info;
295  hr = S_OK;
296  break;
297  }
298  }
299 
301 
302  return hr;
303 }
CFF_Charset charset
Definition: cffcmap.c:138
HRESULT hr
Definition: shlfolder.c:183
Definition: mimeintl.c:43
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:60
#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 162 of file mimeintl.c.

165 {
166  HRESULT hr;
167  MIMECPINFO mlang_cp_info;
168 
169  TRACE("(%p)->(%d, %d, %p)\n", iface, cpiCodePage, ctCsetType, phCharset);
170 
171  *phCharset = NULL;
172 
173  hr = mlang_getcodepageinfo(cpiCodePage, &mlang_cp_info);
174  if(SUCCEEDED(hr))
175  {
176  const WCHAR *charset_nameW = NULL;
177  char *charset_name;
178  DWORD len;
179 
180  switch(ctCsetType)
181  {
182  case CHARSET_BODY:
183  charset_nameW = mlang_cp_info.wszBodyCharset;
184  break;
185  case CHARSET_HEADER:
186  charset_nameW = mlang_cp_info.wszHeaderCharset;
187  break;
188  case CHARSET_WEB:
189  charset_nameW = mlang_cp_info.wszWebCharset;
190  break;
191  default:
192  return MIME_E_INVALID_CHARSET_TYPE;
193  }
194  len = WideCharToMultiByte(CP_ACP, 0, charset_nameW, -1, NULL, 0, NULL, NULL);
195  charset_name = HeapAlloc(GetProcessHeap(), 0, len);
196  WideCharToMultiByte(CP_ACP, 0, charset_nameW, -1, charset_name, len, NULL, NULL);
197  hr = IMimeInternational_FindCharset(iface, charset_name, phCharset);
198  HeapFree(GetProcessHeap(), 0, charset_name);
199  }
200  return hr;
201 }
#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:403
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:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT mlang_getcodepageinfo(UINT cp, MIMECPINFO *mlang_cp_info)
Definition: mimeintl.c:147

◆ MimeInternat_GetCodePageInfo()

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

Definition at line 305 of file mimeintl.c.

307 {
308  FIXME("stub\n");
309  return E_NOTIMPL;
310 }
#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 128 of file mimeintl.c.

129 {
131  HRESULT hr = S_OK;
132 
133  TRACE("(%p)->(%p)\n", iface, phCharset);
134 
135  if(This->default_charset == NULL)
136  {
137  HCHARSET hcs;
138  hr = IMimeInternational_GetCodePageCharset(iface, GetACP(), CHARSET_BODY, &hcs);
139  if(SUCCEEDED(hr))
140  InterlockedCompareExchangePointer(&This->default_charset, hcs, NULL);
141  }
142  *phCharset = This->default_charset;
143 
144  return hr;
145 }
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:2180
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static internat_impl * impl_from_IMimeInternational(IMimeInternational *iface)
Definition: mimeintl.c:60
#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 467 of file mimeintl.c.

468 {
469  FIXME("stub\n");
470  return E_NOTIMPL;
471 }
#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 473 of file mimeintl.c.

479 {
480  FIXME("stub\n");
481  return E_NOTIMPL;
482 }
#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 71 of file mimeintl.c.

72 {
73  if (IsEqualGUID(riid, &IID_IUnknown) ||
74  IsEqualGUID(riid, &IID_IMimeInternational))
75  {
76  IMimeInternational_AddRef( iface );
77  *ppobj = iface;
78  return S_OK;
79  }
80 
81  FIXME("interface %s not implemented\n", debugstr_guid(riid));
82  return E_NOINTERFACE;
83 }
#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:4112

◆ MimeInternat_Release()

static ULONG WINAPI MimeInternat_Release ( IMimeInternational *  iface)
static

Definition at line 91 of file mimeintl.c.

92 {
94  ULONG refs;
95 
96  refs = InterlockedDecrement(&This->refs);
97  if (!refs)
98  {
99  charset_entry *charset, *cursor2;
100 
102  {
103  list_remove(&charset->entry);
105  }
106  This->cs.DebugInfo->Spare[0] = 0;
109  }
110 
111  return refs;
112 }
CFF_Charset charset
Definition: cffcmap.c:138
Definition: mimeintl.c:43
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:403
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:60
#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:402

◆ MimeInternat_Rfc1522Decode()

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

Definition at line 484 of file mimeintl.c.

488 {
489  FIXME("stub\n");
490  return E_NOTIMPL;
491 }
#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 493 of file mimeintl.c.

496 {
497  FIXME("stub\n");
498  return E_NOTIMPL;
499 }
#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 114 of file mimeintl.c.

115 {
117 
118  TRACE("(%p)->(%p)\n", iface, hCharset);
119 
120  if(hCharset == NULL) return E_INVALIDARG;
121  /* FIXME check hCharset is valid */
122 
123  InterlockedExchangePointer(&This->default_charset, hCharset);
124 
125  return S_OK;
126 }
#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:60
#define S_OK
Definition: intsafe.h:59

◆ MimeInternational_Construct()

HRESULT MimeInternational_Construct ( IMimeInternational **  internat)

Definition at line 525 of file mimeintl.c.

526 {
529  global_internat->refs = 0;
531  global_internat->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": global_internat.cs");
532 
536 
538 
539  IMimeInternational_AddRef(*internat);
540  return S_OK;
541 }
#define DWORD_PTR
Definition: treelist.c:76
static internat_impl * global_internat
Definition: mimeintl.c:523
IMimeInternational IMimeInternational_iface
Definition: mimeintl.c:51
struct list charsets
Definition: mimeintl.c:55
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HCHARSET default_charset
Definition: mimeintl.c:57
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:866
#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:501
CRITICAL_SECTION cs
Definition: mimeintl.c:53
LONG next_charset_handle
Definition: mimeintl.c:56
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:859

Referenced by DllMain().

◆ MimeOleFindCharset()

HRESULT WINAPI MimeOleFindCharset ( LPCSTR  name,
LPHCHARSET  charset 
)

Definition at line 552 of file mimeintl.c.

553 {
554  IMimeInternational *internat;
555  HRESULT hr;
556 
557  TRACE("(%s, %p)\n", debugstr_a(name), charset);
558 
559  hr = MimeOleGetInternat(&internat);
560  if(SUCCEEDED(hr))
561  {
562  hr = IMimeInternational_FindCharset(internat, name, charset);
563  IMimeInternational_Release(internat);
564  }
565  return hr;
566 }
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:543
Definition: name.c:38
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeOleGetCharsetInfo()

HRESULT WINAPI MimeOleGetCharsetInfo ( HCHARSET  hCharset,
LPINETCSETINFO  pCsetInfo 
)

Definition at line 568 of file mimeintl.c.

569 {
570  IMimeInternational *internat;
571  HRESULT hr;
572 
573  TRACE("(%p, %p)\n", hCharset, pCsetInfo);
574 
575  hr = MimeOleGetInternat(&internat);
576  if(SUCCEEDED(hr))
577  {
578  hr = IMimeInternational_GetCharsetInfo(internat, hCharset, pCsetInfo);
579  IMimeInternational_Release(internat);
580  }
581  return hr;
582 }
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:543
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeOleGetDefaultCharset()

HRESULT WINAPI MimeOleGetDefaultCharset ( LPHCHARSET  charset)

Definition at line 584 of file mimeintl.c.

585 {
586  IMimeInternational *internat;
587  HRESULT hr;
588 
589  TRACE("(%p)\n", charset);
590 
591  hr = MimeOleGetInternat(&internat);
592  if(SUCCEEDED(hr))
593  {
594  hr = IMimeInternational_GetDefaultCharset(internat, charset);
595  IMimeInternational_Release(internat);
596  }
597  return hr;
598 }
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:543
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ MimeOleGetInternat()

HRESULT WINAPI MimeOleGetInternat ( IMimeInternational **  internat)

Definition at line 543 of file mimeintl.c.

544 {
545  TRACE("(%p)\n", internat);
546 
548  IMimeInternational_AddRef(*internat);
549  return S_OK;
550 }
static internat_impl * global_internat
Definition: mimeintl.c:523
IMimeInternational IMimeInternational_iface
Definition: mimeintl.c:51
#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 147 of file mimeintl.c.

148 {
149  HRESULT hr;
150  IMultiLanguage *ml;
151 
152  hr = get_mlang(&ml);
153 
154  if(SUCCEEDED(hr))
155  {
156  hr = IMultiLanguage_GetCodePageInfo(ml, cp, mlang_cp_info);
157  IMultiLanguage_Release(ml);
158  }
159  return hr;
160 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:65
LONG HRESULT
Definition: typedefs.h:77
POINT cp
Definition: magnifier.c:59
#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 203 of file mimeintl.c.

204 {
206  BSTR bstr = SysAllocStringLen(NULL, len - 1);
207  HRESULT hr;
208  IMultiLanguage *ml;
209 
210  MultiByteToWideChar(CP_ACP, 0, charset, -1, bstr, len);
211 
212  hr = get_mlang(&ml);
213 
214  if(SUCCEEDED(hr))
215  {
216  hr = IMultiLanguage_GetCharsetInfo(ml, bstr, mlang_info);
217  IMultiLanguage_Release(ml);
218  }
219  SysFreeString(bstr);
220  if(FAILED(hr)) hr = MIME_E_NOT_FOUND;
221  return hr;
222 }
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:339
#define CP_ACP
Definition: compat.h:99
OLECHAR * BSTR
Definition: compat.h:1942
static HRESULT get_mlang(IMultiLanguage **ml)
Definition: mimeintl.c:65
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:271
#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 523 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:91
static HRESULT WINAPI MimeInternat_ConvertString(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPPROPVARIANT pIn, LPPROPVARIANT pOut)
Definition: mimeintl.c:399
static HRESULT WINAPI MimeInternat_SetDefaultCharset(IMimeInternational *iface, HCHARSET hCharset)
Definition: mimeintl.c:114
static HRESULT WINAPI MimeInternat_GetCodePageCharset(IMimeInternational *iface, CODEPAGEID cpiCodePage, CHARSETTYPE ctCsetType, LPHCHARSET phCharset)
Definition: mimeintl.c:162
static HRESULT WINAPI MimeInternat_GetCharsetInfo(IMimeInternational *iface, HCHARSET hCharset, LPINETCSETINFO pCsetInfo)
Definition: mimeintl.c:279
static HRESULT WINAPI MimeInternat_CanConvertCodePages(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest)
Definition: mimeintl.c:312
static HRESULT WINAPI MimeInternat_ConvertBuffer(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPBLOB pIn, LPBLOB pOut, ULONG *pcbRead)
Definition: mimeintl.c:350
static HRESULT WINAPI MimeInternat_EncodeHeader(IMimeInternational *iface, HCHARSET hCharset, LPPROPVARIANT pData, LPSTR *ppszEncoded, LPRFC1522INFO pRfc1522Info)
Definition: mimeintl.c:341
static HRESULT WINAPI MimeInternat_FindCharset(IMimeInternational *iface, LPCSTR pszCharset, LPHCHARSET phCharset)
Definition: mimeintl.c:239
static ULONG WINAPI MimeInternat_AddRef(IMimeInternational *iface)
Definition: mimeintl.c:85
static HRESULT WINAPI MimeInternat_GetDefaultCharset(IMimeInternational *iface, LPHCHARSET phCharset)
Definition: mimeintl.c:128
static HRESULT WINAPI MimeInternat_DecodeHeader(IMimeInternational *iface, HCHARSET hCharset, LPCSTR pszData, LPPROPVARIANT pDecoded, LPRFC1522INFO pRfc1522Info)
Definition: mimeintl.c:332
static HRESULT WINAPI MimeInternat_MLANG_ConvertInetString(IMimeInternational *iface, CODEPAGEID cpiSource, CODEPAGEID cpiDest, LPCSTR pSource, int *pnSizeOfSource, LPSTR pDestination, int *pnDstSize)
Definition: mimeintl.c:473
static HRESULT WINAPI MimeInternat_MLANG_ConvertInetReset(IMimeInternational *iface)
Definition: mimeintl.c:467
static HRESULT WINAPI MimeInternat_Rfc1522Encode(IMimeInternational *iface, LPCSTR pszValue, HCHARSET hCharset, LPSTR *ppszEncoded)
Definition: mimeintl.c:493
static HRESULT WINAPI MimeInternat_GetCodePageInfo(IMimeInternational *iface, CODEPAGEID cpiCodePage, LPCODEPAGEINFO pCodePageInfo)
Definition: mimeintl.c:305
static HRESULT WINAPI MimeInternat_QueryInterface(IMimeInternational *iface, REFIID riid, LPVOID *ppobj)
Definition: mimeintl.c:71
static HRESULT WINAPI MimeInternat_Rfc1522Decode(IMimeInternational *iface, LPCSTR pszValue, LPSTR pszCharset, ULONG cchmax, LPSTR *ppszDecoded)
Definition: mimeintl.c:484

Definition at line 501 of file mimeintl.c.

Referenced by MimeInternational_Construct().