Author: dchapyshev
Date: Thu Feb 26 13:34:15 2009
New Revision: 39766
URL:
http://svn.reactos.org/svn/reactos?rev=39766&view=rev
Log:
- Sync itss, mlang with Wine head
Modified:
trunk/reactos/dll/win32/itss/chm_lib.c
trunk/reactos/dll/win32/itss/chm_lib.h
trunk/reactos/dll/win32/itss/itss.c
trunk/reactos/dll/win32/itss/lzx.c
trunk/reactos/dll/win32/itss/moniker.c
trunk/reactos/dll/win32/itss/protocol.c
trunk/reactos/dll/win32/mlang/mlang.c
trunk/reactos/dll/win32/mlang/mlang.spec
trunk/reactos/include/psdk/mlang.idl
Modified: trunk/reactos/dll/win32/itss/chm_lib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/chm_lib.c?r…
==============================================================================
--- trunk/reactos/dll/win32/itss/chm_lib.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/itss/chm_lib.c [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -759,6 +759,10 @@
if (newHandle->index_root == -1)
newHandle->index_root = newHandle->index_head;
+ /* initialize cache */
+ chm_set_param(newHandle, CHM_PARAM_MAX_BLOCKS_CACHED,
+ CHM_MAX_BLOCKS_CACHED);
+
/* By default, compression is enabled. */
newHandle->compression_enabled = 1;
@@ -821,10 +825,6 @@
ctlData.windowsPerReset;
#endif
}
-
- /* initialize cache */
- chm_set_param(newHandle, CHM_PARAM_MAX_BLOCKS_CACHED,
- CHM_MAX_BLOCKS_CACHED);
return newHandle;
}
@@ -1373,12 +1373,16 @@
}
}
-/* enumerate the objects in the .chm archive */
-int chm_enumerate(struct chmFile *h,
- int what,
- CHM_ENUMERATOR e,
- void *context)
-{
+int chm_enumerate_dir(struct chmFile *h,
+ const WCHAR *prefix,
+ int what,
+ CHM_ENUMERATOR e,
+ void *context)
+{
+ /*
+ * XXX: do this efficiently (i.e. using the tree index)
+ */
+
Int32 curPage;
/* buffer to hold whatever page we're looking at */
@@ -1387,14 +1391,38 @@
UChar *end;
UChar *cur;
unsigned int lenRemain;
- UInt64 ui_path_len;
+
+ /* set to 1 once we've started */
+ int it_has_begun=0;
/* the current ui */
struct chmUnitInfo ui;
int flag;
+ UInt64 ui_path_len;
+
+ /* the length of the prefix */
+ WCHAR prefixRectified[CHM_MAX_PATHLEN+1];
+ int prefixLen;
+ WCHAR lastPath[CHM_MAX_PATHLEN];
+ int lastPathLen;
/* starting page */
curPage = h->index_head;
+
+ /* initialize pathname state */
+ lstrcpynW(prefixRectified, prefix, CHM_MAX_PATHLEN);
+ prefixLen = strlenW(prefixRectified);
+ if (prefixLen != 0)
+ {
+ if (prefixRectified[prefixLen-1] != '/')
+ {
+ prefixRectified[prefixLen] = '/';
+ prefixRectified[prefixLen+1] = '\0';
+ ++prefixLen;
+ }
+ }
+ lastPath[0] = '\0';
+ lastPathLen = -1;
/* until we have either returned or given up */
while (curPage != -1)
@@ -1428,6 +1456,37 @@
HeapFree(GetProcessHeap(), 0, page_buf);
return 0;
}
+
+ /* check if we should start */
+ if (! it_has_begun)
+ {
+ if (ui.length == 0 && strncmpiW(ui.path, prefixRectified,
prefixLen) == 0)
+ it_has_begun = 1;
+ else
+ continue;
+
+ if (ui.path[prefixLen] == '\0')
+ continue;
+ }
+
+ /* check if we should stop */
+ else
+ {
+ if (strncmpiW(ui.path, prefixRectified, prefixLen) != 0)
+ {
+ HeapFree(GetProcessHeap(), 0, page_buf);
+ return 1;
+ }
+ }
+
+ /* check if we should include this path */
+ if (lastPathLen != -1)
+ {
+ if (strncmpiW(ui.path, lastPath, lastPathLen) == 0)
+ continue;
+ }
+ strcpyW(lastPath, ui.path);
+ lastPathLen = strlenW(lastPath);
/* get the length of the path */
ui_path_len = strlenW(ui.path)-1;
@@ -1481,171 +1540,3 @@
HeapFree(GetProcessHeap(), 0, page_buf);
return 1;
}
-
-int chm_enumerate_dir(struct chmFile *h,
- const WCHAR *prefix,
- int what,
- CHM_ENUMERATOR e,
- void *context)
-{
- /*
- * XXX: do this efficiently (i.e. using the tree index)
- */
-
- Int32 curPage;
-
- /* buffer to hold whatever page we're looking at */
- UChar *page_buf = HeapAlloc(GetProcessHeap(), 0, h->block_len);
- struct chmPmglHeader header;
- UChar *end;
- UChar *cur;
- unsigned int lenRemain;
-
- /* set to 1 once we've started */
- int it_has_begun=0;
-
- /* the current ui */
- struct chmUnitInfo ui;
- int flag;
- UInt64 ui_path_len;
-
- /* the length of the prefix */
- WCHAR prefixRectified[CHM_MAX_PATHLEN+1];
- int prefixLen;
- WCHAR lastPath[CHM_MAX_PATHLEN];
- int lastPathLen;
-
- /* starting page */
- curPage = h->index_head;
-
- /* initialize pathname state */
- lstrcpynW(prefixRectified, prefix, CHM_MAX_PATHLEN);
- prefixLen = strlenW(prefixRectified);
- if (prefixLen != 0)
- {
- if (prefixRectified[prefixLen-1] != '/')
- {
- prefixRectified[prefixLen] = '/';
- prefixRectified[prefixLen+1] = '\0';
- ++prefixLen;
- }
- }
- lastPath[0] = '\0';
- lastPathLen = -1;
-
- /* until we have either returned or given up */
- while (curPage != -1)
- {
-
- /* try to fetch the index page */
- if (_chm_fetch_bytes(h,
- page_buf,
- h->dir_offset + (UInt64)curPage*h->block_len,
- h->block_len) != h->block_len)
- {
- HeapFree(GetProcessHeap(), 0, page_buf);
- return 0;
- }
-
- /* figure out start and end for this page */
- cur = page_buf;
- lenRemain = _CHM_PMGL_LEN;
- if (! _unmarshal_pmgl_header(&cur, &lenRemain, &header))
- {
- HeapFree(GetProcessHeap(), 0, page_buf);
- return 0;
- }
- end = page_buf + h->block_len - (header.free_space);
-
- /* loop over this page */
- while (cur < end)
- {
- if (! _chm_parse_PMGL_entry(&cur, &ui))
- {
- HeapFree(GetProcessHeap(), 0, page_buf);
- return 0;
- }
-
- /* check if we should start */
- if (! it_has_begun)
- {
- if (ui.length == 0 && strncmpiW(ui.path, prefixRectified,
prefixLen) == 0)
- it_has_begun = 1;
- else
- continue;
-
- if (ui.path[prefixLen] == '\0')
- continue;
- }
-
- /* check if we should stop */
- else
- {
- if (strncmpiW(ui.path, prefixRectified, prefixLen) != 0)
- {
- HeapFree(GetProcessHeap(), 0, page_buf);
- return 1;
- }
- }
-
- /* check if we should include this path */
- if (lastPathLen != -1)
- {
- if (strncmpiW(ui.path, lastPath, lastPathLen) == 0)
- continue;
- }
- strcpyW(lastPath, ui.path);
- lastPathLen = strlenW(lastPath);
-
- /* get the length of the path */
- ui_path_len = strlenW(ui.path)-1;
-
- /* check for DIRS */
- if (ui.path[ui_path_len] == '/' && !(what &
CHM_ENUMERATE_DIRS))
- continue;
-
- /* check for FILES */
- if (ui.path[ui_path_len] != '/' && !(what &
CHM_ENUMERATE_FILES))
- continue;
-
- /* check for NORMAL vs. META */
- if (ui.path[0] == '/')
- {
-
- /* check for NORMAL vs. SPECIAL */
- if (ui.path[1] == '#' || ui.path[1] == '$')
- flag = CHM_ENUMERATE_SPECIAL;
- else
- flag = CHM_ENUMERATE_NORMAL;
- }
- else
- flag = CHM_ENUMERATE_META;
- if (! (what & flag))
- continue;
-
- /* call the enumerator */
- {
- int status = (*e)(h, &ui, context);
- switch (status)
- {
- case CHM_ENUMERATOR_FAILURE:
- HeapFree(GetProcessHeap(), 0, page_buf);
- return 0;
- case CHM_ENUMERATOR_CONTINUE:
- break;
- case CHM_ENUMERATOR_SUCCESS:
- HeapFree(GetProcessHeap(), 0, page_buf);
- return 1;
- default:
- break;
- }
- }
- }
-
- /* advance to next page */
- curPage = header.block_next;
- }
-
- HeapFree(GetProcessHeap(), 0, page_buf);
- return 1;
-}
Modified: trunk/reactos/dll/win32/itss/chm_lib.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/chm_lib.h?r…
==============================================================================
--- trunk/reactos/dll/win32/itss/chm_lib.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/itss/chm_lib.h [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -104,11 +104,6 @@
#define CHM_ENUMERATOR_FAILURE (0)
#define CHM_ENUMERATOR_CONTINUE (1)
#define CHM_ENUMERATOR_SUCCESS (2)
-int chm_enumerate(struct chmFile *h,
- int what,
- CHM_ENUMERATOR e,
- void *context);
-
int chm_enumerate_dir(struct chmFile *h,
const WCHAR *prefix,
int what,
Modified: trunk/reactos/dll/win32/itss/itss.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/itss.c?rev=…
==============================================================================
--- trunk/reactos/dll/win32/itss/itss.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/itss/itss.c [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -363,7 +363,7 @@
its->ref = 1;
TRACE("-> %p\n", its);
- *ppObj = (LPVOID) its;
+ *ppObj = its;
ITSS_LockModule();
return S_OK;
Modified: trunk/reactos/dll/win32/itss/lzx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/lzx.c?rev=3…
==============================================================================
--- trunk/reactos/dll/win32/itss/lzx.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/itss/lzx.c [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -36,15 +36,17 @@
***************************************************************************/
#include "lzx.h"
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "windef.h"
+#include "winbase.h"
+
/* sized types */
typedef unsigned char UBYTE; /* 8 bits exactly */
typedef unsigned short UWORD; /* 16 bits (or more) */
-typedef unsigned int ULONG; /* 32 bits (or more) */
-typedef signed int LONG; /* 32 bits (or more) */
/* some constants defined by the LZX specification */
#define LZX_MIN_MATCH (2)
@@ -178,10 +180,10 @@
if (window < 15 || window > 21) return NULL;
/* allocate state and associated window */
- pState = malloc(sizeof(struct LZXstate));
- if (!(pState->window = malloc(wndsize)))
+ pState = HeapAlloc(GetProcessHeap(), 0, sizeof(struct LZXstate));
+ if (!(pState->window = HeapAlloc(GetProcessHeap(), 0, wndsize)))
{
- free(pState);
+ HeapFree(GetProcessHeap(), 0, pState);
return NULL;
}
pState->actual_size = wndsize;
@@ -217,8 +219,8 @@
{
if (pState)
{
- free(pState->window);
- free(pState);
+ HeapFree(GetProcessHeap(), 0, pState->window);
+ HeapFree(GetProcessHeap(), 0, pState);
}
}
Modified: trunk/reactos/dll/win32/itss/moniker.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/moniker.c?r…
==============================================================================
--- trunk/reactos/dll/win32/itss/moniker.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/itss/moniker.c [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -473,7 +473,7 @@
its->ref = 1;
TRACE("-> %p\n", its);
- *ppObj = (LPVOID) its;
+ *ppObj = its;
ITSS_LockModule();
return S_OK;
Modified: trunk/reactos/dll/win32/itss/protocol.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/protocol.c?…
==============================================================================
--- trunk/reactos/dll/win32/itss/protocol.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/itss/protocol.c [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -47,7 +47,7 @@
} ITSProtocol;
#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
-#define PROTINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl)
+#define PROTINFO(x) (&(x)->lpInternetProtocolInfoVtbl)
static void release_chm(ITSProtocol *This)
{
Modified: trunk/reactos/dll/win32/mlang/mlang.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mlang/mlang.c?re…
==============================================================================
--- trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -42,8 +42,6 @@
#include "initguid.h"
#define CP_UNICODE 1200
-
-#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) -
offsetof(impl,field))
static HRESULT MultiLanguage_create(IUnknown *pUnkOuter, LPVOID *ppObj);
static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum);
@@ -450,10 +448,11 @@
const MIME_CP_INFO *mime_cp_info;
const char *fixed_font;
const char *proportional_font;
+ SCRIPT_ID sid;
} mlang_data[] =
{
{ "Arabic",1256,sizeof(arabic_cp)/sizeof(arabic_cp[0]),arabic_cp,
- "Courier","Arial" }, /* FIXME */
+ "Courier","Arial", sidArabic }, /* FIXME */
{ "Baltic",1257,sizeof(baltic_cp)/sizeof(baltic_cp[0]),baltic_cp,
"Courier","Arial" }, /* FIXME */
{ "Chinese
Simplified",936,sizeof(chinese_simplified_cp)/sizeof(chinese_simplified_cp[0]),chinese_simplified_cp,
@@ -463,23 +462,23 @@
{ "Central
European",1250,sizeof(central_european_cp)/sizeof(central_european_cp[0]),central_european_cp,
"Courier","Arial" }, /* FIXME */
{ "Cyrillic",1251,sizeof(cyrillic_cp)/sizeof(cyrillic_cp[0]),cyrillic_cp,
- "Courier","Arial" }, /* FIXME */
+ "Courier","Arial", sidCyrillic }, /* FIXME */
{ "Greek",1253,sizeof(greek_cp)/sizeof(greek_cp[0]),greek_cp,
- "Courier","Arial" }, /* FIXME */
+ "Courier","Arial", sidGreek }, /* FIXME */
{ "Hebrew",1255,sizeof(hebrew_cp)/sizeof(hebrew_cp[0]),hebrew_cp,
- "Courier","Arial" }, /* FIXME */
+ "Courier","Arial", sidHebrew }, /* FIXME */
{ "Japanese",932,sizeof(japanese_cp)/sizeof(japanese_cp[0]),japanese_cp,
"MS Gothic","MS PGothic" },
{ "Korean",949,sizeof(korean_cp)/sizeof(korean_cp[0]),korean_cp,
"Courier","Arial" }, /* FIXME */
{ "Thai",874,sizeof(thai_cp)/sizeof(thai_cp[0]),thai_cp,
- "Courier","Arial" }, /* FIXME */
+ "Courier","Arial", sidThai }, /* FIXME */
{ "Turkish",1254,sizeof(turkish_cp)/sizeof(turkish_cp[0]),turkish_cp,
"Courier","Arial" }, /* FIXME */
{
"Vietnamese",1258,sizeof(vietnamese_cp)/sizeof(vietnamese_cp[0]),vietnamese_cp,
"Courier","Arial" }, /* FIXME */
{ "Western
European",1252,sizeof(western_cp)/sizeof(western_cp[0]),western_cp,
- "Courier","Arial" }, /* FIXME */
+ "Courier","Arial", sidLatin }, /* FIXME */
{
"Unicode",CP_UNICODE,sizeof(unicode_cp)/sizeof(unicode_cp[0]),unicode_cp,
"Courier","Arial" } /* FIXME */
};
@@ -800,22 +799,30 @@
int code = DetectJapaneseCode(input,count);
TRACE("Japanese code %i\n",code);
- if (code == 932)
- {
+ switch (code)
+ {
+ case 0:
+ if (output)
+ rc = MultiByteToWideChar(CP_ACP,0,input,count,output,out_count);
+ else
+ rc = MultiByteToWideChar(CP_ACP,0,input,count,0,0);
+ break;
+
+ case 932:
if (output)
rc = MultiByteToWideChar(932,0,input,count,output,out_count);
else
rc = MultiByteToWideChar(932,0,input,count,0,0);
- }
- else if (code == 51932)
- {
+ break;
+
+ case 51932:
if (output)
rc = MultiByteToWideChar(20932,0,input,count,output,out_count);
else
rc = MultiByteToWideChar(20932,0,input,count,0,0);
- }
- else if (code == 50220)
- {
+ break;
+
+ case 50220:
sjis_string = HeapAlloc(GetProcessHeap(),0,count);
rc = ConvertJIS2SJIS(input,count,sjis_string);
if (rc)
@@ -827,6 +834,7 @@
rc = MultiByteToWideChar(932,0,sjis_string,rc,0,0);
}
HeapFree(GetProcessHeap(),0,sjis_string);
+ break;
}
return rc;
}
@@ -1485,12 +1493,17 @@
DWORD total, pos;
} EnumCodePage_impl;
+static inline EnumCodePage_impl *impl_from_IEnumCodePage( IEnumCodePage *iface )
+{
+ return (EnumCodePage_impl *)CONTAINING_RECORD( iface, EnumCodePage_impl,
vtbl_IEnumCodePage );
+}
+
static HRESULT WINAPI fnIEnumCodePage_QueryInterface(
IEnumCodePage* iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
+ EnumCodePage_impl *This = impl_from_IEnumCodePage( iface );
TRACE("%p -> %s\n", This, debugstr_guid(riid) );
@@ -1510,14 +1523,14 @@
static ULONG WINAPI fnIEnumCodePage_AddRef(
IEnumCodePage* iface)
{
- ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
+ EnumCodePage_impl *This = impl_from_IEnumCodePage( iface );
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI fnIEnumCodePage_Release(
IEnumCodePage* iface)
{
- ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
+ EnumCodePage_impl *This = impl_from_IEnumCodePage( iface );
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p ref = %d\n", This, ref);
@@ -1535,7 +1548,7 @@
IEnumCodePage* iface,
IEnumCodePage** ppEnum)
{
- ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
+ EnumCodePage_impl *This = impl_from_IEnumCodePage( iface );
FIXME("%p %p\n", This, ppEnum);
return E_NOTIMPL;
}
@@ -1547,8 +1560,8 @@
ULONG* pceltFetched)
{
ULONG i;
-
- ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
+ EnumCodePage_impl *This = impl_from_IEnumCodePage( iface );
+
TRACE("%p %u %p %p\n", This, celt, rgelt, pceltFetched);
if (!pceltFetched) return S_FALSE;
@@ -1584,7 +1597,8 @@
static HRESULT WINAPI fnIEnumCodePage_Reset(
IEnumCodePage* iface)
{
- ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
+ EnumCodePage_impl *This = impl_from_IEnumCodePage( iface );
+
TRACE("%p\n", This);
This->pos = 0;
@@ -1595,7 +1609,8 @@
IEnumCodePage* iface,
ULONG celt)
{
- ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
+ EnumCodePage_impl *This = impl_from_IEnumCodePage( iface );
+
TRACE("%p %u\n", This, celt);
if (celt >= This->total) return S_FALSE;
@@ -1671,12 +1686,17 @@
DWORD total, pos;
} EnumScript_impl;
+static inline EnumScript_impl *impl_from_IEnumScript( IEnumScript *iface )
+{
+ return (EnumScript_impl *)CONTAINING_RECORD( iface, EnumScript_impl, vtbl_IEnumScript
);
+}
+
static HRESULT WINAPI fnIEnumScript_QueryInterface(
IEnumScript* iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
+ EnumScript_impl *This = impl_from_IEnumScript( iface );
TRACE("%p -> %s\n", This, debugstr_guid(riid) );
@@ -1696,14 +1716,14 @@
static ULONG WINAPI fnIEnumScript_AddRef(
IEnumScript* iface)
{
- ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
+ EnumScript_impl *This = impl_from_IEnumScript( iface );
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI fnIEnumScript_Release(
IEnumScript* iface)
{
- ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
+ EnumScript_impl *This = impl_from_IEnumScript( iface );
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p ref = %d\n", This, ref);
@@ -1721,7 +1741,7 @@
IEnumScript* iface,
IEnumScript** ppEnum)
{
- ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
+ EnumScript_impl *This = impl_from_IEnumScript( iface );
FIXME("%p %p: stub!\n", This, ppEnum);
return E_NOTIMPL;
}
@@ -1732,7 +1752,8 @@
PSCRIPTINFO rgelt,
ULONG* pceltFetched)
{
- ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
+ EnumScript_impl *This = impl_from_IEnumScript( iface );
+
TRACE("%p %u %p %p\n", This, celt, rgelt, pceltFetched);
if (!pceltFetched || !rgelt) return E_FAIL;
@@ -1754,7 +1775,8 @@
static HRESULT WINAPI fnIEnumScript_Reset(
IEnumScript* iface)
{
- ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
+ EnumScript_impl *This = impl_from_IEnumScript( iface );
+
TRACE("%p\n", This);
This->pos = 0;
@@ -1765,7 +1787,8 @@
IEnumScript* iface,
ULONG celt)
{
- ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
+ EnumScript_impl *This = impl_from_IEnumScript( iface );
+
TRACE("%p %u\n", This, celt);
if (celt >= This->total) return S_FALSE;
@@ -1825,26 +1848,31 @@
/******************************************************************************/
+static inline MLang_impl *impl_from_IMLangFontLink( IMLangFontLink *iface )
+{
+ return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMLangFontLink );
+}
+
static HRESULT WINAPI fnIMLangFontLink_QueryInterface(
IMLangFontLink* iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface);
+ MLang_impl *This = impl_from_IMLangFontLink( iface );
return MLang_QueryInterface( This, riid, ppvObject );
}
static ULONG WINAPI fnIMLangFontLink_AddRef(
IMLangFontLink* iface)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface);
+ MLang_impl *This = impl_from_IMLangFontLink( iface );
return MLang_AddRef( This );
}
static ULONG WINAPI fnIMLangFontLink_Release(
IMLangFontLink* iface)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface);
+ MLang_impl *This = impl_from_IMLangFontLink( iface );
return MLang_Release( This );
}
@@ -1895,7 +1923,7 @@
UINT uCodePage,
DWORD* pdwCodePages)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface);
+ MLang_impl *This = impl_from_IMLangFontLink( iface );
CHARSETINFO cs;
BOOL rc;
@@ -1921,7 +1949,7 @@
UINT uDefaultCodePage,
UINT* puCodePage)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface);
+ MLang_impl *This = impl_from_IMLangFontLink( iface );
DWORD mask = 0x00000000;
UINT i;
CHARSETINFO cs;
@@ -1951,7 +1979,7 @@
DWORD Csb[2];
Csb[0] = mask;
Csb[1] = 0x0;
- rc = TranslateCharsetInfo((DWORD*)Csb, &cs, TCI_SRCFONTSIG);
+ rc = TranslateCharsetInfo(Csb, &cs, TCI_SRCFONTSIG);
if (!rc)
continue;
@@ -1974,7 +2002,7 @@
{
HFONT old_font;
FONTSIGNATURE fontsig;
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface);
+ MLang_impl *This = impl_from_IMLangFontLink( iface );
TRACE("(%p)\n",This);
@@ -2032,24 +2060,29 @@
/******************************************************************************/
+static inline MLang_impl *impl_from_IMultiLanguage( IMultiLanguage *iface )
+{
+ return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMultiLanguage );
+}
+
static HRESULT WINAPI fnIMultiLanguage_QueryInterface(
IMultiLanguage* iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage( iface );
return MLang_QueryInterface( This, riid, ppvObject );
}
static ULONG WINAPI fnIMultiLanguage_AddRef( IMultiLanguage* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage( iface );
return IMLangFontLink_AddRef( ((IMLangFontLink*)This) );
}
static ULONG WINAPI fnIMultiLanguage_Release( IMultiLanguage* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage( iface );
return IMLangFontLink_Release( ((IMLangFontLink*)This) );
}
@@ -2067,8 +2100,8 @@
PMIMECPINFO pCodePageInfo)
{
UINT i, n;
-
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage( iface );
+
TRACE("%p, %u, %p\n", This, uiCodePage, pCodePageInfo);
for (i = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++)
@@ -2099,7 +2132,8 @@
DWORD grfFlags,
IEnumCodePage** ppEnumCodePage)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage( iface );
+
TRACE("%p %08x %p\n", This, grfFlags, ppEnumCodePage);
return EnumCodePage_create( This, grfFlags, 0, ppEnumCodePage );
@@ -2110,7 +2144,7 @@
BSTR Charset,
PMIMECSETINFO pCharsetInfo)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage( iface );
return
IMultiLanguage3_GetCharsetInfo((IMultiLanguage3*)&This->vtbl_IMultiLanguage3,
Charset, pCharsetInfo);
}
@@ -2219,12 +2253,17 @@
DWORD total, pos;
} EnumRfc1766_impl;
+static inline EnumRfc1766_impl *impl_from_IEnumRfc1766( IEnumRfc1766 *iface )
+{
+ return (EnumRfc1766_impl *)CONTAINING_RECORD( iface, EnumRfc1766_impl,
vtbl_IEnumRfc1766 );
+}
+
static HRESULT WINAPI fnIEnumRfc1766_QueryInterface(
IEnumRfc1766 *iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface);
+ EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface );
TRACE("%p -> %s\n", This, debugstr_guid(riid) );
@@ -2244,14 +2283,14 @@
static ULONG WINAPI fnIEnumRfc1766_AddRef(
IEnumRfc1766 *iface)
{
- ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface);
+ EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface );
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI fnIEnumRfc1766_Release(
IEnumRfc1766 *iface)
{
- ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface);
+ EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface );
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p ref = %d\n", This, ref);
@@ -2268,7 +2307,8 @@
IEnumRfc1766 *iface,
IEnumRfc1766 **ppEnum)
{
- ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface);
+ EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface );
+
FIXME("%p %p\n", This, ppEnum);
return E_NOTIMPL;
}
@@ -2280,8 +2320,8 @@
ULONG *pceltFetched)
{
ULONG i;
-
- ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface);
+ EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface );
+
TRACE("%p %u %p %p\n", This, celt, rgelt, pceltFetched);
if (!pceltFetched) return S_FALSE;
@@ -2311,7 +2351,8 @@
static HRESULT WINAPI fnIEnumRfc1766_Reset(
IEnumRfc1766 *iface)
{
- ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface);
+ EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface );
+
TRACE("%p\n", This);
This->pos = 0;
@@ -2322,7 +2363,8 @@
IEnumRfc1766 *iface,
ULONG celt)
{
- ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface);
+ EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface );
+
TRACE("%p %u\n", This, celt);
if (celt >= This->total) return S_FALSE;
@@ -2427,7 +2469,8 @@
IMultiLanguage *iface,
IEnumRfc1766 **ppEnumRfc1766)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage( iface );
+
TRACE("%p %p\n", This, ppEnumRfc1766);
return EnumRfc1766_create(0, ppEnumRfc1766);
@@ -2480,24 +2523,29 @@
/******************************************************************************/
+static inline MLang_impl *impl_from_IMultiLanguage3( IMultiLanguage3 *iface )
+{
+ return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMultiLanguage3 );
+}
+
static HRESULT WINAPI fnIMultiLanguage2_QueryInterface(
IMultiLanguage3* iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
return MLang_QueryInterface( This, riid, ppvObject );
}
static ULONG WINAPI fnIMultiLanguage2_AddRef( IMultiLanguage3* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
return MLang_AddRef( This );
}
static ULONG WINAPI fnIMultiLanguage2_Release( IMultiLanguage3* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
return MLang_Release( This );
}
@@ -2505,7 +2553,8 @@
IMultiLanguage3* iface,
UINT* pcCodePage)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
TRACE("%p, %p\n", This, pcCodePage);
if (!pcCodePage) return S_FALSE;
@@ -2559,8 +2608,8 @@
PMIMECPINFO pCodePageInfo)
{
UINT i, n;
-
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
TRACE("%p, %u, %04x, %p\n", This, uiCodePage, LangId, pCodePageInfo);
for (i = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++)
@@ -2592,7 +2641,8 @@
LANGID LangId,
IEnumCodePage** ppEnumCodePage)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
TRACE("%p %08x %04x %p\n", This, grfFlags, LangId, ppEnumCodePage);
return EnumCodePage_create( This, grfFlags, LangId, ppEnumCodePage );
@@ -2604,8 +2654,8 @@
PMIMECSETINFO pCharsetInfo)
{
UINT i, n;
-
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
TRACE("%p %s %p\n", This, debugstr_w(Charset), pCharsetInfo);
if (!pCharsetInfo) return E_FAIL;
@@ -2752,7 +2802,8 @@
LANGID LangId,
IEnumRfc1766** ppEnumRfc1766)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
TRACE("%p %p\n", This, ppEnumRfc1766);
return EnumRfc1766_create(LangId, ppEnumRfc1766);
@@ -2910,8 +2961,7 @@
UINT uiCodePage,
HWND hwnd)
{
- FIXME("%u, %p\n", uiCodePage, hwnd);
- return E_NOTIMPL;
+ return IMultiLanguage2_ValidateCodePageEx(iface,uiCodePage,hwnd,0);
}
static HRESULT WINAPI fnIMultiLanguage2_GetCodePageDescription(
@@ -2962,7 +3012,8 @@
IMultiLanguage3* iface,
UINT* pnScripts)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
TRACE("%p %p\n", This, pnScripts);
if (!pnScripts) return S_FALSE;
@@ -2977,7 +3028,8 @@
LANGID LangId,
IEnumScript** ppEnumScript)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
TRACE("%p %08x %04x %p\n", This, dwFlags, LangId, ppEnumScript);
return EnumScript_create( This, dwFlags, LangId, ppEnumScript );
@@ -2989,8 +3041,28 @@
HWND hwnd,
DWORD dwfIODControl)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
- FIXME("%p %u %p %08x: stub!\n", This, uiCodePage, hwnd, dwfIODControl);
+ int i;
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
+ TRACE("%p %u %p %08x\n", This, uiCodePage, hwnd, dwfIODControl);
+
+ /* quick check for kernel32 supported code pages */
+ if (IsValidCodePage(uiCodePage))
+ return S_OK;
+
+ /* check for mlang supported code pages */
+ for (i = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++)
+ {
+ int n;
+ for (n = 0; n < mlang_data[i].number_of_cp; n++)
+ {
+ if (mlang_data[i].mime_cp_info[n].cp == uiCodePage)
+ return S_OK;
+ }
+ }
+
+ if (dwfIODControl != CPIOD_PEEK)
+ FIXME("Request to install codepage language pack not handled\n");
return S_FALSE;
}
@@ -3006,7 +3078,8 @@
UINT *pnDetectedCodePages,
WCHAR *lpSpecialChar)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
FIXME("(%p)->(%08x %s %u %p %u %p %p %p)\n", This, dwFlags,
debugstr_w(lpWideCharStr),
cchWideChar, puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, lpSpecialChar);
@@ -3023,7 +3096,8 @@
UINT *pnDetectedCodePages,
WCHAR *lpSpecialChar)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface);
+ MLang_impl *This = impl_from_IMultiLanguage3( iface );
+
FIXME("(%p)->(%08x %p %p %u %p %p %p)\n", This, dwFlags, pStrIn,
puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, lpSpecialChar);
@@ -3067,24 +3141,30 @@
};
/******************************************************************************/
+
+static inline MLang_impl *impl_from_IMLangFontLink2( IMLangFontLink2 *iface )
+{
+ return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMLangFontLink2 );
+}
+
static HRESULT WINAPI fnIMLangFontLink2_QueryInterface(
IMLangFontLink2 * iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink2, iface);
+ MLang_impl *This = impl_from_IMLangFontLink2( iface );
return MLang_QueryInterface( This, riid, ppvObject );
}
static ULONG WINAPI fnIMLangFontLink2_AddRef( IMLangFontLink2* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink2, iface);
+ MLang_impl *This = impl_from_IMLangFontLink2( iface );
return MLang_AddRef( This );
}
static ULONG WINAPI fnIMLangFontLink2_Release( IMLangFontLink2* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink2, iface);
+ MLang_impl *This = impl_from_IMLangFontLink2( iface );
return MLang_Release( This );
}
@@ -3158,8 +3238,37 @@
SCRIPT_ID sid, DWORD dwFlags, UINT *puiFonts,
SCRIPTFONTINFO *pScriptFont)
{
- FIXME("(%p)->%i %i %p %p\n",This, sid, dwFlags, puiFonts, pScriptFont);
- return E_NOTIMPL;
+ UINT i, j;
+
+ TRACE("(%p)->%u %x %p %p\n", This, sid, dwFlags, puiFonts,
pScriptFont);
+
+ if (!dwFlags) dwFlags = SCRIPTCONTF_PROPORTIONAL_FONT;
+
+ for (i = 0, j = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++)
+ {
+ if (sid == mlang_data[i].sid)
+ {
+ if (pScriptFont)
+ {
+ if (j >= *puiFonts) break;
+
+ pScriptFont[j].scripts = 1 << mlang_data[i].sid;
+ if (dwFlags == SCRIPTCONTF_FIXED_FONT)
+ {
+ MultiByteToWideChar(CP_ACP, 0, mlang_data[i].fixed_font, -1,
+ pScriptFont[j].wszFont, MAX_MIMEFACE_NAME);
+ }
+ else if (dwFlags == SCRIPTCONTF_PROPORTIONAL_FONT)
+ {
+ MultiByteToWideChar(CP_ACP, 0, mlang_data[i].proportional_font, -1,
+ pScriptFont[j].wszFont, MAX_MIMEFACE_NAME);
+ }
+ }
+ j++;
+ }
+ }
+ *puiFonts = j;
+ return S_OK;
}
static HRESULT WINAPI fnIMLangFontLink2_CodePageToScriptID(IMLangFontLink2* This,
@@ -3189,26 +3298,31 @@
/******************************************************************************/
+static inline MLang_impl *impl_from_IMLangLineBreakConsole( IMLangLineBreakConsole *iface
)
+{
+ return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl,
vtbl_IMLangLineBreakConsole );
+}
+
static HRESULT WINAPI fnIMLangLineBreakConsole_QueryInterface(
IMLangLineBreakConsole* iface,
REFIID riid,
void** ppvObject)
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangLineBreakConsole, iface);
+ MLang_impl *This = impl_from_IMLangLineBreakConsole( iface );
return MLang_QueryInterface( This, riid, ppvObject );
}
static ULONG WINAPI fnIMLangLineBreakConsole_AddRef(
IMLangLineBreakConsole* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangLineBreakConsole, iface);
+ MLang_impl *This = impl_from_IMLangLineBreakConsole( iface );
return MLang_AddRef( This );
}
static ULONG WINAPI fnIMLangLineBreakConsole_Release(
IMLangLineBreakConsole* iface )
{
- ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangLineBreakConsole, iface);
+ MLang_impl *This = impl_from_IMLangLineBreakConsole( iface );
return MLang_Release( This );
}
@@ -3294,7 +3408,7 @@
mlang->total_scripts = sizeof(mlang_data)/sizeof(mlang_data[0]) - 1;
mlang->ref = 1;
- *ppObj = (LPVOID) mlang;
+ *ppObj = mlang;
TRACE("returning %p\n", mlang);
LockModule();
Modified: trunk/reactos/dll/win32/mlang/mlang.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mlang/mlang.spec…
==============================================================================
--- trunk/reactos/dll/win32/mlang/mlang.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mlang/mlang.spec [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -1,14 +1,15 @@
-@ stdcall ConvertINetMultiByteToUnicode(ptr long ptr ptr ptr ptr)
-@ stub ConvertINetReset
-@ stdcall ConvertINetString(ptr long long ptr ptr ptr ptr)
-@ stdcall ConvertINetUnicodeToMultiByte(ptr long ptr ptr ptr ptr)
+110 stdcall IsConvertINetStringAvailable(long long)
+111 stdcall ConvertINetString(ptr long long ptr ptr ptr ptr)
+112 stdcall ConvertINetUnicodeToMultiByte(ptr long ptr ptr ptr ptr)
+113 stdcall ConvertINetMultiByteToUnicode(ptr long ptr ptr ptr ptr)
+114 stub ConvertINetReset
+120 stdcall LcidToRfc1766A(long ptr long)
+121 stdcall LcidToRfc1766W(long ptr long)
+122 stdcall Rfc1766ToLcidA(ptr str)
+123 stdcall Rfc1766ToLcidW(ptr wstr)
+
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()
@ stdcall GetGlobalFontLinkObject()
-@ stdcall IsConvertINetStringAvailable(long long)
-@ stdcall LcidToRfc1766A(long ptr long)
-@ stdcall LcidToRfc1766W(long ptr long)
-@ stdcall Rfc1766ToLcidA(ptr str)
-@ stdcall Rfc1766ToLcidW(ptr wstr)
Modified: trunk/reactos/include/psdk/mlang.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/mlang.idl?rev…
==============================================================================
--- trunk/reactos/include/psdk/mlang.idl [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/mlang.idl [iso-8859-1] Thu Feb 26 13:34:15 2009
@@ -21,6 +21,9 @@
#endif
interface IStream;
+
+cpp_quote("#define CPIOD_PEEK 0x40000000")
+cpp_quote("#define CPIOD_FORCE_PROMPT 0x80000000")
/* FIXME: LANGID is defined in winnt.h and mlang.h in the platform SDK */
cpp_quote("#ifndef _WINNT_H")