jscript: Add IActiveScriptParse64 declaration and use it on Win64.

This commit is contained in:
Jacek Caban 2009-02-02 15:27:24 +01:00 committed by Alexandre Julliard
parent c727fe4adc
commit 0194b8f08c
7 changed files with 95 additions and 27 deletions

View File

@ -24,6 +24,18 @@
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
#ifdef _WIN64
#define CTXARG_T DWORDLONG
#define IActiveScriptParseVtbl IActiveScriptParse64Vtbl
#else
#define CTXARG_T DWORD
#define IActiveScriptParseVtbl IActiveScriptParse32Vtbl
#endif
typedef struct {
const IActiveScriptVtbl *lpIActiveScriptVtbl;
const IActiveScriptParseVtbl *lpIActiveScriptParseVtbl;
@ -555,29 +567,29 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
static HRESULT WINAPI JScriptParse_AddScriptlet(IActiveScriptParse *iface,
LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName,
LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter,
DWORD dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
BSTR *pbstrName, EXCEPINFO *pexcepinfo)
{
JScript *This = ASPARSE_THIS(iface);
FIXME("(%p)->(%s %s %s %s %s %s %x %u %x %p %p)\n", This, debugstr_w(pstrDefaultName),
FIXME("(%p)->(%s %s %s %s %s %s %s %u %x %p %p)\n", This, debugstr_w(pstrDefaultName),
debugstr_w(pstrCode), debugstr_w(pstrItemName), debugstr_w(pstrSubItemName),
debugstr_w(pstrEventName), debugstr_w(pstrDelimiter), dwSourceContextCookie,
debugstr_w(pstrEventName), debugstr_w(pstrDelimiter), wine_dbgstr_longlong(dwSourceContextCookie),
ulStartingLineNumber, dwFlags, pbstrName, pexcepinfo);
return E_NOTIMPL;
}
static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext,
LPCOLESTR pstrDelimiter, DWORD dwSourceContextCookie, ULONG ulStartingLine,
LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine,
DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
{
JScript *This = ASPARSE_THIS(iface);
parser_ctx_t *parser_ctx;
HRESULT hres;
TRACE("(%p)->(%s %s %p %s %x %u %x %p %p)\n", This, debugstr_w(pstrCode),
TRACE("(%p)->(%s %s %p %s %s %u %x %p %p)\n", This, debugstr_w(pstrCode),
debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
dwSourceContextCookie, ulStartingLine, dwFlags, pvarResult, pexcepinfo);
wine_dbgstr_longlong(dwSourceContextCookie), ulStartingLine, dwFlags, pvarResult, pexcepinfo);
if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED)
return E_UNEXPECTED;

View File

@ -304,10 +304,10 @@ static void test_jscript(void)
test_state(script, SCRIPTSTATE_UNINITIALIZED);
test_safety(unk);
hres = IActiveScriptParse_InitNew(parse);
hres = IActiveScriptParse64_InitNew(parse);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScriptParse_InitNew(parse);
hres = IActiveScriptParse64_InitNew(parse);
ok(hres == E_UNEXPECTED, "InitNew failed: %08x, expected E_UNEXPECTED\n", hres);
hres = IActiveScript_SetScriptSite(script, NULL);
@ -345,7 +345,7 @@ static void test_jscript(void)
test_state(script, SCRIPTSTATE_CLOSED);
test_script_dispatch(script, FALSE);
IActiveScriptParse_Release(parse);
IUnknown_Release(parse);
IActiveScript_Release(script);
ref = IUnknown_Release(unk);
@ -387,11 +387,11 @@ static void test_jscript2(void)
test_state(script, SCRIPTSTATE_UNINITIALIZED);
SET_EXPECT(OnStateChange_INITIALIZED);
hres = IActiveScriptParse_InitNew(parse);
hres = IActiveScriptParse64_InitNew(parse);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
CHECK_CALLED(OnStateChange_INITIALIZED);
hres = IActiveScriptParse_InitNew(parse);
hres = IActiveScriptParse64_InitNew(parse);
ok(hres == E_UNEXPECTED, "InitNew failed: %08x, expected E_UNEXPECTED\n", hres);
SET_EXPECT(OnStateChange_CONNECTED);
@ -413,7 +413,7 @@ static void test_jscript2(void)
test_state(script, SCRIPTSTATE_CLOSED);
test_script_dispatch(script, FALSE);
IActiveScriptParse_Release(parse);
IUnknown_Release(parse);
IActiveScript_Release(script);
ref = IUnknown_Release(unk);

View File

@ -580,7 +580,7 @@ static void parse_script(BSTR script_str)
return;
}
hres = IActiveScriptParse_InitNew(parser);
hres = IActiveScriptParse64_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
@ -593,11 +593,11 @@ static void parse_script(BSTR script_str)
hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED);
ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres);
hres = IActiveScriptParse_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse64_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
IActiveScript_Release(engine);
IActiveScriptParse_Release(parser);
IUnknown_Release(parser);
}
static void parse_script_a(const char *src)
@ -707,7 +707,7 @@ static void test_isvisible(BOOL global_members)
return;
}
hres = IActiveScriptParse_InitNew(parser);
hres = IActiveScriptParse64_InitNew(parser);
ok(hres == S_OK, "InitNew failed: %08x\n", hres);
hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite);
@ -727,16 +727,16 @@ static void test_isvisible(BOOL global_members)
if(!global_members)
SET_EXPECT(GetItemInfo_testVal);
hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse64_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
if(!global_members)
CHECK_CALLED(GetItemInfo_testVal);
hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
hres = IActiveScriptParse64_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
IActiveScript_Release(engine);
IActiveScriptParse_Release(parser);
IUnknown_Release(parser);
}
static void run_tests(void)

View File

@ -119,7 +119,7 @@ static BOOL init_script_engine(ScriptHost *script_host)
WARN("Could not get IActiveScriptProperty: %08x\n", hres);
}
hres = IActiveScriptParse_InitNew(script_host->parse);
hres = IActiveScriptParse64_InitNew(script_host->parse);
if(FAILED(hres)) {
WARN("InitNew failed: %08x\n", hres);
return FALSE;
@ -180,7 +180,7 @@ static void release_script_engine(ScriptHost *This)
}
if(This->parse) {
IActiveScriptParse_Release(This->parse);
IUnknown_Release(This->parse);
This->parse = NULL;
}
}
@ -552,7 +552,7 @@ static void parse_text(ScriptHost *script_host, LPCWSTR text)
VariantInit(&var);
memset(&excepinfo, 0, sizeof(excepinfo));
hres = IActiveScriptParse_ParseScriptText(script_host->parse, text, windowW, NULL, script_endW,
hres = IActiveScriptParse64_ParseScriptText(script_host->parse, text, windowW, NULL, script_endW,
0, 0, SCRIPTTEXT_ISVISIBLE|SCRIPTTEXT_HOSTMANAGESSOURCE,
&var, &excepinfo);
if(FAILED(hres))

View File

@ -36,6 +36,18 @@
DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
#ifdef _WIN64
#define CTXARG_T DWORDLONG
#define IActiveScriptParseVtbl IActiveScriptParse64Vtbl
#else
#define CTXARG_T DWORD
#define IActiveScriptParseVtbl IActiveScriptParse32Vtbl
#endif
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
@ -579,7 +591,7 @@ static HRESULT WINAPI ActiveScriptParse_InitNew(IActiveScriptParse *iface)
static HRESULT WINAPI ActiveScriptParse_AddScriptlet(IActiveScriptParse *iface,
LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName,
LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter,
DWORD dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
CTXARG_T dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
BSTR *pbstrName, EXCEPINFO *pexcepinfo)
{
ok(0, "unexpected call\n");
@ -588,7 +600,7 @@ static HRESULT WINAPI ActiveScriptParse_AddScriptlet(IActiveScriptParse *iface,
static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *iface,
LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext,
LPCOLESTR pstrDelimiter, DWORD dwSourceContextCookie, ULONG ulStartingLine,
LPCOLESTR pstrDelimiter, CTXARG_T dwSourceContextCookie, ULONG ulStartingLine,
DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
{
IDispatchEx *document;

View File

@ -138,14 +138,14 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
if (FAILED(hr)) goto done;
/* Initialize the script engine */
hr = IActiveScriptParse_InitNew(pActiveScriptParse);
hr = IActiveScriptParse64_InitNew(pActiveScriptParse);
if (FAILED(hr)) goto done;
/* Add the session object */
hr = IActiveScript_AddNamedItem(pActiveScript, szSession, SCRIPTITEM_ISVISIBLE);
/* Pass the script to the engine */
hr = IActiveScriptParse_ParseScriptText(pActiveScriptParse, script, NULL, NULL, NULL, 0, 0, 0L, NULL, NULL);
hr = IActiveScriptParse64_ParseScriptText(pActiveScriptParse, script, NULL, NULL, NULL, 0, 0, 0L, NULL, NULL);
if (FAILED(hr)) goto done;
/* Start processing the script */

View File

@ -268,7 +268,7 @@ object,
uuid(BB1A2AE2-A4F9-11cf-8F20-00805F2CD064),
pointer_default(unique)
]
interface IActiveScriptParse : IUnknown
interface IActiveScriptParse32 : IUnknown
{
HRESULT InitNew(void);
@ -299,6 +299,50 @@ interface IActiveScriptParse : IUnknown
);
}
[
object,
uuid(c7ef7658-e1ee-480e-97ea-d52cb4d76d17),
pointer_default(unique)
]
interface IActiveScriptParse64 : IUnknown
{
HRESULT InitNew(void);
HRESULT AddScriptlet(
[in] LPCOLESTR pstrDefaultName,
[in] LPCOLESTR pstrCode,
[in] LPCOLESTR pstrItemName,
[in] LPCOLESTR pstrSubItemName,
[in] LPCOLESTR pstrEventName,
[in] LPCOLESTR pstrDelimiter,
[in] DWORDLONG dwSourceContextCookie,
[in] ULONG ulStartingLineNumber,
[in] DWORD dwFlags,
[out] BSTR *pbstrName,
[out] EXCEPINFO *pexcepinfo
);
HRESULT ParseScriptText(
[in] LPCOLESTR pstrCode,
[in] LPCOLESTR pstrItemName,
[in] IUnknown *punkContext,
[in] LPCOLESTR pstrDelimiter,
[in] DWORDLONG dwSourceContextCookie,
[in] ULONG ulStartingLineNumber,
[in] DWORD dwFlags,
[out] VARIANT *pvarResult,
[out] EXCEPINFO *pexcepinfo
);
}
cpp_quote("#ifdef _WIN64")
cpp_quote("#define IActiveScriptParse IActiveScriptParse64")
cpp_quote("#define IID_IActiveScriptParse IID_IActiveScriptParse64")
cpp_quote("#else")
cpp_quote("#define IActiveScriptParse IActiveScriptParse32")
cpp_quote("#define IID_IActiveScriptParse IID_IActiveScriptParse32")
cpp_quote("#endif")
cpp_quote("typedef IActiveScriptParse *PIActiveScriptParse;")
[