mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[VBSCRIPT] Sync with Wine Staging 3.9. CORE-14656
This commit is contained in:
parent
af009ed327
commit
bcea8c65d0
|
@ -1746,6 +1746,8 @@ void release_vbscode(vbscode_t *code)
|
||||||
for(i=0; i < code->bstr_cnt; i++)
|
for(i=0; i < code->bstr_cnt; i++)
|
||||||
SysFreeString(code->bstr_pool[i]);
|
SysFreeString(code->bstr_pool[i]);
|
||||||
|
|
||||||
|
if(code->context)
|
||||||
|
IDispatch_Release(code->context);
|
||||||
heap_pool_free(&code->heap);
|
heap_pool_free(&code->heap);
|
||||||
|
|
||||||
heap_free(code->bstr_pool);
|
heap_free(code->bstr_pool);
|
||||||
|
@ -1758,7 +1760,7 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
|
||||||
{
|
{
|
||||||
vbscode_t *ret;
|
vbscode_t *ret;
|
||||||
|
|
||||||
ret = heap_alloc(sizeof(*ret));
|
ret = heap_alloc_zero(sizeof(*ret));
|
||||||
if(!ret)
|
if(!ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1780,19 +1782,8 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
|
||||||
|
|
||||||
ret->option_explicit = ctx->parser.option_explicit;
|
ret->option_explicit = ctx->parser.option_explicit;
|
||||||
|
|
||||||
ret->bstr_pool = NULL;
|
|
||||||
ret->bstr_pool_size = 0;
|
|
||||||
ret->bstr_cnt = 0;
|
|
||||||
ret->pending_exec = FALSE;
|
|
||||||
|
|
||||||
ret->main_code.type = FUNC_GLOBAL;
|
ret->main_code.type = FUNC_GLOBAL;
|
||||||
ret->main_code.name = NULL;
|
|
||||||
ret->main_code.code_ctx = ret;
|
ret->main_code.code_ctx = ret;
|
||||||
ret->main_code.vars = NULL;
|
|
||||||
ret->main_code.var_cnt = 0;
|
|
||||||
ret->main_code.array_cnt = 0;
|
|
||||||
ret->main_code.arg_cnt = 0;
|
|
||||||
ret->main_code.args = NULL;
|
|
||||||
|
|
||||||
list_init(&ret->entry);
|
list_init(&ret->entry);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -99,6 +99,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
|
||||||
{
|
{
|
||||||
named_item_t *item;
|
named_item_t *item;
|
||||||
function_t *func;
|
function_t *func;
|
||||||
|
IDispatch *disp;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
DISPID id;
|
DISPID id;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -153,6 +154,16 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ctx->func->code_ctx->context) {
|
||||||
|
hres = disp_get_id(ctx->func->code_ctx->context, name, invoke_type, TRUE, &id);
|
||||||
|
if(SUCCEEDED(hres)) {
|
||||||
|
ref->type = REF_DISP;
|
||||||
|
ref->u.d.disp = ctx->func->code_ctx->context;
|
||||||
|
ref->u.d.id = id;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(ctx->func->type != FUNC_GLOBAL && lookup_dynamic_vars(ctx->script->global_vars, name, ref))
|
if(ctx->func->type != FUNC_GLOBAL && lookup_dynamic_vars(ctx->script->global_vars, name, ref))
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
@ -178,29 +189,11 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
|
disp = lookup_named_item(ctx->script, name, SCRIPTITEM_ISVISIBLE);
|
||||||
if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpiW(item->name, name)) {
|
if(disp) {
|
||||||
if(!item->disp) {
|
ref->type = REF_OBJ;
|
||||||
IUnknown *unk;
|
ref->u.obj = disp;
|
||||||
|
return S_OK;
|
||||||
hres = IActiveScriptSite_GetItemInfo(ctx->script->site, item->name, SCRIPTINFO_IUNKNOWN, &unk, NULL);
|
|
||||||
if(FAILED(hres)) {
|
|
||||||
WARN("GetItemInfo failed: %08x\n", hres);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&item->disp);
|
|
||||||
IUnknown_Release(unk);
|
|
||||||
if(FAILED(hres)) {
|
|
||||||
WARN("object does not implement IDispatch\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ref->type = REF_OBJ;
|
|
||||||
ref->u.obj = item->disp;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
|
LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
|
||||||
|
|
|
@ -29,12 +29,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
|
||||||
#define CTXARG_T DWORDLONG
|
#define CTXARG_T DWORDLONG
|
||||||
|
#define IActiveScriptDebugVtbl IActiveScriptDebug64Vtbl
|
||||||
#define IActiveScriptParseVtbl IActiveScriptParse64Vtbl
|
#define IActiveScriptParseVtbl IActiveScriptParse64Vtbl
|
||||||
#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_64Vtbl
|
#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_64Vtbl
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define CTXARG_T DWORD
|
#define CTXARG_T DWORD
|
||||||
|
#define IActiveScriptDebugVtbl IActiveScriptDebug32Vtbl
|
||||||
#define IActiveScriptParseVtbl IActiveScriptParse32Vtbl
|
#define IActiveScriptParseVtbl IActiveScriptParse32Vtbl
|
||||||
#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_32Vtbl
|
#define IActiveScriptParseProcedure2Vtbl IActiveScriptParseProcedure2_32Vtbl
|
||||||
|
|
||||||
|
@ -42,6 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vbscript);
|
||||||
|
|
||||||
struct VBScript {
|
struct VBScript {
|
||||||
IActiveScript IActiveScript_iface;
|
IActiveScript IActiveScript_iface;
|
||||||
|
IActiveScriptDebug IActiveScriptDebug_iface;
|
||||||
IActiveScriptParse IActiveScriptParse_iface;
|
IActiveScriptParse IActiveScriptParse_iface;
|
||||||
IActiveScriptParseProcedure2 IActiveScriptParseProcedure2_iface;
|
IActiveScriptParseProcedure2 IActiveScriptParseProcedure2_iface;
|
||||||
IObjectSafety IObjectSafety_iface;
|
IObjectSafety IObjectSafety_iface;
|
||||||
|
@ -96,6 +99,38 @@ static void exec_queued_code(script_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IDispatch *lookup_named_item(script_ctx_t *ctx, const WCHAR *name, unsigned flags)
|
||||||
|
{
|
||||||
|
named_item_t *item;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(item, &ctx->named_items, named_item_t, entry) {
|
||||||
|
if((item->flags & flags) == flags && !strcmpiW(item->name, name)) {
|
||||||
|
if(!item->disp) {
|
||||||
|
IUnknown *unk;
|
||||||
|
|
||||||
|
hres = IActiveScriptSite_GetItemInfo(ctx->site, item->name,
|
||||||
|
SCRIPTINFO_IUNKNOWN, &unk, NULL);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
WARN("GetItemInfo failed: %08x\n", hres);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&item->disp);
|
||||||
|
IUnknown_Release(unk);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
WARN("object does not implement IDispatch\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return item->disp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT set_ctx_site(VBScript *This)
|
static HRESULT set_ctx_site(VBScript *This)
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
@ -235,6 +270,9 @@ static HRESULT WINAPI VBScript_QueryInterface(IActiveScript *iface, REFIID riid,
|
||||||
}else if(IsEqualGUID(riid, &IID_IActiveScript)) {
|
}else if(IsEqualGUID(riid, &IID_IActiveScript)) {
|
||||||
TRACE("(%p)->(IID_IActiveScript %p)\n", This, ppv);
|
TRACE("(%p)->(IID_IActiveScript %p)\n", This, ppv);
|
||||||
*ppv = &This->IActiveScript_iface;
|
*ppv = &This->IActiveScript_iface;
|
||||||
|
}else if(IsEqualGUID(riid, &IID_IActiveScriptDebug)) {
|
||||||
|
TRACE("(%p)->(IID_IActiveScriptDebug %p)\n", This, ppv);
|
||||||
|
*ppv = &This->IActiveScriptDebug_iface;
|
||||||
}else if(IsEqualGUID(riid, &IID_IActiveScriptParse)) {
|
}else if(IsEqualGUID(riid, &IID_IActiveScriptParse)) {
|
||||||
TRACE("(%p)->(IID_IActiveScriptParse %p)\n", This, ppv);
|
TRACE("(%p)->(IID_IActiveScriptParse %p)\n", This, ppv);
|
||||||
*ppv = &This->IActiveScriptParse_iface;
|
*ppv = &This->IActiveScriptParse_iface;
|
||||||
|
@ -532,6 +570,64 @@ static const IActiveScriptVtbl VBScriptVtbl = {
|
||||||
VBScript_Clone
|
VBScript_Clone
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline VBScript *impl_from_IActiveScriptDebug(IActiveScriptDebug *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, VBScript, IActiveScriptDebug_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI VBScriptDebug_QueryInterface(IActiveScriptDebug *iface, REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
VBScript *This = impl_from_IActiveScriptDebug(iface);
|
||||||
|
return IActiveScript_QueryInterface(&This->IActiveScript_iface, riid, ppv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI VBScriptDebug_AddRef(IActiveScriptDebug *iface)
|
||||||
|
{
|
||||||
|
VBScript *This = impl_from_IActiveScriptDebug(iface);
|
||||||
|
return IActiveScript_AddRef(&This->IActiveScript_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI VBScriptDebug_Release(IActiveScriptDebug *iface)
|
||||||
|
{
|
||||||
|
VBScript *This = impl_from_IActiveScriptDebug(iface);
|
||||||
|
return IActiveScript_Release(&This->IActiveScript_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI VBScriptDebug_GetScriptTextAttributes(IActiveScriptDebug *iface,
|
||||||
|
LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr)
|
||||||
|
{
|
||||||
|
VBScript *This = impl_from_IActiveScriptDebug(iface);
|
||||||
|
FIXME("(%p)->(%s %u %s %#x %p)\n", This, debugstr_w(code), len,
|
||||||
|
debugstr_w(delimiter), flags, attr);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI VBScriptDebug_GetScriptletTextAttributes(IActiveScriptDebug *iface,
|
||||||
|
LPCOLESTR code, ULONG len, LPCOLESTR delimiter, DWORD flags, SOURCE_TEXT_ATTR *attr)
|
||||||
|
{
|
||||||
|
VBScript *This = impl_from_IActiveScriptDebug(iface);
|
||||||
|
FIXME("(%p)->(%s %u %s %#x %p)\n", This, debugstr_w(code), len,
|
||||||
|
debugstr_w(delimiter), flags, attr);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI VBScriptDebug_EnumCodeContextsOfPosition(IActiveScriptDebug *iface,
|
||||||
|
CTXARG_T source, ULONG offset, ULONG len, IEnumDebugCodeContexts **ret)
|
||||||
|
{
|
||||||
|
VBScript *This = impl_from_IActiveScriptDebug(iface);
|
||||||
|
FIXME("(%p)->(%s %u %u %p)\n", This, wine_dbgstr_longlong(source), offset, len, ret);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IActiveScriptDebugVtbl VBScriptDebugVtbl = {
|
||||||
|
VBScriptDebug_QueryInterface,
|
||||||
|
VBScriptDebug_AddRef,
|
||||||
|
VBScriptDebug_Release,
|
||||||
|
VBScriptDebug_GetScriptTextAttributes,
|
||||||
|
VBScriptDebug_GetScriptletTextAttributes,
|
||||||
|
VBScriptDebug_EnumCodeContextsOfPosition,
|
||||||
|
};
|
||||||
|
|
||||||
static inline VBScript *impl_from_IActiveScriptParse(IActiveScriptParse *iface)
|
static inline VBScript *impl_from_IActiveScriptParse(IActiveScriptParse *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, VBScript, IActiveScriptParse_iface);
|
return CONTAINING_RECORD(iface, VBScript, IActiveScriptParse_iface);
|
||||||
|
@ -604,6 +700,7 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface,
|
||||||
DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
|
DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
|
||||||
{
|
{
|
||||||
VBScript *This = impl_from_IActiveScriptParse(iface);
|
VBScript *This = impl_from_IActiveScriptParse(iface);
|
||||||
|
IDispatch *context = NULL;
|
||||||
vbscode_t *code;
|
vbscode_t *code;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
|
@ -614,10 +711,21 @@ static HRESULT WINAPI VBScriptParse_ParseScriptText(IActiveScriptParse *iface,
|
||||||
if(This->thread_id != GetCurrentThreadId() || This->state == SCRIPTSTATE_CLOSED)
|
if(This->thread_id != GetCurrentThreadId() || This->state == SCRIPTSTATE_CLOSED)
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
|
|
||||||
|
if(pstrItemName) {
|
||||||
|
context = lookup_named_item(This->ctx, pstrItemName, 0);
|
||||||
|
if(!context) {
|
||||||
|
WARN("Inknown context %s\n", debugstr_w(pstrItemName));
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hres = compile_script(This->ctx, pstrCode, pstrDelimiter, &code);
|
hres = compile_script(This->ctx, pstrCode, pstrDelimiter, &code);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
if(context)
|
||||||
|
IDispatch_AddRef(code->context = context);
|
||||||
|
|
||||||
if(!is_started(This)) {
|
if(!is_started(This)) {
|
||||||
code->pending_exec = TRUE;
|
code->pending_exec = TRUE;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -762,6 +870,7 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
ret->IActiveScript_iface.lpVtbl = &VBScriptVtbl;
|
ret->IActiveScript_iface.lpVtbl = &VBScriptVtbl;
|
||||||
|
ret->IActiveScriptDebug_iface.lpVtbl = &VBScriptDebugVtbl;
|
||||||
ret->IActiveScriptParse_iface.lpVtbl = &VBScriptParseVtbl;
|
ret->IActiveScriptParse_iface.lpVtbl = &VBScriptParseVtbl;
|
||||||
ret->IActiveScriptParseProcedure2_iface.lpVtbl = &VBScriptParseProcedureVtbl;
|
ret->IActiveScriptParseProcedure2_iface.lpVtbl = &VBScriptParseProcedureVtbl;
|
||||||
ret->IObjectSafety_iface.lpVtbl = &VBScriptSafetyVtbl;
|
ret->IObjectSafety_iface.lpVtbl = &VBScriptSafetyVtbl;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "dispex.h"
|
#include "dispex.h"
|
||||||
#include "activscp.h"
|
#include "activscp.h"
|
||||||
|
#include "activdbg.h"
|
||||||
|
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
#include <initguid.h>
|
#include <initguid.h>
|
||||||
|
@ -347,6 +348,7 @@ struct _vbscode_t {
|
||||||
|
|
||||||
BOOL pending_exec;
|
BOOL pending_exec;
|
||||||
function_t main_code;
|
function_t main_code;
|
||||||
|
IDispatch *context;
|
||||||
|
|
||||||
BSTR *bstr_pool;
|
BSTR *bstr_pool;
|
||||||
unsigned bstr_pool_size;
|
unsigned bstr_pool_size;
|
||||||
|
@ -360,6 +362,7 @@ void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
|
||||||
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN;
|
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN;
|
||||||
HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
|
HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
|
||||||
void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
|
void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
|
||||||
|
IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 len;
|
UINT16 len;
|
||||||
|
|
|
@ -191,7 +191,7 @@ reactos/dll/win32/url # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/urlmon # Synced to WineStaging-3.9
|
reactos/dll/win32/urlmon # Synced to WineStaging-3.9
|
||||||
reactos/dll/win32/usp10 # Synced to WineStaging-3.9
|
reactos/dll/win32/usp10 # Synced to WineStaging-3.9
|
||||||
reactos/dll/win32/uxtheme # Forked
|
reactos/dll/win32/uxtheme # Forked
|
||||||
reactos/dll/win32/vbscript # Synced to WineStaging-3.3
|
reactos/dll/win32/vbscript # Synced to WineStaging-3.9
|
||||||
reactos/dll/win32/version # Synced to WineStaging-3.3
|
reactos/dll/win32/version # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/vssapi # Synced to WineStaging-2.9
|
reactos/dll/win32/vssapi # Synced to WineStaging-2.9
|
||||||
reactos/dll/win32/wbemdisp # Synced to WineStaging-3.3
|
reactos/dll/win32/wbemdisp # Synced to WineStaging-3.3
|
||||||
|
|
Loading…
Reference in a new issue