ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2016
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
228 discussions
Start a n
N
ew thread
[akhaldi] 71557: [JSCRIPT] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:25:30 2016 New Revision: 71557 URL:
http://svn.reactos.org/svn/reactos?rev=71557&view=rev
Log: [JSCRIPT] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/win32/jscript/compile.c trunk/reactos/dll/win32/jscript/date.c trunk/reactos/dll/win32/jscript/decode.c trunk/reactos/dll/win32/jscript/dispex.c trunk/reactos/dll/win32/jscript/engine.c trunk/reactos/dll/win32/jscript/engine.h trunk/reactos/dll/win32/jscript/function.c trunk/reactos/dll/win32/jscript/global.c trunk/reactos/dll/win32/jscript/jscript.c trunk/reactos/dll/win32/jscript/jscript.h trunk/reactos/dll/win32/jscript/jsregexp.c trunk/reactos/dll/win32/jscript/lex.c trunk/reactos/dll/win32/jscript/string.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/jscript/compile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/compile.…
============================================================================== --- trunk/reactos/dll/win32/jscript/compile.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/compile.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -550,12 +550,20 @@ arg_cnt++; } - return push_instr_uint(ctx, OP_new, arg_cnt); + hres = push_instr_uint(ctx, OP_new, arg_cnt); + if(FAILED(hres)) + return hres; + + hres = push_instr_uint(ctx, OP_pop, arg_cnt+1); + if(FAILED(hres)) + return hres; + + return push_instr(ctx, OP_push_ret) ? S_OK : E_OUTOFMEMORY; } static HRESULT compile_call_expression(compiler_ctx_t *ctx, call_expression_t *expr, BOOL emit_ret) { - unsigned arg_cnt = 0; + unsigned arg_cnt = 0, extra_args; argument_t *arg; unsigned instr; jsop_t op; @@ -563,9 +571,11 @@ if(is_memberid_expr(expr->expression->type)) { op = OP_call_member; + extra_args = 2; hres = compile_memberid_expression(ctx, expr->expression, 0); }else { op = OP_call; + extra_args = 1; hres = compile_expression(ctx, expr->expression, TRUE); } @@ -585,7 +595,12 @@ instr_ptr(ctx, instr)->u.arg[0].uint = arg_cnt; instr_ptr(ctx, instr)->u.arg[1].lng = emit_ret; - return S_OK; + + hres = push_instr_uint(ctx, OP_pop, arg_cnt + extra_args); + if(FAILED(hres)) + return hres; + + return !emit_ret || push_instr(ctx, OP_push_ret) ? S_OK : E_OUTOFMEMORY; } static HRESULT compile_delete_expression(compiler_ctx_t *ctx, unary_expression_t *expr) @@ -849,17 +864,11 @@ return S_OK; } -static HRESULT compile_function_expression(compiler_ctx_t *ctx, function_expression_t *expr) -{ +static HRESULT compile_function_expression(compiler_ctx_t *ctx, function_expression_t *expr, BOOL emit_ret) +{ + unsigned func_id = ctx->func->func_cnt++; ctx->func_tail = ctx->func_tail ? (ctx->func_tail->next = expr) : (ctx->func_head = expr); - - /* FIXME: not exactly right */ - if(expr->identifier && !expr->event_target) { - ctx->func->func_cnt++; - return push_instr_bstr(ctx, OP_ident, expr->identifier); - } - - return push_instr_uint(ctx, OP_func, ctx->func->func_cnt++); + return emit_ret ? push_instr_uint(ctx, OP_func, func_id) : S_OK; } static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr, BOOL emit_ret) @@ -944,8 +953,7 @@ hres = compile_binary_expression(ctx, (binary_expression_t*)expr, OP_eq2); break; case EXPR_FUNC: - hres = compile_function_expression(ctx, (function_expression_t*)expr); - break; + return compile_function_expression(ctx, (function_expression_t*)expr, emit_ret); case EXPR_GREATER: hres = compile_binary_expression(ctx, (binary_expression_t*)expr, OP_gt); break; @@ -1471,7 +1479,7 @@ if(FAILED(hres)) return hres; - return push_instr(ctx, OP_ret) ? S_OK : E_OUTOFMEMORY; + return push_instr_uint(ctx, OP_ret, !stat->expr); } /* ECMA-262 3rd Edition 12.10 */ @@ -1849,8 +1857,9 @@ resolve_labels(ctx, off); - if(!push_instr(ctx, OP_ret)) - return E_OUTOFMEMORY; + hres = push_instr_uint(ctx, OP_ret, !from_eval); + if(FAILED(hres)) + return hres; if(TRACE_ON(jscript_disas)) dump_code(ctx, off); Modified: trunk/reactos/dll/win32/jscript/date.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/date.c?r…
============================================================================== --- trunk/reactos/dll/win32/jscript/date.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/date.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -2163,6 +2163,28 @@ year = tmp; } } + else if(parse[i]=='+' || parse[i]=='-') { + /* Timezone offset */ + BOOL positive = TRUE; + + if(set_offset && set_hour_adjust) break; + set_offset = TRUE; + set_hour_adjust = FALSE; + + if(parse[i] == '-') positive = FALSE; + + i++; + while(isspaceW(parse[i])) i++; + if(parse[i]<'0' || parse[i]>'9') break; + offset = atoiW(&parse[i]); + while(parse[i]>='0' && parse[i]<='9') i++; + + if(offset<24) offset *= 60; + else offset = (offset/100)*60 + offset%100; + + if(positive) offset = -offset; + + } else { if(parse[i]<'A' || parse[i]>'Z') break; else if(parse[i]=='B' && (parse[i+1]=='C' || @@ -2219,27 +2241,11 @@ else if((parse[i]=='U' && parse[i+1]=='T' && parse[i+2]=='C') || (parse[i]=='G' && parse[i+1]=='M' && parse[i+2]=='T')) { /* Timezone */ - BOOL positive = TRUE; - if(set_offset) break; set_offset = TRUE; set_hour_adjust = FALSE; i += 3; - while(isspaceW(parse[i])) i++; - if(parse[i] == '-') positive = FALSE; - else if(parse[i] != '+') continue; - - i++; - while(isspaceW(parse[i])) i++; - if(parse[i]<'0' || parse[i]>'9') break; - offset = atoiW(&parse[i]); - while(parse[i]>='0' && parse[i]<='9') i++; - - if(offset<24) offset *= 60; - else offset = (offset/100)*60 + offset%100; - - if(positive) offset = -offset; } else { /* Month or garbage */ Modified: trunk/reactos/dll/win32/jscript/decode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/decode.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/decode.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/decode.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -87,7 +87,7 @@ DWORD i; for(i=0; i<6; i++) { - if(p[i] > sizeof(digits)/sizeof(*digits) || digits[p[i]] == 0xff) + if(p[i] >= sizeof(digits)/sizeof(*digits) || digits[p[i]] == 0xff) return FALSE; } if(p[6] != '=' || p[7] != '=') Modified: trunk/reactos/dll/win32/jscript/dispex.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/dispex.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/dispex.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/dispex.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -370,6 +370,8 @@ if(prop->name || This->builtin_info->class != JSCLASS_FUNCTION) { vdisp_t vthis; + if(This->builtin_info->class != JSCLASS_FUNCTION && prop->u.p->invoke != JSGlobal_eval) + flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; if(jsthis) set_disp(&vthis, jsthis); else @@ -1053,7 +1055,7 @@ { HRESULT hres; - assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT))); + assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK))); if(is_class(jsfunc, JSCLASS_FUNCTION)) { hres = Function_invoke(jsfunc, jsthis, flags, argc, argv, r); @@ -1066,6 +1068,7 @@ } set_disp(&vdisp, jsthis); + flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; hres = jsfunc->builtin_info->value_prop.invoke(jsfunc->ctx, &vdisp, flags, argc, argv, r); vdisp_release(&vdisp); } @@ -1116,6 +1119,7 @@ return hres; } + flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; if(ret && argc) flags |= DISPATCH_PROPERTYGET; @@ -1180,6 +1184,7 @@ hres = variant_to_jsval(&retv, ret); VariantClear(&retv); } + return hres; } @@ -1193,7 +1198,7 @@ unsigned i; HRESULT hres; - assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT))); + assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK))); jsdisp = iface_to_jsdisp((IUnknown*)disp); if(jsdisp) { @@ -1202,6 +1207,7 @@ return hres; } + flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; if(r && argc && flags == DISPATCH_METHOD) flags |= DISPATCH_PROPERTYGET; Modified: trunk/reactos/dll/win32/jscript/engine.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/engine.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/engine.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/engine.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -50,14 +50,14 @@ } u; } exprval_t; -static HRESULT stack_push(exec_ctx_t *ctx, jsval_t v) +static HRESULT stack_push(script_ctx_t *ctx, jsval_t v) { if(!ctx->stack_size) { ctx->stack = heap_alloc(16*sizeof(*ctx->stack)); if(!ctx->stack) return E_OUTOFMEMORY; ctx->stack_size = 16; - }else if(ctx->stack_size == ctx->top) { + }else if(ctx->stack_size == ctx->stack_top) { jsval_t *new_stack; new_stack = heap_realloc(ctx->stack, ctx->stack_size*2*sizeof(*new_stack)); @@ -70,11 +70,11 @@ ctx->stack_size *= 2; } - ctx->stack[ctx->top++] = v; + ctx->stack[ctx->stack_top++] = v; return S_OK; } -static inline HRESULT stack_push_string(exec_ctx_t *ctx, const WCHAR *str) +static inline HRESULT stack_push_string(script_ctx_t *ctx, const WCHAR *str) { jsstr_t *v; @@ -85,7 +85,7 @@ return stack_push(ctx, jsval_string(v)); } -static HRESULT stack_push_objid(exec_ctx_t *ctx, IDispatch *disp, DISPID id) +static HRESULT stack_push_objid(script_ctx_t *ctx, IDispatch *disp, DISPID id) { HRESULT hres; @@ -96,50 +96,50 @@ return stack_push(ctx, jsval_number(id)); } -static inline jsval_t stack_top(exec_ctx_t *ctx) -{ - assert(ctx->top); - return ctx->stack[ctx->top-1]; -} - -static inline jsval_t stack_topn(exec_ctx_t *ctx, unsigned n) -{ - assert(ctx->top > n); - return ctx->stack[ctx->top-1-n]; -} - -static inline jsval_t *stack_args(exec_ctx_t *ctx, unsigned n) +static inline jsval_t stack_top(script_ctx_t *ctx) +{ + assert(ctx->stack_top > ctx->call_ctx->stack_base); + return ctx->stack[ctx->stack_top-1]; +} + +static inline jsval_t stack_topn(script_ctx_t *ctx, unsigned n) +{ + assert(ctx->stack_top > ctx->call_ctx->stack_base+n); + return ctx->stack[ctx->stack_top-1-n]; +} + +static inline jsval_t *stack_args(script_ctx_t *ctx, unsigned n) { if(!n) return NULL; - assert(ctx->top > n-1); - return ctx->stack + ctx->top-n; -} - -static inline jsval_t stack_pop(exec_ctx_t *ctx) -{ - assert(ctx->top); - return ctx->stack[--ctx->top]; -} - -static void stack_popn(exec_ctx_t *ctx, unsigned n) + assert(ctx->stack_top > ctx->call_ctx->stack_base+n-1); + return ctx->stack + ctx->stack_top-n; +} + +static inline jsval_t stack_pop(script_ctx_t *ctx) +{ + assert(ctx->stack_top > ctx->call_ctx->stack_base); + return ctx->stack[--ctx->stack_top]; +} + +static void stack_popn(script_ctx_t *ctx, unsigned n) { while(n--) jsval_release(stack_pop(ctx)); } -static HRESULT stack_pop_number(exec_ctx_t *ctx, double *r) +static HRESULT stack_pop_number(script_ctx_t *ctx, double *r) { jsval_t v; HRESULT hres; v = stack_pop(ctx); - hres = to_number(ctx->script, v, r); + hres = to_number(ctx, v, r); jsval_release(v); return hres; } -static HRESULT stack_pop_object(exec_ctx_t *ctx, IDispatch **r) +static HRESULT stack_pop_object(script_ctx_t *ctx, IDispatch **r) { jsval_t v; HRESULT hres; @@ -147,27 +147,27 @@ v = stack_pop(ctx); if(is_object_instance(v)) { if(!get_object(v)) - return throw_type_error(ctx->script, JS_E_OBJECT_REQUIRED, NULL); + return throw_type_error(ctx, JS_E_OBJECT_REQUIRED, NULL); *r = get_object(v); return S_OK; } - hres = to_object(ctx->script, v, r); + hres = to_object(ctx, v, r); jsval_release(v); return hres; } -static inline HRESULT stack_pop_int(exec_ctx_t *ctx, INT *r) -{ - return to_int32(ctx->script, stack_pop(ctx), r); -} - -static inline HRESULT stack_pop_uint(exec_ctx_t *ctx, DWORD *r) -{ - return to_uint32(ctx->script, stack_pop(ctx), r); -} - -static inline IDispatch *stack_pop_objid(exec_ctx_t *ctx, DISPID *id) +static inline HRESULT stack_pop_int(script_ctx_t *ctx, INT *r) +{ + return to_int32(ctx, stack_pop(ctx), r); +} + +static inline HRESULT stack_pop_uint(script_ctx_t *ctx, DWORD *r) +{ + return to_uint32(ctx, stack_pop(ctx), r); +} + +static inline IDispatch *stack_pop_objid(script_ctx_t *ctx, DISPID *id) { assert(is_number(stack_top(ctx)) && is_object_instance(stack_topn(ctx, 1))); @@ -175,12 +175,24 @@ return get_object(stack_pop(ctx)); } -static inline IDispatch *stack_topn_objid(exec_ctx_t *ctx, unsigned n, DISPID *id) +static inline IDispatch *stack_topn_objid(script_ctx_t *ctx, unsigned n, DISPID *id) { assert(is_number(stack_topn(ctx, n)) && is_object_instance(stack_topn(ctx, n+1))); *id = get_number(stack_topn(ctx, n)); return get_object(stack_topn(ctx, n+1)); +} + +static inline jsval_t steal_ret(call_frame_t *frame) +{ + jsval_t r = frame->ret; + frame->ret = jsval_undefined(); + return r; +} + +static inline void clear_ret(call_frame_t *frame) +{ + jsval_release(steal_ret(frame)); } static void exprval_release(exprval_t *val) @@ -282,72 +294,6 @@ IDispatch_Release(scope->obj); heap_free(scope); -} - -HRESULT create_exec_ctx(script_ctx_t *script_ctx, IDispatch *this_obj, jsdisp_t *var_disp, - scope_chain_t *scope, BOOL is_global, exec_ctx_t **ret) -{ - exec_ctx_t *ctx; - - ctx = heap_alloc_zero(sizeof(exec_ctx_t)); - if(!ctx) - return E_OUTOFMEMORY; - - ctx->ref = 1; - ctx->is_global = is_global; - ctx->ret = jsval_undefined(); - - /* ECMA-262 3rd Edition 11.2.3.7 */ - if(this_obj) { - jsdisp_t *jsthis; - - jsthis = iface_to_jsdisp((IUnknown*)this_obj); - if(jsthis) { - if(jsthis->builtin_info->class == JSCLASS_GLOBAL || jsthis->builtin_info->class == JSCLASS_NONE) - this_obj = NULL; - jsdisp_release(jsthis); - } - } - - if(this_obj) - ctx->this_obj = this_obj; - else if(script_ctx->host_global) - ctx->this_obj = script_ctx->host_global; - else - ctx->this_obj = to_disp(script_ctx->global); - IDispatch_AddRef(ctx->this_obj); - - jsdisp_addref(var_disp); - ctx->var_disp = var_disp; - - script_addref(script_ctx); - ctx->script = script_ctx; - - if(scope) { - scope_addref(scope); - ctx->scope_chain = scope; - } - - *ret = ctx; - return S_OK; -} - -void exec_release(exec_ctx_t *ctx) -{ - if(--ctx->ref) - return; - - if(ctx->scope_chain) - scope_release(ctx->scope_chain); - if(ctx->var_disp) - jsdisp_release(ctx->var_disp); - if(ctx->this_obj) - IDispatch_Release(ctx->this_obj); - if(ctx->script) - script_release(ctx->script); - jsval_release(ctx->ret); - heap_free(ctx->stack); - heap_free(ctx); } static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name, BSTR name_bstr, DWORD flags, DISPID *id) @@ -500,8 +446,8 @@ TRACE("%s\n", debugstr_w(identifier)); - if(ctx->exec_ctx) { - for(scope = ctx->exec_ctx->scope_chain; scope; scope = scope->next) { + if(ctx->call_ctx) { + for(scope = ctx->call_ctx->scope; scope; scope = scope->next) { if(scope->jsobj) hres = jsdisp_get_id(scope->jsobj, identifier, fdexNameImplicit, &id); else @@ -556,28 +502,48 @@ return S_OK; } -static inline BSTR get_op_bstr(exec_ctx_t *ctx, int i){ - return ctx->code->instrs[ctx->ip].u.arg[i].bstr; -} - -static inline unsigned get_op_uint(exec_ctx_t *ctx, int i){ - return ctx->code->instrs[ctx->ip].u.arg[i].uint; -} - -static inline unsigned get_op_int(exec_ctx_t *ctx, int i){ - return ctx->code->instrs[ctx->ip].u.arg[i].lng; -} - -static inline jsstr_t *get_op_str(exec_ctx_t *ctx, int i){ - return ctx->code->instrs[ctx->ip].u.arg[i].str; -} - -static inline double get_op_double(exec_ctx_t *ctx){ - return ctx->code->instrs[ctx->ip].u.dbl; +static inline BSTR get_op_bstr(script_ctx_t *ctx, int i) +{ + call_frame_t *frame = ctx->call_ctx; + return frame->bytecode->instrs[frame->ip].u.arg[i].bstr; +} + +static inline unsigned get_op_uint(script_ctx_t *ctx, int i) +{ + call_frame_t *frame = ctx->call_ctx; + return frame->bytecode->instrs[frame->ip].u.arg[i].uint; +} + +static inline unsigned get_op_int(script_ctx_t *ctx, int i) +{ + call_frame_t *frame = ctx->call_ctx; + return frame->bytecode->instrs[frame->ip].u.arg[i].lng; +} + +static inline jsstr_t *get_op_str(script_ctx_t *ctx, int i) +{ + call_frame_t *frame = ctx->call_ctx; + return frame->bytecode->instrs[frame->ip].u.arg[i].str; +} + +static inline double get_op_double(script_ctx_t *ctx) +{ + call_frame_t *frame = ctx->call_ctx; + return frame->bytecode->instrs[frame->ip].u.dbl; +} + +static inline void jmp_next(script_ctx_t *ctx) +{ + ctx->call_ctx->ip++; +} + +static inline void jmp_abs(script_ctx_t *ctx, unsigned dst) +{ + ctx->call_ctx->ip = dst; } /* ECMA-262 3rd Edition 12.2 */ -static HRESULT interp_var_set(exec_ctx_t *ctx) +static HRESULT interp_var_set(script_ctx_t *ctx) { const BSTR name = get_op_bstr(ctx, 0); jsval_t val; @@ -586,13 +552,13 @@ TRACE("%s\n", debugstr_w(name)); val = stack_pop(ctx); - hres = jsdisp_propput_name(ctx->var_disp, name, val); + hres = jsdisp_propput_name(ctx->call_ctx->variable_obj, name, val); jsval_release(val); return hres; } /* ECMA-262 3rd Edition 12.6.4 */ -static HRESULT interp_forin(exec_ctx_t *ctx) +static HRESULT interp_forin(script_ctx_t *ctx) { const HRESULT arg = get_op_uint(ctx, 0); IDispatch *var_obj, *obj = NULL; @@ -640,21 +606,21 @@ stack_pop(ctx); stack_push(ctx, jsval_number(id)); /* safe, just after pop() */ - hres = disp_propput(ctx->script, var_obj, var_id, jsval_string(str)); + hres = disp_propput(ctx, var_obj, var_id, jsval_string(str)); jsstr_release(str); if(FAILED(hres)) return hres; - ctx->ip++; + jmp_next(ctx); }else { stack_popn(ctx, 4); - ctx->ip = arg; + jmp_abs(ctx, arg); } return S_OK; } /* ECMA-262 3rd Edition 12.10 */ -static HRESULT interp_push_scope(exec_ctx_t *ctx) +static HRESULT interp_push_scope(script_ctx_t *ctx) { IDispatch *disp; jsval_t v; @@ -663,27 +629,27 @@ TRACE("\n"); v = stack_pop(ctx); - hres = to_object(ctx->script, v, &disp); + hres = to_object(ctx, v, &disp); jsval_release(v); if(FAILED(hres)) return hres; - hres = scope_push(ctx->scope_chain, to_jsdisp(disp), disp, &ctx->scope_chain); + hres = scope_push(ctx->call_ctx->scope, to_jsdisp(disp), disp, &ctx->call_ctx->scope); IDispatch_Release(disp); return hres; } /* ECMA-262 3rd Edition 12.10 */ -static HRESULT interp_pop_scope(exec_ctx_t *ctx) -{ - TRACE("\n"); - - scope_pop(&ctx->scope_chain); +static HRESULT interp_pop_scope(script_ctx_t *ctx) +{ + TRACE("\n"); + + scope_pop(&ctx->call_ctx->scope); return S_OK; } /* ECMA-262 3rd Edition 12.13 */ -static HRESULT interp_case(exec_ctx_t *ctx) +static HRESULT interp_case(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); jsval_t v; @@ -700,33 +666,33 @@ if(b) { stack_popn(ctx, 1); - ctx->ip = arg; + jmp_abs(ctx, arg); }else { - ctx->ip++; + jmp_next(ctx); } return S_OK; } /* ECMA-262 3rd Edition 12.13 */ -static HRESULT interp_throw(exec_ctx_t *ctx) -{ - TRACE("\n"); - - jsval_release(ctx->script->ei.val); - ctx->script->ei.val = stack_pop(ctx); +static HRESULT interp_throw(script_ctx_t *ctx) +{ + TRACE("\n"); + + jsval_release(ctx->ei.val); + ctx->ei.val = stack_pop(ctx); return DISP_E_EXCEPTION; } -static HRESULT interp_throw_ref(exec_ctx_t *ctx) +static HRESULT interp_throw_ref(script_ctx_t *ctx) { const HRESULT arg = get_op_uint(ctx, 0); TRACE("%08x\n", arg); - return throw_reference_error(ctx->script, arg, NULL); -} - -static HRESULT interp_throw_type(exec_ctx_t *ctx) + return throw_reference_error(ctx, arg, NULL); +} + +static HRESULT interp_throw_type(script_ctx_t *ctx) { const HRESULT hres = get_op_uint(ctx, 0); jsstr_t *str = get_op_str(ctx, 1); @@ -735,20 +701,21 @@ TRACE("%08x %s\n", hres, debugstr_jsstr(str)); ptr = jsstr_flatten(str); - return ptr ? throw_type_error(ctx->script, hres, ptr) : E_OUTOFMEMORY; + return ptr ? throw_type_error(ctx, hres, ptr) : E_OUTOFMEMORY; } /* ECMA-262 3rd Edition 12.14 */ -static HRESULT interp_push_except(exec_ctx_t *ctx) +static HRESULT interp_push_except(script_ctx_t *ctx) { const unsigned arg1 = get_op_uint(ctx, 0); const BSTR arg2 = get_op_bstr(ctx, 1); + call_frame_t *frame = ctx->call_ctx; except_frame_t *except; unsigned stack_top; TRACE("\n"); - stack_top = ctx->top; + stack_top = ctx->stack_top; if(!arg2) { HRESULT hres; @@ -766,31 +733,32 @@ return E_OUTOFMEMORY; except->stack_top = stack_top; - except->scope = ctx->scope_chain; + except->scope = frame->scope; except->catch_off = arg1; except->ident = arg2; - except->next = ctx->except_frame; - ctx->except_frame = except; + except->next = frame->except_frame; + frame->except_frame = except; return S_OK; } /* ECMA-262 3rd Edition 12.14 */ -static HRESULT interp_pop_except(exec_ctx_t *ctx) -{ +static HRESULT interp_pop_except(script_ctx_t *ctx) +{ + call_frame_t *frame = ctx->call_ctx; except_frame_t *except; TRACE("\n"); - except = ctx->except_frame; + except = frame->except_frame; assert(except != NULL); - ctx->except_frame = except->next; + frame->except_frame = except->next; heap_free(except); return S_OK; } /* ECMA-262 3rd Edition 12.14 */ -static HRESULT interp_end_finally(exec_ctx_t *ctx) +static HRESULT interp_end_finally(script_ctx_t *ctx) { jsval_t v; @@ -802,7 +770,7 @@ if(!get_bool(v)) { TRACE("passing exception\n"); - ctx->script->ei.val = stack_pop(ctx); + ctx->ei.val = stack_pop(ctx); return DISP_E_EXCEPTION; } @@ -811,16 +779,17 @@ } /* ECMA-262 3rd Edition 13 */ -static HRESULT interp_func(exec_ctx_t *ctx) +static HRESULT interp_func(script_ctx_t *ctx) { unsigned func_idx = get_op_uint(ctx, 0); + call_frame_t *frame = ctx->call_ctx; jsdisp_t *dispex; HRESULT hres; TRACE("%d\n", func_idx); - hres = create_source_function(ctx->script, ctx->code, ctx->func_code->funcs+func_idx, - ctx->scope_chain, &dispex); + hres = create_source_function(ctx, frame->bytecode, frame->function->funcs+func_idx, + frame->scope, &dispex); if(FAILED(hres)) return hres; @@ -828,7 +797,7 @@ } /* ECMA-262 3rd Edition 11.2.1 */ -static HRESULT interp_array(exec_ctx_t *ctx) +static HRESULT interp_array(script_ctx_t *ctx) { jsstr_t *name_str; const WCHAR *name; @@ -847,17 +816,17 @@ return hres; } - hres = to_flat_string(ctx->script, namev, &name_str, &name); + hres = to_flat_string(ctx, namev, &name_str, &name); jsval_release(namev); if(FAILED(hres)) { IDispatch_Release(obj); return hres; } - hres = disp_get_id(ctx->script, obj, name, NULL, 0, &id); + hres = disp_get_id(ctx, obj, name, NULL, 0, &id); jsstr_release(name_str); if(SUCCEEDED(hres)) { - hres = disp_propget(ctx->script, obj, id, &v); + hres = disp_propget(ctx, obj, id, &v); }else if(hres == DISP_E_UNKNOWNNAME) { v = jsval_undefined(); hres = S_OK; @@ -870,7 +839,7 @@ } /* ECMA-262 3rd Edition 11.2.1 */ -static HRESULT interp_member(exec_ctx_t *ctx) +static HRESULT interp_member(script_ctx_t *ctx) { const BSTR arg = get_op_bstr(ctx, 0); IDispatch *obj; @@ -884,9 +853,9 @@ if(FAILED(hres)) return hres; - hres = disp_get_id(ctx->script, obj, arg, arg, 0, &id); + hres = disp_get_id(ctx, obj, arg, arg, 0, &id); if(SUCCEEDED(hres)) { - hres = disp_propget(ctx->script, obj, id, &v); + hres = disp_propget(ctx, obj, id, &v); }else if(hres == DISP_E_UNKNOWNNAME) { v = jsval_undefined(); hres = S_OK; @@ -899,7 +868,7 @@ } /* ECMA-262 3rd Edition 11.2.1 */ -static HRESULT interp_memberid(exec_ctx_t *ctx) +static HRESULT interp_memberid(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); jsval_t objv, namev; @@ -914,10 +883,10 @@ namev = stack_pop(ctx); objv = stack_pop(ctx); - hres = to_object(ctx->script, objv, &obj); + hres = to_object(ctx, objv, &obj); jsval_release(objv); if(SUCCEEDED(hres)) { - hres = to_flat_string(ctx->script, namev, &name_str, &name); + hres = to_flat_string(ctx, namev, &name_str, &name); if(FAILED(hres)) IDispatch_Release(obj); } @@ -925,7 +894,7 @@ if(FAILED(hres)) return hres; - hres = disp_get_id(ctx->script, obj, name, NULL, arg, &id); + hres = disp_get_id(ctx, obj, name, NULL, arg, &id); jsstr_release(name_str); if(FAILED(hres)) { IDispatch_Release(obj); @@ -942,7 +911,7 @@ } /* ECMA-262 3rd Edition 11.2.1 */ -static HRESULT interp_refval(exec_ctx_t *ctx) +static HRESULT interp_refval(script_ctx_t *ctx) { IDispatch *disp; jsval_t v; @@ -953,9 +922,9 @@ disp = stack_topn_objid(ctx, 0, &id); if(!disp) - return throw_reference_error(ctx->script, JS_E_ILLEGAL_ASSIGN, NULL); - - hres = disp_propget(ctx->script, disp, id, &v); + return throw_reference_error(ctx, JS_E_ILLEGAL_ASSIGN, NULL); + + hres = disp_propget(ctx, disp, id, &v); if(FAILED(hres)) return hres; @@ -963,11 +932,11 @@ } /* ECMA-262 3rd Edition 11.2.2 */ -static HRESULT interp_new(exec_ctx_t *ctx) +static HRESULT interp_new(script_ctx_t *ctx) { const unsigned argc = get_op_uint(ctx, 0); - jsval_t r, constr; - HRESULT hres; + call_frame_t *frame = ctx->call_ctx; + jsval_t constr; TRACE("%d\n", argc); @@ -976,79 +945,69 @@ /* NOTE: Should use to_object here */ if(is_null(constr)) - return throw_type_error(ctx->script, JS_E_OBJECT_EXPECTED, NULL); + return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL); else if(!is_object_instance(constr)) - return throw_type_error(ctx->script, JS_E_INVALID_ACTION, NULL); + return throw_type_error(ctx, JS_E_INVALID_ACTION, NULL); else if(!get_object(constr)) - return throw_type_error(ctx->script, JS_E_INVALID_PROPERTY, NULL); - - hres = disp_call_value(ctx->script, get_object(constr), NULL, DISPATCH_CONSTRUCT, argc, stack_args(ctx, argc), &r); - if(FAILED(hres)) - return hres; - - stack_popn(ctx, argc+1); - return stack_push(ctx, r); + return throw_type_error(ctx, JS_E_INVALID_PROPERTY, NULL); + + clear_ret(frame); + return disp_call_value(ctx, get_object(constr), NULL, DISPATCH_CONSTRUCT | DISPATCH_JSCRIPT_CALLEREXECSSOURCE, + argc, stack_args(ctx, argc), &frame->ret); } /* ECMA-262 3rd Edition 11.2.3 */ -static HRESULT interp_call(exec_ctx_t *ctx) +static HRESULT interp_call(script_ctx_t *ctx) { const unsigned argn = get_op_uint(ctx, 0); const int do_ret = get_op_int(ctx, 1); - jsval_t r, obj; - HRESULT hres; + call_frame_t *frame = ctx->call_ctx; + jsval_t obj; TRACE("%d %d\n", argn, do_ret); obj = stack_topn(ctx, argn); if(!is_object_instance(obj)) - return throw_type_error(ctx->script, JS_E_INVALID_PROPERTY, NULL); - - hres = disp_call_value(ctx->script, get_object(obj), NULL, DISPATCH_METHOD, argn, stack_args(ctx, argn), - do_ret ? &r : NULL); - if(FAILED(hres)) - return hres; - - stack_popn(ctx, argn+1); - return do_ret ? stack_push(ctx, r) : S_OK; + return throw_type_error(ctx, JS_E_INVALID_PROPERTY, NULL); + + clear_ret(frame); + return disp_call_value(ctx, get_object(obj), NULL, DISPATCH_METHOD | DISPATCH_JSCRIPT_CALLEREXECSSOURCE, + argn, stack_args(ctx, argn), do_ret ? &frame->ret : NULL); } /* ECMA-262 3rd Edition 11.2.3 */ -static HRESULT interp_call_member(exec_ctx_t *ctx) +static HRESULT interp_call_member(script_ctx_t *ctx) { const unsigned argn = get_op_uint(ctx, 0); const int do_ret = get_op_int(ctx, 1); + call_frame_t *frame = ctx->call_ctx; IDispatch *obj; - jsval_t r; DISPID id; - HRESULT hres; TRACE("%d %d\n", argn, do_ret); obj = stack_topn_objid(ctx, argn, &id); if(!obj) - return throw_type_error(ctx->script, id, NULL); - - hres = disp_call(ctx->script, obj, id, DISPATCH_METHOD, argn, stack_args(ctx, argn), do_ret ? &r : NULL); - if(FAILED(hres)) - return hres; - - stack_popn(ctx, argn+2); - return do_ret ? stack_push(ctx, r) : S_OK; - + return throw_type_error(ctx, id, NULL); + + clear_ret(frame); + return disp_call(ctx, obj, id, DISPATCH_METHOD | DISPATCH_JSCRIPT_CALLEREXECSSOURCE, + argn, stack_args(ctx, argn), do_ret ? &frame->ret : NULL); } /* ECMA-262 3rd Edition 11.1.1 */ -static HRESULT interp_this(exec_ctx_t *ctx) -{ - TRACE("\n"); - - IDispatch_AddRef(ctx->this_obj); - return stack_push(ctx, jsval_disp(ctx->this_obj)); +static HRESULT interp_this(script_ctx_t *ctx) +{ + call_frame_t *frame = ctx->call_ctx; + + TRACE("\n"); + + IDispatch_AddRef(frame->this_obj); + return stack_push(ctx, jsval_disp(frame->this_obj)); } /* ECMA-262 3rd Edition 10.1.4 */ -static HRESULT interp_ident(exec_ctx_t *ctx) +static HRESULT interp_ident(script_ctx_t *ctx) { const BSTR arg = get_op_bstr(ctx, 0); exprval_t exprval; @@ -1057,14 +1016,14 @@ TRACE("%s\n", debugstr_w(arg)); - hres = identifier_eval(ctx->script, arg, &exprval); + hres = identifier_eval(ctx, arg, &exprval); if(FAILED(hres)) return hres; if(exprval.type == EXPRVAL_INVALID) - return throw_type_error(ctx->script, JS_E_UNDEFINED_VARIABLE, arg); - - hres = exprval_to_value(ctx->script, &exprval, &v); + return throw_type_error(ctx, JS_E_UNDEFINED_VARIABLE, arg); + + hres = exprval_to_value(ctx, &exprval, &v); exprval_release(&exprval); if(FAILED(hres)) return hres; @@ -1073,7 +1032,7 @@ } /* ECMA-262 3rd Edition 10.1.4 */ -static HRESULT interp_identid(exec_ctx_t *ctx) +static HRESULT interp_identid(script_ctx_t *ctx) { const BSTR arg = get_op_bstr(ctx, 0); const unsigned flags = get_op_uint(ctx, 1); @@ -1082,18 +1041,18 @@ TRACE("%s %x\n", debugstr_w(arg), flags); - hres = identifier_eval(ctx->script, arg, &exprval); + hres = identifier_eval(ctx, arg, &exprval); if(FAILED(hres)) return hres; if(exprval.type == EXPRVAL_INVALID && (flags & fdexNameEnsure)) { DISPID id; - hres = jsdisp_get_id(ctx->script->global, arg, fdexNameEnsure, &id); + hres = jsdisp_get_id(ctx->global, arg, fdexNameEnsure, &id); if(FAILED(hres)) return hres; - exprval_set_idref(&exprval, to_disp(ctx->script->global), id); + exprval_set_idref(&exprval, to_disp(ctx->global), id); } if(exprval.type != EXPRVAL_IDREF) { @@ -1106,7 +1065,7 @@ } /* ECMA-262 3rd Edition 7.8.1 */ -static HRESULT interp_null(exec_ctx_t *ctx) +static HRESULT interp_null(script_ctx_t *ctx) { TRACE("\n"); @@ -1114,7 +1073,7 @@ } /* ECMA-262 3rd Edition 7.8.2 */ -static HRESULT interp_bool(exec_ctx_t *ctx) +static HRESULT interp_bool(script_ctx_t *ctx) { const int arg = get_op_int(ctx, 0); @@ -1124,7 +1083,7 @@ } /* ECMA-262 3rd Edition 7.8.3 */ -static HRESULT interp_int(exec_ctx_t *ctx) +static HRESULT interp_int(script_ctx_t *ctx) { const int arg = get_op_int(ctx, 0); @@ -1134,7 +1093,7 @@ } /* ECMA-262 3rd Edition 7.8.3 */ -static HRESULT interp_double(exec_ctx_t *ctx) +static HRESULT interp_double(script_ctx_t *ctx) { const double arg = get_op_double(ctx); @@ -1144,7 +1103,7 @@ } /* ECMA-262 3rd Edition 7.8.4 */ -static HRESULT interp_str(exec_ctx_t *ctx) +static HRESULT interp_str(script_ctx_t *ctx) { jsstr_t *str = get_op_str(ctx, 0); @@ -1154,7 +1113,7 @@ } /* ECMA-262 3rd Edition 7.8 */ -static HRESULT interp_regexp(exec_ctx_t *ctx) +static HRESULT interp_regexp(script_ctx_t *ctx) { jsstr_t *source = get_op_str(ctx, 0); const unsigned flags = get_op_uint(ctx, 1); @@ -1163,7 +1122,7 @@ TRACE("%s %x\n", debugstr_jsstr(source), flags); - hres = create_regexp(ctx->script, source, flags, ®exp); + hres = create_regexp(ctx, source, flags, ®exp); if(FAILED(hres)) return hres; @@ -1171,7 +1130,7 @@ } /* ECMA-262 3rd Edition 11.1.4 */ -static HRESULT interp_carray(exec_ctx_t *ctx) +static HRESULT interp_carray(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); jsdisp_t *array; @@ -1181,7 +1140,7 @@ TRACE("%u\n", arg); - hres = create_array(ctx->script, arg, &array); + hres = create_array(ctx, arg, &array); if(FAILED(hres)) return hres; @@ -1200,14 +1159,14 @@ } /* ECMA-262 3rd Edition 11.1.5 */ -static HRESULT interp_new_obj(exec_ctx_t *ctx) +static HRESULT interp_new_obj(script_ctx_t *ctx) { jsdisp_t *obj; HRESULT hres; TRACE("\n"); - hres = create_object(ctx->script, NULL, &obj); + hres = create_object(ctx, NULL, &obj); if(FAILED(hres)) return hres; @@ -1215,7 +1174,7 @@ } /* ECMA-262 3rd Edition 11.1.5 */ -static HRESULT interp_obj_prop(exec_ctx_t *ctx) +static HRESULT interp_obj_prop(script_ctx_t *ctx) { const BSTR name = get_op_bstr(ctx, 0); jsdisp_t *obj; @@ -1235,7 +1194,7 @@ } /* ECMA-262 3rd Edition 11.11 */ -static HRESULT interp_cnd_nz(exec_ctx_t *ctx) +static HRESULT interp_cnd_nz(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); BOOL b; @@ -1248,16 +1207,16 @@ return hres; if(b) { - ctx->ip = arg; + jmp_abs(ctx, arg); }else { stack_popn(ctx, 1); - ctx->ip++; + jmp_next(ctx); } return S_OK; } /* ECMA-262 3rd Edition 11.11 */ -static HRESULT interp_cnd_z(exec_ctx_t *ctx) +static HRESULT interp_cnd_z(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); BOOL b; @@ -1271,15 +1230,15 @@ if(b) { stack_popn(ctx, 1); - ctx->ip++; + jmp_next(ctx); }else { - ctx->ip = arg; + jmp_abs(ctx, arg); } return S_OK; } /* ECMA-262 3rd Edition 11.10 */ -static HRESULT interp_or(exec_ctx_t *ctx) +static HRESULT interp_or(script_ctx_t *ctx) { INT l, r; HRESULT hres; @@ -1298,7 +1257,7 @@ } /* ECMA-262 3rd Edition 11.10 */ -static HRESULT interp_xor(exec_ctx_t *ctx) +static HRESULT interp_xor(script_ctx_t *ctx) { INT l, r; HRESULT hres; @@ -1317,7 +1276,7 @@ } /* ECMA-262 3rd Edition 11.10 */ -static HRESULT interp_and(exec_ctx_t *ctx) +static HRESULT interp_and(script_ctx_t *ctx) { INT l, r; HRESULT hres; @@ -1336,7 +1295,7 @@ } /* ECMA-262 3rd Edition 11.8.6 */ -static HRESULT interp_instanceof(exec_ctx_t *ctx) +static HRESULT interp_instanceof(script_ctx_t *ctx) { jsdisp_t *obj, *iter, *tmp = NULL; jsval_t prot, v; @@ -1348,7 +1307,7 @@ v = stack_pop(ctx); if(!is_object_instance(v) || !get_object(v)) { jsval_release(v); - return throw_type_error(ctx->script, JS_E_FUNCTION_EXPECTED, NULL); + return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL); } obj = iface_to_jsdisp((IUnknown*)get_object(v)); @@ -1361,7 +1320,7 @@ if(is_class(obj, JSCLASS_FUNCTION)) { hres = jsdisp_propget_name(obj, prototypeW, &prot); }else { - hres = throw_type_error(ctx->script, JS_E_FUNCTION_EXPECTED, NULL); + hres = throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL); } jsdisp_release(obj); if(FAILED(hres)) @@ -1394,7 +1353,7 @@ } /* ECMA-262 3rd Edition 11.8.7 */ -static HRESULT interp_in(exec_ctx_t *ctx) +static HRESULT interp_in(script_ctx_t *ctx) { const WCHAR *str; jsstr_t *jsstr; @@ -1408,18 +1367,18 @@ obj = stack_pop(ctx); if(!is_object_instance(obj) || !get_object(obj)) { jsval_release(obj); - return throw_type_error(ctx->script, JS_E_OBJECT_EXPECTED, NULL); + return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL); } v = stack_pop(ctx); - hres = to_flat_string(ctx->script, v, &jsstr, &str); + hres = to_flat_string(ctx, v, &jsstr, &str); jsval_release(v); if(FAILED(hres)) { IDispatch_Release(get_object(obj)); return hres; } - hres = disp_get_id(ctx->script, get_object(obj), str, NULL, 0, &id); + hres = disp_get_id(ctx, get_object(obj), str, NULL, 0, &id); IDispatch_Release(get_object(obj)); jsstr_release(jsstr); if(SUCCEEDED(hres)) @@ -1485,7 +1444,7 @@ } /* ECMA-262 3rd Edition 11.6.1 */ -static HRESULT interp_add(exec_ctx_t *ctx) +static HRESULT interp_add(script_ctx_t *ctx) { jsval_t l, r, ret; HRESULT hres; @@ -1495,7 +1454,7 @@ TRACE("%s + %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = add_eval(ctx->script, l, r, &ret); + hres = add_eval(ctx, l, r, &ret); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -1505,7 +1464,7 @@ } /* ECMA-262 3rd Edition 11.6.2 */ -static HRESULT interp_sub(exec_ctx_t *ctx) +static HRESULT interp_sub(script_ctx_t *ctx) { double l, r; HRESULT hres; @@ -1524,7 +1483,7 @@ } /* ECMA-262 3rd Edition 11.5.1 */ -static HRESULT interp_mul(exec_ctx_t *ctx) +static HRESULT interp_mul(script_ctx_t *ctx) { double l, r; HRESULT hres; @@ -1543,7 +1502,7 @@ } /* ECMA-262 3rd Edition 11.5.2 */ -static HRESULT interp_div(exec_ctx_t *ctx) +static HRESULT interp_div(script_ctx_t *ctx) { double l, r; HRESULT hres; @@ -1562,7 +1521,7 @@ } /* ECMA-262 3rd Edition 11.5.3 */ -static HRESULT interp_mod(exec_ctx_t *ctx) +static HRESULT interp_mod(script_ctx_t *ctx) { double l, r; HRESULT hres; @@ -1581,7 +1540,7 @@ } /* ECMA-262 3rd Edition 11.4.2 */ -static HRESULT interp_delete(exec_ctx_t *ctx) +static HRESULT interp_delete(script_ctx_t *ctx) { jsval_t objv, namev; IDispatch *obj; @@ -1594,21 +1553,21 @@ namev = stack_pop(ctx); objv = stack_pop(ctx); - hres = to_object(ctx->script, objv, &obj); + hres = to_object(ctx, objv, &obj); jsval_release(objv); if(FAILED(hres)) { jsval_release(namev); return hres; } - hres = to_string(ctx->script, namev, &name); + hres = to_string(ctx, namev, &name); jsval_release(namev); if(FAILED(hres)) { IDispatch_Release(obj); return hres; } - hres = disp_delete_name(ctx->script, obj, name, &ret); + hres = disp_delete_name(ctx, obj, name, &ret); IDispatch_Release(obj); jsstr_release(name); if(FAILED(hres)) @@ -1618,7 +1577,7 @@ } /* ECMA-262 3rd Edition 11.4.2 */ -static HRESULT interp_delete_ident(exec_ctx_t *ctx) +static HRESULT interp_delete_ident(script_ctx_t *ctx) { const BSTR arg = get_op_bstr(ctx, 0); exprval_t exprval; @@ -1627,7 +1586,7 @@ TRACE("%s\n", debugstr_w(arg)); - hres = identifier_eval(ctx->script, arg, &exprval); + hres = identifier_eval(ctx, arg, &exprval); if(FAILED(hres)) return hres; @@ -1652,7 +1611,7 @@ } /* ECMA-262 3rd Edition 11.4.2 */ -static HRESULT interp_void(exec_ctx_t *ctx) +static HRESULT interp_void(script_ctx_t *ctx) { TRACE("\n"); @@ -1699,7 +1658,7 @@ } /* ECMA-262 3rd Edition 11.4.3 */ -static HRESULT interp_typeofid(exec_ctx_t *ctx) +static HRESULT interp_typeofid(script_ctx_t *ctx) { const WCHAR *ret; IDispatch *obj; @@ -1713,7 +1672,7 @@ if(!obj) return stack_push(ctx, jsval_string(jsstr_undefined())); - hres = disp_propget(ctx->script, obj, id, &v); + hres = disp_propget(ctx, obj, id, &v); IDispatch_Release(obj); if(FAILED(hres)) return stack_push_string(ctx, unknownW); @@ -1727,7 +1686,7 @@ } /* ECMA-262 3rd Edition 11.4.3 */ -static HRESULT interp_typeofident(exec_ctx_t *ctx) +static HRESULT interp_typeofident(script_ctx_t *ctx) { const BSTR arg = get_op_bstr(ctx, 0); exprval_t exprval; @@ -1737,7 +1696,7 @@ TRACE("%s\n", debugstr_w(arg)); - hres = identifier_eval(ctx->script, arg, &exprval); + hres = identifier_eval(ctx, arg, &exprval); if(FAILED(hres)) return hres; @@ -1747,7 +1706,7 @@ return hres; } - hres = exprval_to_value(ctx->script, &exprval, &v); + hres = exprval_to_value(ctx, &exprval, &v); exprval_release(&exprval); if(FAILED(hres)) return hres; @@ -1761,7 +1720,7 @@ } /* ECMA-262 3rd Edition 11.4.3 */ -static HRESULT interp_typeof(exec_ctx_t *ctx) +static HRESULT interp_typeof(script_ctx_t *ctx) { const WCHAR *ret; jsval_t v; @@ -1779,7 +1738,7 @@ } /* ECMA-262 3rd Edition 11.4.7 */ -static HRESULT interp_minus(exec_ctx_t *ctx) +static HRESULT interp_minus(script_ctx_t *ctx) { double n; HRESULT hres; @@ -1794,7 +1753,7 @@ } /* ECMA-262 3rd Edition 11.4.6 */ -static HRESULT interp_tonum(exec_ctx_t *ctx) +static HRESULT interp_tonum(script_ctx_t *ctx) { jsval_t v; double n; @@ -1803,7 +1762,7 @@ TRACE("\n"); v = stack_pop(ctx); - hres = to_number(ctx->script, v, &n); + hres = to_number(ctx, v, &n); jsval_release(v); if(FAILED(hres)) return hres; @@ -1812,7 +1771,7 @@ } /* ECMA-262 3rd Edition 11.3.1 */ -static HRESULT interp_postinc(exec_ctx_t *ctx) +static HRESULT interp_postinc(script_ctx_t *ctx) { const int arg = get_op_int(ctx, 0); IDispatch *obj; @@ -1824,15 +1783,15 @@ obj = stack_pop_objid(ctx, &id); if(!obj) - return throw_type_error(ctx->script, JS_E_OBJECT_EXPECTED, NULL); - - hres = disp_propget(ctx->script, obj, id, &v); + return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL); + + hres = disp_propget(ctx, obj, id, &v); if(SUCCEEDED(hres)) { double n; - hres = to_number(ctx->script, v, &n); + hres = to_number(ctx, v, &n); if(SUCCEEDED(hres)) - hres = disp_propput(ctx->script, obj, id, jsval_number(n+(double)arg)); + hres = disp_propput(ctx, obj, id, jsval_number(n+(double)arg)); if(FAILED(hres)) jsval_release(v); } @@ -1844,7 +1803,7 @@ } /* ECMA-262 3rd Edition 11.4.4, 11.4.5 */ -static HRESULT interp_preinc(exec_ctx_t *ctx) +static HRESULT interp_preinc(script_ctx_t *ctx) { const int arg = get_op_int(ctx, 0); IDispatch *obj; @@ -1857,17 +1816,17 @@ obj = stack_pop_objid(ctx, &id); if(!obj) - return throw_type_error(ctx->script, JS_E_OBJECT_EXPECTED, NULL); - - hres = disp_propget(ctx->script, obj, id, &v); + return throw_type_error(ctx, JS_E_OBJECT_EXPECTED, NULL); + + hres = disp_propget(ctx, obj, id, &v); if(SUCCEEDED(hres)) { double n; - hres = to_number(ctx->script, v, &n); + hres = to_number(ctx, v, &n); jsval_release(v); if(SUCCEEDED(hres)) { ret = n+(double)arg; - hres = disp_propput(ctx->script, obj, id, jsval_number(ret)); + hres = disp_propput(ctx, obj, id, jsval_number(ret)); } } IDispatch_Release(obj); @@ -1958,7 +1917,7 @@ } /* ECMA-262 3rd Edition 11.9.1 */ -static HRESULT interp_eq(exec_ctx_t *ctx) +static HRESULT interp_eq(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -1969,7 +1928,7 @@ TRACE("%s == %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = equal_values(ctx->script, l, r, &b); + hres = equal_values(ctx, l, r, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -1979,7 +1938,7 @@ } /* ECMA-262 3rd Edition 11.9.2 */ -static HRESULT interp_neq(exec_ctx_t *ctx) +static HRESULT interp_neq(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -1990,7 +1949,7 @@ TRACE("%s != %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = equal_values(ctx->script, l, r, &b); + hres = equal_values(ctx, l, r, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -2000,7 +1959,7 @@ } /* ECMA-262 3rd Edition 11.9.4 */ -static HRESULT interp_eq2(exec_ctx_t *ctx) +static HRESULT interp_eq2(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -2021,7 +1980,7 @@ } /* ECMA-262 3rd Edition 11.9.5 */ -static HRESULT interp_neq2(exec_ctx_t *ctx) +static HRESULT interp_neq2(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -2078,7 +2037,7 @@ } /* ECMA-262 3rd Edition 11.8.1 */ -static HRESULT interp_lt(exec_ctx_t *ctx) +static HRESULT interp_lt(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -2089,7 +2048,7 @@ TRACE("%s < %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = less_eval(ctx->script, l, r, FALSE, &b); + hres = less_eval(ctx, l, r, FALSE, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -2099,7 +2058,7 @@ } /* ECMA-262 3rd Edition 11.8.1 */ -static HRESULT interp_lteq(exec_ctx_t *ctx) +static HRESULT interp_lteq(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -2110,7 +2069,7 @@ TRACE("%s <= %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = less_eval(ctx->script, r, l, TRUE, &b); + hres = less_eval(ctx, r, l, TRUE, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -2120,7 +2079,7 @@ } /* ECMA-262 3rd Edition 11.8.2 */ -static HRESULT interp_gt(exec_ctx_t *ctx) +static HRESULT interp_gt(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -2131,7 +2090,7 @@ TRACE("%s > %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = less_eval(ctx->script, r, l, FALSE, &b); + hres = less_eval(ctx, r, l, FALSE, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -2141,7 +2100,7 @@ } /* ECMA-262 3rd Edition 11.8.4 */ -static HRESULT interp_gteq(exec_ctx_t *ctx) +static HRESULT interp_gteq(script_ctx_t *ctx) { jsval_t l, r; BOOL b; @@ -2152,7 +2111,7 @@ TRACE("%s >= %s\n", debugstr_jsval(l), debugstr_jsval(r)); - hres = less_eval(ctx->script, l, r, TRUE, &b); + hres = less_eval(ctx, l, r, TRUE, &b); jsval_release(l); jsval_release(r); if(FAILED(hres)) @@ -2162,7 +2121,7 @@ } /* ECMA-262 3rd Edition 11.4.8 */ -static HRESULT interp_bneg(exec_ctx_t *ctx) +static HRESULT interp_bneg(script_ctx_t *ctx) { jsval_t v; INT i; @@ -2171,7 +2130,7 @@ TRACE("\n"); v = stack_pop(ctx); - hres = to_int32(ctx->script, v, &i); + hres = to_int32(ctx, v, &i); jsval_release(v); if(FAILED(hres)) return hres; @@ -2180,7 +2139,7 @@ } /* ECMA-262 3rd Edition 11.4.9 */ -static HRESULT interp_neg(exec_ctx_t *ctx) +static HRESULT interp_neg(script_ctx_t *ctx) { jsval_t v; BOOL b; @@ -2198,7 +2157,7 @@ } /* ECMA-262 3rd Edition 11.7.1 */ -static HRESULT interp_lshift(exec_ctx_t *ctx) +static HRESULT interp_lshift(script_ctx_t *ctx) { DWORD r; INT l; @@ -2216,7 +2175,7 @@ } /* ECMA-262 3rd Edition 11.7.2 */ -static HRESULT interp_rshift(exec_ctx_t *ctx) +static HRESULT interp_rshift(script_ctx_t *ctx) { DWORD r; INT l; @@ -2234,7 +2193,7 @@ } /* ECMA-262 3rd Edition 11.7.3 */ -static HRESULT interp_rshift2(exec_ctx_t *ctx) +static HRESULT interp_rshift2(script_ctx_t *ctx) { DWORD r, l; HRESULT hres; @@ -2251,7 +2210,7 @@ } /* ECMA-262 3rd Edition 11.13.1 */ -static HRESULT interp_assign(exec_ctx_t *ctx) +static HRESULT interp_assign(script_ctx_t *ctx) { IDispatch *disp; DISPID id; @@ -2265,10 +2224,10 @@ disp = stack_pop_objid(ctx, &id); if(!disp) { jsval_release(v); - return throw_reference_error(ctx->script, JS_E_ILLEGAL_ASSIGN, NULL); - } - - hres = disp_propput(ctx->script, disp, id, v); + return throw_reference_error(ctx, JS_E_ILLEGAL_ASSIGN, NULL); + } + + hres = disp_propput(ctx, disp, id, v); IDispatch_Release(disp); if(FAILED(hres)) { jsval_release(v); @@ -2279,7 +2238,7 @@ } /* JScript extension */ -static HRESULT interp_assign_call(exec_ctx_t *ctx) +static HRESULT interp_assign_call(script_ctx_t *ctx) { const unsigned argc = get_op_uint(ctx, 0); IDispatch *disp; @@ -2291,9 +2250,9 @@ disp = stack_topn_objid(ctx, argc+1, &id); if(!disp) - return throw_reference_error(ctx->script, JS_E_ILLEGAL_ASSIGN, NULL); - - hres = disp_call(ctx->script, disp, id, DISPATCH_PROPERTYPUT, argc+1, stack_args(ctx, argc+1), NULL); + return throw_reference_error(ctx, JS_E_ILLEGAL_ASSIGN, NULL); + + hres = disp_call(ctx, disp, id, DISPATCH_PROPERTYPUT, argc+1, stack_args(ctx, argc+1), NULL); if(FAILED(hres)) return hres; @@ -2302,24 +2261,24 @@ return stack_push(ctx, v); } -static HRESULT interp_undefined(exec_ctx_t *ctx) +static HRESULT interp_undefined(script_ctx_t *ctx) { TRACE("\n"); return stack_push(ctx, jsval_undefined()); } -static HRESULT interp_jmp(exec_ctx_t *ctx) +static HRESULT interp_jmp(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); TRACE("%u\n", arg); - ctx->ip = arg; + jmp_abs(ctx, arg); return S_OK; } -static HRESULT interp_jmp_z(exec_ctx_t *ctx) +static HRESULT interp_jmp_z(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); BOOL b; @@ -2335,13 +2294,13 @@ return hres; if(b) - ctx->ip++; + jmp_next(ctx); else - ctx->ip = arg; + jmp_abs(ctx, arg); return S_OK; } -static HRESULT interp_pop(exec_ctx_t *ctx) +static HRESULT interp_pop(script_ctx_t *ctx) { const unsigned arg = get_op_uint(ctx, 0); @@ -2351,24 +2310,51 @@ return S_OK; } -static HRESULT interp_ret(exec_ctx_t *ctx) -{ - TRACE("\n"); - - ctx->ip = -1; +static HRESULT interp_ret(script_ctx_t *ctx) +{ + const unsigned clear_ret = get_op_uint(ctx, 0); + call_frame_t *frame = ctx->call_ctx; + + TRACE("\n"); + + if(clear_ret) + jsval_release(steal_ret(frame)); + + if((frame->flags & EXEC_CONSTRUCTOR) && !is_object_instance(frame->ret)) { + jsval_release(frame->ret); + IDispatch_AddRef(frame->this_obj); + frame->ret = jsval_disp(frame->this_obj); + } + + jmp_abs(ctx, -1); return S_OK; } -static HRESULT interp_setret(exec_ctx_t *ctx) -{ - TRACE("\n"); - - jsval_release(ctx->ret); - ctx->ret = stack_pop(ctx); +static HRESULT interp_setret(script_ctx_t *ctx) +{ + call_frame_t *frame = ctx->call_ctx; + + TRACE("\n"); + + jsval_release(frame->ret); + frame->ret = stack_pop(ctx); return S_OK; } -typedef HRESULT (*op_func_t)(exec_ctx_t*); +static HRESULT interp_push_ret(script_ctx_t *ctx) +{ + call_frame_t *frame = ctx->call_ctx; + HRESULT hres; + + TRACE("\n"); + + hres = stack_push(ctx, frame->ret); + if(SUCCEEDED(hres)) + frame->ret = jsval_undefined(); + return hres; +} + +typedef HRESULT (*op_func_t)(script_ctx_t*); static const op_func_t op_funcs[] = { #define X(x,a,b,c) interp_##x, @@ -2382,27 +2368,65 @@ #undef X }; -static HRESULT unwind_exception(exec_ctx_t *ctx) +static void release_call_frame(call_frame_t *frame) +{ + if(frame->arguments_obj) { + /* Reset arguments value to cut the reference cycle. Note that since all activation contexts have + * their own arguments property, it's impossible to use prototype's one during name lookup */ + static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; + jsdisp_propput_name(frame->variable_obj, argumentsW, jsval_undefined()); + jsdisp_release(frame->arguments_obj); + } + if(frame->function_instance) + jsdisp_release(frame->function_instance); + if(frame->variable_obj) + jsdisp_release(frame->variable_obj); + if(frame->this_obj) + IDispatch_Release(frame->this_obj); + if(frame->scope) + scope_release(frame->scope); + jsval_release(frame->ret); + release_bytecode(frame->bytecode); + heap_free(frame); +} + +static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres) { except_frame_t *except_frame; + call_frame_t *frame; jsval_t except_val; BSTR ident; HRESULT hres; - except_frame = ctx->except_frame; - ctx->except_frame = except_frame->next; - - assert(except_frame->stack_top <= ctx->top); - stack_popn(ctx, ctx->top - except_frame->stack_top); - - while(except_frame->scope != ctx->scope_chain) - scope_pop(&ctx->scope_chain); - - ctx->ip = except_frame->catch_off; - - except_val = ctx->script->ei.val; - ctx->script->ei.val = jsval_undefined(); - clear_ei(ctx->script); + for(frame = ctx->call_ctx; !frame->except_frame; frame = ctx->call_ctx) { + DWORD flags; + + while(frame->scope != frame->base_scope) + scope_pop(&frame->scope); + + stack_popn(ctx, ctx->stack_top-frame->stack_base); + + ctx->call_ctx = frame->prev_frame; + flags = frame->flags; + release_call_frame(frame); + if(!(flags & EXEC_RETURN_TO_INTERP)) + return exception_hres; + } + + except_frame = frame->except_frame; + frame->except_frame = except_frame->next; + + assert(except_frame->stack_top <= ctx->stack_top); + stack_popn(ctx, ctx->stack_top - except_frame->stack_top); + + while(except_frame->scope != frame->scope) + scope_pop(&frame->scope); + + frame->ip = except_frame->catch_off; + + except_val = ctx->ei.val; + ctx->ei.val = jsval_undefined(); + clear_ei(ctx); ident = except_frame->ident; heap_free(except_frame); @@ -2410,7 +2434,7 @@ if(ident) { jsdisp_t *scope_obj; - hres = create_dispex(ctx->script, NULL, NULL, &scope_obj); + hres = create_dispex(ctx, NULL, NULL, &scope_obj); if(SUCCEEDED(hres)) { hres = jsdisp_propput_name(scope_obj, ident, except_val); if(FAILED(hres)) @@ -2420,7 +2444,7 @@ if(FAILED(hres)) return hres; - hres = scope_push(ctx->scope_chain, scope_obj, to_disp(scope_obj), &ctx->scope_chain); + hres = scope_push(frame->scope, scope_obj, to_disp(scope_obj), &frame->scope); jsdisp_release(scope_obj); }else { hres = stack_push(ctx, except_val); @@ -2433,65 +2457,45 @@ return hres; } -static HRESULT enter_bytecode(script_ctx_t *ctx, bytecode_t *code, function_code_t *func, jsval_t *ret) -{ - exec_ctx_t *exec_ctx = ctx->exec_ctx; - except_frame_t *prev_except_frame; - function_code_t *prev_func; - unsigned prev_ip, prev_top; - scope_chain_t *prev_scope; - bytecode_t *prev_code; +static HRESULT enter_bytecode(script_ctx_t *ctx, jsval_t *r) +{ + call_frame_t *frame; jsop_t op; HRESULT hres = S_OK; TRACE("\n"); - prev_top = exec_ctx->top; - prev_scope = exec_ctx->scope_chain; - prev_except_frame = exec_ctx->except_frame; - prev_ip = exec_ctx->ip; - prev_code = exec_ctx->code; - prev_func = exec_ctx->func_code; - exec_ctx->ip = func->instr_off; - exec_ctx->except_frame = NULL; - exec_ctx->code = code; - exec_ctx->func_code = func; - - while(exec_ctx->ip != -1) { - op = code->instrs[exec_ctx->ip].op; - hres = op_funcs[op](exec_ctx); + while(1) { + frame = ctx->call_ctx; + op = frame->bytecode->instrs[frame->ip].op; + hres = op_funcs[op](ctx); if(FAILED(hres)) { TRACE("EXCEPTION %08x\n", hres); - if(!exec_ctx->except_frame) - break; - - hres = unwind_exception(exec_ctx); + hres = unwind_exception(ctx, hres); if(FAILED(hres)) + return hres; + }else if(frame->ip == -1) { + const DWORD return_to_interp = frame->flags & EXEC_RETURN_TO_INTERP; + + assert(ctx->stack_top == frame->stack_base); + assert(frame->scope == frame->base_scope); + + ctx->call_ctx = frame->prev_frame; + if(return_to_interp) { + clear_ret(ctx->call_ctx); + ctx->call_ctx->ret = steal_ret(frame); + }else if(r) { + *r = steal_ret(frame); + } + release_call_frame(frame); + if(!return_to_interp) break; }else { - exec_ctx->ip += op_move[op]; + frame->ip += op_move[op]; } } - exec_ctx->ip = prev_ip; - exec_ctx->except_frame = prev_except_frame; - exec_ctx->code = prev_code; - exec_ctx->func_code = prev_func; - - if(FAILED(hres)) { - while(exec_ctx->scope_chain != prev_scope) - scope_pop(&exec_ctx->scope_chain); - stack_popn(exec_ctx, exec_ctx->top-prev_top); - return hres; - } - - assert(exec_ctx->top == prev_top+1 || exec_ctx->top == prev_top); - assert(exec_ctx->scope_chain == prev_scope); - assert(exec_ctx->top == prev_top); - - *ret = exec_ctx->ret; - exec_ctx->ret = jsval_undefined(); return S_OK; } @@ -2532,54 +2536,94 @@ return hres; } -HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, BOOL from_eval, jsval_t *ret) -{ - exec_ctx_t *prev_ctx; - jsval_t val; +HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, function_code_t *function, scope_chain_t *scope, + IDispatch *this_obj, jsdisp_t *function_instance, jsdisp_t *variable_obj, jsdisp_t *arguments_obj, jsval_t *r) +{ + call_frame_t *frame; unsigned i; - HRESULT hres = S_OK; - - for(i = 0; i < func->func_cnt; i++) { + HRESULT hres; + + for(i = 0; i < function->func_cnt; i++) { jsdisp_t *func_obj; - if(!func->funcs[i].name) + if(!function->funcs[i].name) continue; - hres = create_source_function(ctx->script, code, func->funcs+i, ctx->scope_chain, &func_obj); + hres = create_source_function(ctx, bytecode, function->funcs+i, scope, &func_obj); if(FAILED(hres)) return hres; - if(func->funcs[i].event_target) - hres = bind_event_target(ctx->script, func->funcs+i, func_obj); + if(function->funcs[i].event_target) + hres = bind_event_target(ctx, function->funcs+i, func_obj); else - hres = jsdisp_propput_name(ctx->var_disp, func->funcs[i].name, jsval_obj(func_obj)); + hres = jsdisp_propput_name(variable_obj, function->funcs[i].name, jsval_obj(func_obj)); jsdisp_release(func_obj); if(FAILED(hres)) return hres; } - for(i=0; i < func->var_cnt; i++) { - if(!ctx->is_global || !lookup_global_members(ctx->script, func->variables[i], NULL)) { + for(i=0; i < function->var_cnt; i++) { + if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i], NULL)) { DISPID id = 0; - hres = jsdisp_get_id(ctx->var_disp, func->variables[i], fdexNameEnsure, &id); + hres = jsdisp_get_id(variable_obj, function->variables[i], fdexNameEnsure, &id); if(FAILED(hres)) return hres; } } - prev_ctx = ctx->script->exec_ctx; - ctx->script->exec_ctx = ctx; - - hres = enter_bytecode(ctx->script, code, func, &val); - assert(ctx->script->exec_ctx == ctx); - ctx->script->exec_ctx = prev_ctx; - if(FAILED(hres)) - return hres; - - if(ret) - *ret = val; + /* ECMA-262 3rd Edition 11.2.3.7 */ + if(this_obj) { + jsdisp_t *jsthis; + + jsthis = iface_to_jsdisp((IUnknown*)this_obj); + if(jsthis) { + if(jsthis->builtin_info->class == JSCLASS_GLOBAL || jsthis->builtin_info->class == JSCLASS_NONE) + this_obj = NULL; + jsdisp_release(jsthis); + } + } + + frame = heap_alloc_zero(sizeof(*frame)); + if(!frame) + return E_OUTOFMEMORY; + + frame->bytecode = bytecode_addref(bytecode); + frame->function = function; + frame->ip = function->instr_off; + frame->stack_base = ctx->stack_top; + frame->ret = jsval_undefined(); + if(scope) + frame->base_scope = frame->scope = scope_addref(scope); + + if(this_obj) + frame->this_obj = this_obj; + else if(ctx->host_global) + frame->this_obj = ctx->host_global; else - jsval_release(val); - return S_OK; -} + frame->this_obj = to_disp(ctx->global); + IDispatch_AddRef(frame->this_obj); + + if(function_instance) + frame->function_instance = jsdisp_addref(function_instance); + if(arguments_obj) + frame->arguments_obj = jsdisp_addref(arguments_obj); + + frame->flags = flags; + frame->variable_obj = jsdisp_addref(variable_obj); + + frame->prev_frame = ctx->call_ctx; + ctx->call_ctx = frame; + + if(flags & EXEC_RETURN_TO_INTERP) { + /* + * We're called directly from interpreter, so we may just setup call frame and return. + * Already running interpreter will take care of execution. + */ + if(r) + *r = jsval_undefined(); + return S_OK; + } + + return enter_bytecode(ctx, r); +} Modified: trunk/reactos/dll/win32/jscript/engine.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/engine.h…
============================================================================== --- trunk/reactos/dll/win32/jscript/engine.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/engine.h [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -72,6 +72,7 @@ X(postinc, 1, ARG_INT, 0) \ X(preinc, 1, ARG_INT, 0) \ X(push_except,1, ARG_ADDR, ARG_BSTR) \ + X(push_ret, 1, 0,0) \ X(push_scope, 1, 0,0) \ X(regexp, 1, ARG_STR, ARG_UINT) \ X(rshift, 1, 0,0) \ @@ -169,9 +170,10 @@ HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,const WCHAR*,BOOL,BOOL,bytecode_t**) DECLSPEC_HIDDEN; void release_bytecode(bytecode_t*) DECLSPEC_HIDDEN; -static inline void bytecode_addref(bytecode_t *code) +static inline bytecode_t *bytecode_addref(bytecode_t *code) { code->ref++; + return code; } typedef struct _scope_chain_t { @@ -184,41 +186,41 @@ HRESULT scope_push(scope_chain_t*,jsdisp_t*,IDispatch*,scope_chain_t**) DECLSPEC_HIDDEN; void scope_release(scope_chain_t*) DECLSPEC_HIDDEN; -static inline void scope_addref(scope_chain_t *scope) +static inline scope_chain_t *scope_addref(scope_chain_t *scope) { scope->ref++; + return scope; } typedef struct _except_frame_t except_frame_t; struct _parser_ctx_t; -struct _exec_ctx_t { - LONG ref; - - struct _parser_ctx_t *parser; - bytecode_t *code; - script_ctx_t *script; - scope_chain_t *scope_chain; - jsdisp_t *var_disp; +typedef struct _call_frame_t { + unsigned ip; + except_frame_t *except_frame; + unsigned stack_base; + scope_chain_t *scope; + scope_chain_t *base_scope; + + jsval_t ret; + IDispatch *this_obj; - function_code_t *func_code; - BOOL is_global; - - jsval_t *stack; - unsigned stack_size; - unsigned top; - except_frame_t *except_frame; - jsval_t ret; - - unsigned ip; -}; - -static inline void exec_addref(exec_ctx_t *ctx) -{ - ctx->ref++; -} - -void exec_release(exec_ctx_t*) DECLSPEC_HIDDEN; -HRESULT create_exec_ctx(script_ctx_t*,IDispatch*,jsdisp_t*,scope_chain_t*,BOOL,exec_ctx_t**) DECLSPEC_HIDDEN; -HRESULT exec_source(exec_ctx_t*,bytecode_t*,function_code_t*,BOOL,jsval_t*) DECLSPEC_HIDDEN; + jsdisp_t *function_instance; + jsdisp_t *variable_obj; + jsdisp_t *arguments_obj; + DWORD flags; + + bytecode_t *bytecode; + function_code_t *function; + + struct _call_frame_t *prev_frame; +} call_frame_t; + +#define EXEC_GLOBAL 0x0001 +#define EXEC_CONSTRUCTOR 0x0002 +#define EXEC_RETURN_TO_INTERP 0x0004 + +HRESULT exec_source(script_ctx_t*,DWORD,bytecode_t*,function_code_t*,scope_chain_t*,IDispatch*, + jsdisp_t*,jsdisp_t*,jsdisp_t*,jsval_t*) DECLSPEC_HIDDEN; + HRESULT create_source_function(script_ctx_t*,bytecode_t*,function_code_t*,scope_chain_t*,jsdisp_t**) DECLSPEC_HIDDEN; Modified: trunk/reactos/dll/win32/jscript/function.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/function…
============================================================================== --- trunk/reactos/dll/win32/jscript/function.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/function.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -27,7 +27,6 @@ bytecode_t *code; function_code_t *func_code; DWORD length; - jsdisp_t *arguments; } FunctionInstance; typedef struct { @@ -196,10 +195,9 @@ } static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned argc, jsval_t *argv, - jsval_t *r) + BOOL is_constructor, BOOL caller_execs_source, jsval_t *r) { jsdisp_t *var_disp, *arg_disp; - exec_ctx_t *exec_ctx; scope_chain_t *scope; HRESULT hres; @@ -232,55 +230,21 @@ hres = scope_push(function->scope_chain, var_disp, to_disp(var_disp), &scope); if(SUCCEEDED(hres)) { - hres = create_exec_ctx(ctx, this_obj, var_disp, scope, FALSE, &exec_ctx); + DWORD exec_flags = 0; + + if(caller_execs_source) + exec_flags |= EXEC_RETURN_TO_INTERP; + if(is_constructor) + exec_flags |= EXEC_CONSTRUCTOR; + hres = exec_source(ctx, exec_flags, function->code, function->func_code, scope, this_obj, + &function->dispex, var_disp, arg_disp, r); + scope_release(scope); - - if(SUCCEEDED(hres)) { - jsdisp_t *prev_args; - - prev_args = function->arguments; - function->arguments = arg_disp; - hres = exec_source(exec_ctx, function->code, function->func_code, FALSE, r); - function->arguments = prev_args; - - exec_release(exec_ctx); - } - } - - /* Reset arguments value to cut the reference cycle. Note that since all activation contexts have - * their own arguments property, it's impossible to use prototype's one during name lookup */ - jsdisp_propput_name(var_disp, argumentsW, jsval_undefined()); + } jsdisp_release(arg_disp); jsdisp_release(var_disp); return hres; -} - -static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, unsigned argc, jsval_t *argv, - jsval_t *r) -{ - jsdisp_t *this_obj; - jsval_t var; - HRESULT hres; - - hres = create_object(ctx, &function->dispex, &this_obj); - if(FAILED(hres)) - return hres; - - hres = invoke_source(ctx, function, to_disp(this_obj), argc, argv, &var); - if(FAILED(hres)) { - jsdisp_release(this_obj); - return hres; - } - - if(is_object_instance(var)) { - jsdisp_release(this_obj); - *r = var; - }else { - jsval_release(var); - *r = jsval_obj(this_obj); - } - return S_OK; } static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, @@ -303,12 +267,12 @@ } static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, - unsigned argc, jsval_t *argv, jsval_t *r) + unsigned argc, jsval_t *argv, BOOL caller_execs_source, jsval_t *r) { if(function->value_proc) return invoke_value_proc(ctx, function, this_obj, DISPATCH_METHOD, argc, argv, r); - return invoke_source(ctx, function, this_obj, argc, argv, r); + return invoke_source(ctx, function, this_obj, argc, argv, FALSE, caller_execs_source, r); } static HRESULT function_to_string(FunctionInstance *function, jsstr_t **ret) @@ -343,6 +307,7 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { + const BOOL caller_execs_source = (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0; FunctionInstance *function; TRACE("func %p this %p\n", func_this, jsthis); @@ -350,14 +315,25 @@ assert(is_class(func_this, JSCLASS_FUNCTION)); function = (FunctionInstance*)func_this; + flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; if(function->value_proc) return invoke_value_proc(function->dispex.ctx, function, jsthis, flags, argc, argv, r); - if(flags == DISPATCH_CONSTRUCT) - return invoke_constructor(function->dispex.ctx, function, argc, argv, r); + if(flags == DISPATCH_CONSTRUCT) { + jsdisp_t *this_obj; + HRESULT hres; + + hres = create_object(function->dispex.ctx, &function->dispex, &this_obj); + if(FAILED(hres)) + return hres; + + hres = invoke_source(function->dispex.ctx, function, to_disp(this_obj), argc, argv, TRUE, caller_execs_source, r); + jsdisp_release(this_obj); + return hres; + } assert(flags == DISPATCH_METHOD); - return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, r); + return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, FALSE, caller_execs_source, r); } static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) @@ -476,7 +452,7 @@ } if(SUCCEEDED(hres)) - hres = call_function(ctx, function, this_obj, cnt, args, r); + hres = call_function(ctx, function, this_obj, cnt, args, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); if(this_obj) IDispatch_Release(this_obj); @@ -509,7 +485,7 @@ cnt = argc-1; } - hres = call_function(ctx, function, this_obj, cnt, argv+1, r); + hres = call_function(ctx, function, this_obj, cnt, argv+1, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); if(this_obj) IDispatch_Release(this_obj); @@ -552,10 +528,18 @@ static HRESULT Function_get_arguments(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { FunctionInstance *function = function_from_jsdisp(jsthis); + call_frame_t *frame; TRACE("\n"); - *r = function->arguments ? jsval_obj(jsdisp_addref(function->arguments)) : jsval_null(); + for(frame = ctx->call_ctx; frame; frame = frame->prev_frame) { + if(frame->function_instance == &function->dispex) { + *r = jsval_obj(jsdisp_addref(frame->arguments_obj)); + return S_OK; + } + } + + *r = jsval_null(); return S_OK; } Modified: trunk/reactos/dll/win32/jscript/global.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/global.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/global.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/global.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -175,9 +175,11 @@ } /* ECMA-262 3rd Edition 15.1.2.1 */ -static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, - jsval_t *r) -{ +HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + call_frame_t *frame; + DWORD exec_flags = 0; bytecode_t *code; const WCHAR *src; HRESULT hres; @@ -196,7 +198,7 @@ return S_OK; } - if(!ctx->exec_ctx) { + if(!(frame = ctx->call_ctx)) { FIXME("No active exec_ctx\n"); return E_UNEXPECTED; } @@ -212,7 +214,12 @@ return throw_syntax_error(ctx, hres, NULL); } - hres = exec_source(ctx->exec_ctx, code, &code->global_code, TRUE, r); + if(frame->flags & EXEC_GLOBAL) + exec_flags |= EXEC_GLOBAL; + if(flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) + exec_flags |= EXEC_RETURN_TO_INTERP; + hres = exec_source(ctx, exec_flags, code, &code->global_code, frame->scope, + frame->this_obj, NULL, frame->variable_obj, NULL, r); release_bytecode(code); return hres; } Modified: trunk/reactos/dll/win32/jscript/jscript.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jscript.…
============================================================================== --- trunk/reactos/dll/win32/jscript/jscript.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jscript.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -66,6 +66,8 @@ heap_pool_free(&ctx->tmp_heap); if(ctx->last_match) jsstr_release(ctx->last_match); + assert(!ctx->stack_top); + heap_free(ctx->stack); ctx->jscaller->ctx = NULL; IServiceProvider_Release(&ctx->jscaller->IServiceProvider_iface); @@ -92,18 +94,12 @@ static HRESULT exec_global_code(JScript *This, bytecode_t *code) { - exec_ctx_t *exec_ctx; HRESULT hres; - hres = create_exec_ctx(This->ctx, NULL, This->ctx->global, NULL, TRUE, &exec_ctx); - if(FAILED(hres)) - return hres; - IActiveScriptSite_OnEnterScript(This->site); clear_ei(This->ctx); - hres = exec_source(exec_ctx, code, &code->global_code, FALSE, NULL); - exec_release(exec_ctx); + hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, NULL, NULL); IActiveScriptSite_OnLeaveScript(This->site); return hres; @@ -764,26 +760,19 @@ return hres; if(dwFlags & SCRIPTTEXT_ISEXPRESSION) { - exec_ctx_t *exec_ctx; - - hres = create_exec_ctx(This->ctx, NULL, This->ctx->global, NULL, TRUE, &exec_ctx); + jsval_t r; + + IActiveScriptSite_OnEnterScript(This->site); + + clear_ei(This->ctx); + hres = exec_source(This->ctx, EXEC_GLOBAL, code, &code->global_code, NULL, NULL, NULL, This->ctx->global, NULL, &r); if(SUCCEEDED(hres)) { - jsval_t r; - - IActiveScriptSite_OnEnterScript(This->site); - - clear_ei(This->ctx); - hres = exec_source(exec_ctx, code, &code->global_code, TRUE, &r); - if(SUCCEEDED(hres)) { - if(pvarResult) - hres = jsval_to_variant(r, pvarResult); - jsval_release(r); - } - exec_release(exec_ctx); - - IActiveScriptSite_OnLeaveScript(This->site); + if(pvarResult) + hres = jsval_to_variant(r, pvarResult); + jsval_release(r); } + IActiveScriptSite_OnLeaveScript(This->site); return hres; } Modified: trunk/reactos/dll/win32/jscript/jscript.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jscript.…
============================================================================== --- trunk/reactos/dll/win32/jscript/jscript.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jscript.h [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -50,7 +50,6 @@ typedef struct _jsval_t jsval_t; typedef struct _jsstr_t jsstr_t; typedef struct _script_ctx_t script_ctx_t; -typedef struct _exec_ctx_t exec_ctx_t; typedef struct _dispex_prop_t dispex_prop_t; typedef struct { @@ -115,6 +114,14 @@ #define PROPF_CONSTR 0x0400 #define PROPF_CONST 0x0800 #define PROPF_DONTDELETE 0x1000 + +/* + * This is our internal dispatch flag informing calee that it's called directly from interpreter. + * If calee is executed as interpreted function, we may let already running interpreter to take + * of execution. + */ +#define DISPATCH_JSCRIPT_CALLEREXECSSOURCE 0x8000 +#define DISPATCH_JSCRIPT_INTERNAL_MASK DISPATCH_JSCRIPT_CALLEREXECSSOURCE /* NOTE: Keep in sync with names in Object.toString implementation */ typedef enum { @@ -399,7 +406,7 @@ SCRIPTSTATE state; IActiveScript *active_script; - exec_ctx_t *exec_ctx; + struct _call_frame_t *call_ctx; named_item_t *named_items; IActiveScriptSite *site; IInternetHostSecurityManager *secmgr; @@ -413,6 +420,10 @@ heap_pool_t tmp_heap; IDispatch *host_global; + + jsval_t *stack; + unsigned stack_size; + unsigned stack_top; jsstr_t *last_match; match_result_t match_parens[9]; @@ -477,6 +488,8 @@ BOOL bool_obj_value(jsdisp_t*) DECLSPEC_HIDDEN; unsigned array_get_length(jsdisp_t*) DECLSPEC_HIDDEN; + +HRESULT JSGlobal_eval(script_ctx_t*,vdisp_t*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; static inline BOOL is_class(jsdisp_t *jsdisp, jsclass_t class) { Modified: trunk/reactos/dll/win32/jscript/jsregexp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/jsregexp…
============================================================================== --- trunk/reactos/dll/win32/jscript/jsregexp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/jsregexp.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -257,32 +257,38 @@ static HRESULT RegExp_get_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { + TRACE("\n"); + + *r = jsval_bool(!!(regexp_from_jsdisp(jsthis)->jsregexp->flags & REG_GLOB)); + return S_OK; +} + +static HRESULT RegExp_set_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value) +{ FIXME("\n"); return E_NOTIMPL; } -static HRESULT RegExp_set_global(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value) +static HRESULT RegExp_get_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) +{ + TRACE("\n"); + + *r = jsval_bool(!!(regexp_from_jsdisp(jsthis)->jsregexp->flags & REG_FOLD)); + return S_OK; +} + +static HRESULT RegExp_set_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value) { FIXME("\n"); return E_NOTIMPL; } -static HRESULT RegExp_get_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT RegExp_set_ignoreCase(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value) -{ - FIXME("\n"); - return E_NOTIMPL; -} - static HRESULT RegExp_get_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + + *r = jsval_bool(!!(regexp_from_jsdisp(jsthis)->jsregexp->flags & REG_MULTILINE)); + return S_OK; } static HRESULT RegExp_set_multiline(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t value) Modified: trunk/reactos/dll/win32/jscript/lex.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/lex.c?re…
============================================================================== --- trunk/reactos/dll/win32/jscript/lex.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/lex.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -589,7 +589,7 @@ return '}'; case '.': - if(++ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) { + if(ctx->ptr+1 < ctx->end && isdigitW(ctx->ptr[1])) { double n; HRESULT hres; hres = parse_decimal(&ctx->ptr, ctx->end, &n); @@ -600,6 +600,7 @@ *(literal_t**)lval = new_double_literal(ctx, n); return tNumericLiteral; } + ctx->ptr++; return '.'; case '<': Modified: trunk/reactos/dll/win32/jscript/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/jscript/string.c…
============================================================================== --- trunk/reactos/dll/win32/jscript/string.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/jscript/string.c [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -17,8 +17,6 @@ */ #include "jscript.h" - -#define UINT32_MAX 0xffffffff typedef struct { jsdisp_t dispex; Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 5 19:25:30 2016 @@ -85,7 +85,7 @@ reactos/dll/win32/iphlpapi # Out of sync reactos/dll/win32/itircl # Synced to WineStaging-1.9.4 reactos/dll/win32/itss # Synced to WineStaging-1.9.4 -reactos/dll/win32/jscript # Synced to WineStaging-1.9.4 +reactos/dll/win32/jscript # Synced to WineStaging-1.9.11 reactos/dll/win32/jsproxy # Synced to WineStaging-1.9.4 reactos/dll/win32/loadperf # Synced to WineStaging-1.9.4 reactos/dll/win32/localspl # Synced to WineStaging-1.9.4
8 years, 5 months
1
0
0
0
[akhaldi] 71556: [INETCOMM_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:24:01 2016 New Revision: 71556 URL:
http://svn.reactos.org/svn/reactos?rev=71556&view=rev
Log: [INETCOMM_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/rostests/winetests/inetcomm/mimeole.c Modified: trunk/rostests/winetests/inetcomm/mimeole.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/inetcomm/mimeol…
============================================================================== --- trunk/rostests/winetests/inetcomm/mimeole.c [iso-8859-1] (original) +++ trunk/rostests/winetests/inetcomm/mimeole.c [iso-8859-1] Sun Jun 5 19:24:01 2016 @@ -332,6 +332,158 @@ IStream_Release(stream); } +static void test_MessageSetProp(void) +{ + static const char topic[] = "wine topic"; + HRESULT hr; + IMimeMessage *msg; + IMimeBody *body; + PROPVARIANT prop; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + PropVariantInit(&prop); + + hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeBody_SetProp(body, NULL, 0, &prop); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hr = IMimeBody_SetProp(body, "Thread-Topic", 0, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1); + strcpy(prop.u.pszVal, topic); + hr = IMimeBody_SetProp(body, "Thread-Topic", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeBody_GetProp(body, NULL, 0, &prop); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Thread-Topic", 0, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Wine-Topic", 0, &prop); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Thread-Topic", 0, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + if(hr == S_OK) + { + ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt); + ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal); + PropVariantClear(&prop); + } + + IMimeBody_Release(body); + IMimeMessage_Release(msg); +} + +static void test_MessageOptions(void) +{ + static const char string[] = "XXXXX"; + static const char zero[] = "0"; + HRESULT hr; + IMimeMessage *msg; + PROPVARIANT prop; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + PropVariantInit(&prop); + + prop.vt = VT_BOOL; + prop.u.boolVal = TRUE; + hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + todo_wine ok(hr == S_OK, "ret %08x\n", hr); + todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt); + todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal); + PropVariantClear(&prop); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(string)+1); + strcpy(prop.u.pszVal, string); + hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + todo_wine ok(hr == S_OK, "ret %08x\n", hr); + todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt); + todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal); + PropVariantClear(&prop); + + /* Invalid property type doesn't change the value */ + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(zero)+1); + strcpy(prop.u.pszVal, zero); + hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + todo_wine ok(hr == S_OK, "ret %08x\n", hr); + todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt); + todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal); + PropVariantClear(&prop); + + /* Invalid OID */ + prop.vt = VT_BOOL; + prop.u.boolVal = TRUE; + hr = IMimeMessage_SetOption(msg, 0xff00000a, &prop); + ok(hr == MIME_E_INVALID_OPTION_ID, "ret %08x\n", hr); + PropVariantClear(&prop); + + /* Out of range before type. */ + prop.vt = VT_I4; + prop.u.lVal = 1; + hr = IMimeMessage_SetOption(msg, 0xff00000a, &prop); + ok(hr == MIME_E_INVALID_OPTION_ID, "ret %08x\n", hr); + PropVariantClear(&prop); + + IMimeMessage_Release(msg); +} + +static void test_BindToObject(void) +{ + HRESULT hr; + IMimeMessage *msg; + IMimeBody *body; + ULONG count; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeMessage_CountBodies(msg, HBODY_ROOT, TRUE, &count); + ok(hr == S_OK, "ret %08x\n", hr); + ok(count == 1, "got %d\n", count); + + hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body); + ok(hr == S_OK, "ret %08x\n", hr); + IMimeBody_Release(body); + + IMimeMessage_Release(msg); +} + +static void test_MimeOleGetPropertySchema(void) +{ + HRESULT hr; + IMimePropertySchema *schema = NULL; + + hr = MimeOleGetPropertySchema(&schema); + ok(hr == S_OK, "ret %08x\n", hr); + + IMimePropertySchema_Release(schema); +} + START_TEST(mimeole) { OleInitialize(NULL); @@ -340,5 +492,9 @@ test_CreateBody(); test_Allocator(); test_CreateMessage(); + test_MessageSetProp(); + test_MessageOptions(); + test_BindToObject(); + test_MimeOleGetPropertySchema(); OleUninitialize(); }
8 years, 5 months
1
0
0
0
[akhaldi] 71555: [INETCOMM] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:23:27 2016 New Revision: 71555 URL:
http://svn.reactos.org/svn/reactos?rev=71555&view=rev
Log: [INETCOMM] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/win32/inetcomm/inetcomm.spec trunk/reactos/dll/win32/inetcomm/mimeole.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/inetcomm/inetcomm.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/inetcom…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/inetcomm.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/inetcomm.spec [iso-8859-1] Sun Jun 5 19:23:27 2016 @@ -42,7 +42,7 @@ @ stub MimeEditGetBackgroundImageUrl @ stub MimeEditIsSafeToRun @ stub MimeEditViewSource -@ stub MimeGetAddressFormatW +@ stdcall MimeGetAddressFormatW(ptr ptr long long ptr) @ stub MimeOleAlgNameFromSMimeCap @ stub MimeOleAlgStrengthFromSMimeCap @ stub MimeOleClearDirtyTree @@ -79,7 +79,7 @@ @ stdcall MimeOleGetInternat(ptr) @ stub MimeOleGetPropA @ stub MimeOleGetPropW -@ stub MimeOleGetPropertySchema +@ stdcall MimeOleGetPropertySchema(ptr) @ stub MimeOleGetRelatedSection @ stub MimeOleInetDateToFileTime @ stub MimeOleObjectFromMoniker Modified: trunk/reactos/dll/win32/inetcomm/mimeole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/mimeole…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/mimeole.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/mimeole.c [iso-8859-1] Sun Jun 5 19:23:27 2016 @@ -97,6 +97,17 @@ return CONTAINING_RECORD(iface, MimeBody, IMimeBody_iface); } +typedef struct propschema +{ + IMimePropertySchema IMimePropertySchema_iface; + LONG ref; +} propschema; + +static inline propschema *impl_from_IMimePropertySchema(IMimePropertySchema *iface) +{ + return CONTAINING_RECORD(iface, propschema, IMimePropertySchema_iface); +} + static LPSTR strdupA(LPCSTR str) { char *ret; @@ -185,7 +196,7 @@ for(prop = default_props; prop->name; prop++) { - if(!strcasecmp(*ptr, prop->name)) + if(!lstrcmpiA(*ptr, prop->name)) { TRACE("%s: found match with default property id %d\n", *ptr, prop->id); break; @@ -197,7 +208,7 @@ property_list_entry_t *prop_entry; LIST_FOR_EACH_ENTRY(prop_entry, &body->new_props, property_list_entry_t, entry) { - if(!strcasecmp(*ptr, prop_entry->prop.name)) + if(!lstrcmpiA(*ptr, prop_entry->prop.name)) { TRACE("%s: found match with already added new property id %d\n", *ptr, prop_entry->prop.id); prop = &prop_entry->prop; @@ -467,7 +478,7 @@ LIST_FOR_EACH_ENTRY(header, &body->headers, header_t, entry) { - if(!strcasecmp(name, header->prop->name)) + if(!lstrcmpiA(name, header->prop->name)) { *prop = header; return S_OK; @@ -541,7 +552,8 @@ IMimeBody* iface, CLSID* pClassID) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p) stub\n", This, pClassID); return E_NOTIMPL; } @@ -549,20 +561,22 @@ static HRESULT WINAPI MimeBody_IsDirty( IMimeBody* iface) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->() stub\n", This); return E_NOTIMPL; } static HRESULT WINAPI MimeBody_Load(IMimeBody *iface, IStream *pStm) { MimeBody *This = impl_from_IMimeBody(iface); - TRACE("(%p)->(%p)\n", iface, pStm); + TRACE("(%p)->(%p)\n", This, pStm); return parse_headers(This, pStm); } static HRESULT WINAPI MimeBody_Save(IMimeBody *iface, IStream *pStm, BOOL fClearDirty) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p, %d)\n", This, pStm, fClearDirty); return E_NOTIMPL; } @@ -570,14 +584,16 @@ IMimeBody* iface, ULARGE_INTEGER* pcbSize) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p) stub\n", This, pcbSize); return E_NOTIMPL; } static HRESULT WINAPI MimeBody_InitNew( IMimeBody* iface) { - TRACE("%p->()\n", iface); + MimeBody *This = impl_from_IMimeBody(iface); + TRACE("(%p)->()\n", This); return S_OK; } @@ -586,7 +602,8 @@ LPCSTR pszName, LPMIMEPROPINFO pInfo) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%s, %p) stub\n", This, debugstr_a(pszName), pInfo); return E_NOTIMPL; } @@ -595,7 +612,8 @@ LPCSTR pszName, LPCMIMEPROPINFO pInfo) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%s, %p) stub\n", This, debugstr_a(pszName), pInfo); return E_NOTIMPL; } @@ -606,9 +624,15 @@ LPPROPVARIANT pValue) { MimeBody *This = impl_from_IMimeBody(iface); - TRACE("(%p)->(%s, %d, %p)\n", This, pszName, dwFlags, pValue); - - if(!strcasecmp(pszName, "att:pri-content-type")) + header_t *header; + HRESULT hr; + + TRACE("(%p)->(%s, 0x%x, %p)\n", This, debugstr_a(pszName), dwFlags, pValue); + + if(!pszName || !pValue) + return E_INVALIDARG; + + if(!lstrcmpiA(pszName, "att:pri-content-type")) { PropVariantClear(pValue); pValue->vt = VT_LPSTR; @@ -616,8 +640,13 @@ return S_OK; } - FIXME("stub!\n"); - return E_FAIL; + hr = find_prop(This, pszName, &header); + if(hr == S_OK) + { + PropVariantCopy(pValue, &header->value); + } + + return hr; } static HRESULT WINAPI MimeBody_SetProp( @@ -626,8 +655,61 @@ DWORD dwFlags, LPCPROPVARIANT pValue) { - FIXME("stub\n"); - return E_NOTIMPL; + MimeBody *This = impl_from_IMimeBody(iface); + header_t *header; + HRESULT hr; + + TRACE("(%p)->(%s, 0x%x, %p)\n", This, debugstr_a(pszName), dwFlags, pValue); + + if(!pszName || !pValue) + return E_INVALIDARG; + + hr = find_prop(This, pszName, &header); + if(hr != S_OK) + { + property_list_entry_t *prop_entry; + const property_t *prop = NULL; + + LIST_FOR_EACH_ENTRY(prop_entry, &This->new_props, property_list_entry_t, entry) + { + if(!lstrcmpiA(pszName, prop_entry->prop.name)) + { + TRACE("Found match with already added new property id %d\n", prop_entry->prop.id); + prop = &prop_entry->prop; + break; + } + } + + header = HeapAlloc(GetProcessHeap(), 0, sizeof(*header)); + if(!header) + return E_OUTOFMEMORY; + + if(!prop) + { + prop_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*prop_entry)); + if(!prop_entry) + { + HeapFree(GetProcessHeap(), 0, header); + return E_OUTOFMEMORY; + } + prop_entry->prop.name = strdupA(pszName); + prop_entry->prop.id = This->next_prop_id++; + prop_entry->prop.flags = 0; + prop_entry->prop.default_vt = pValue->vt; + list_add_tail(&This->new_props, &prop_entry->entry); + prop = &prop_entry->prop; + TRACE("Allocating new prop id %d\n", prop_entry->prop.id); + } + + header->prop = prop; + PropVariantInit(&header->value); + list_init(&header->params); + list_add_tail(&This->headers, &header->entry); + } + + PropVariantCopy(&header->value, pValue); + + return S_OK; } static HRESULT WINAPI MimeBody_AppendProp( @@ -636,7 +718,8 @@ DWORD dwFlags, LPPROPVARIANT pValue) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%s, 0x%x, %p) stub\n", This, debugstr_a(pszName), dwFlags, pValue); return E_NOTIMPL; } @@ -644,7 +727,8 @@ IMimeBody* iface, LPCSTR pszName) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%s) stub\n", This, debugstr_a(pszName)); return E_NOTIMPL; } @@ -654,7 +738,8 @@ LPCSTR* prgszName, IMimePropertySet* pPropertySet) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%d, %p, %p) stub\n", This, cNames, prgszName, pPropertySet); return E_NOTIMPL; } @@ -664,7 +749,8 @@ LPCSTR* prgszName, IMimePropertySet* pPropertySet) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%d, %p, %p) stub\n", This, cNames, prgszName, pPropertySet); return E_NOTIMPL; } @@ -673,7 +759,8 @@ ULONG cNames, LPCSTR* prgszName) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%d, %p) stub\n", This, cNames, prgszName); return E_NOTIMPL; } @@ -684,7 +771,8 @@ boolean fSubString, boolean fCaseSensitive) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%s, %s, %d, %d) stub\n", This, debugstr_a(pszName), debugstr_a(pszCriteria), fSubString, fCaseSensitive); return E_NOTIMPL; } @@ -692,7 +780,8 @@ IMimeBody* iface, LPHCHARSET phCharset) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p) stub\n", This, phCharset); *phCharset = NULL; return S_OK; } @@ -702,7 +791,8 @@ HCHARSET hCharset, CSETAPPLYTYPE applytype) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p, %d) stub\n", This, hCharset, applytype); return E_NOTIMPL; } @@ -763,14 +853,14 @@ { const char *pri = This->content_pri_type; if(!pri) pri = "text"; - if(strcasecmp(pri, pszPriType)) return S_FALSE; + if(lstrcmpiA(pri, pszPriType)) return S_FALSE; } if(pszSubType) { const char *sub = This->content_sub_type; if(!sub) sub = "plain"; - if(strcasecmp(sub, pszSubType)) return S_FALSE; + if(lstrcmpiA(sub, pszSubType)) return S_FALSE; } return S_OK; @@ -781,7 +871,8 @@ REFIID riid, void** ppvObject) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%s, %p) stub\n", This, debugstr_guid(riid), ppvObject); return E_NOTIMPL; } @@ -789,7 +880,8 @@ IMimeBody* iface, IMimePropertySet** ppPropertySet) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p) stub\n", This, ppPropertySet); return E_NOTIMPL; } @@ -798,8 +890,9 @@ const TYPEDID oid, LPCPROPVARIANT pValue) { + MimeBody *This = impl_from_IMimeBody(iface); HRESULT hr = E_NOTIMPL; - TRACE("(%p)->(%08x, %p)\n", iface, oid, pValue); + TRACE("(%p)->(%08x, %p)\n", This, oid, pValue); if(pValue->vt != TYPEDID_TYPE(oid)) { @@ -813,6 +906,10 @@ FIXME("OID_SECURITY_HWND_OWNER (value %08x): ignoring\n", pValue->u.ulVal); hr = S_OK; break; + case OID_TRANSMIT_BODY_ENCODING: + FIXME("OID_TRANSMIT_BODY_ENCODING (value %08x): ignoring\n", pValue->u.ulVal); + hr = S_OK; + break; default: FIXME("Unhandled oid %08x\n", oid); } @@ -825,7 +922,8 @@ const TYPEDID oid, LPPROPVARIANT pValue) { - FIXME("(%p)->(%08x, %p): stub\n", iface, oid, pValue); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%08x, %p): stub\n", This, oid, pValue); return E_NOTIMPL; } @@ -834,7 +932,8 @@ DWORD dwFlags, IMimeEnumProperties** ppEnum) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(0x%x, %p) stub\n", This, dwFlags, ppEnum); return E_NOTIMPL; } @@ -844,7 +943,7 @@ { MimeBody *This = impl_from_IMimeBody(iface); - TRACE("(%p)->(%d)\n", iface, bodytype); + TRACE("(%p)->(%d)\n", This, bodytype); switch(bodytype) { case IBT_EMPTY: @@ -859,7 +958,8 @@ IMimeBody* iface, LPCSTR pszDisplay) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%s) stub\n", This, debugstr_a(pszDisplay)); return E_NOTIMPL; } @@ -867,7 +967,8 @@ IMimeBody* iface, LPSTR* ppszDisplay) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p) stub\n", This, ppszDisplay); return E_NOTIMPL; } @@ -913,7 +1014,8 @@ ENCODINGTYPE ietEncoding, ULONG* pcbSize) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%d, %p) stub\n", This, ietEncoding, pcbSize); return E_NOTIMPL; } @@ -922,7 +1024,8 @@ ENCODINGTYPE ietEncoding, IStream* pStream) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%d, %p) stub\n", This, ietEncoding, pStream); return E_NOTIMPL; } @@ -977,7 +1080,8 @@ static HRESULT WINAPI MimeBody_EmptyData( IMimeBody* iface) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->() stub\n", This); return E_NOTIMPL; } @@ -985,7 +1089,8 @@ IMimeBody* iface, IMimeBody* pBody) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p) stub\n", This, pBody); return E_NOTIMPL; } @@ -993,7 +1098,8 @@ IMimeBody* iface, LPTRANSMITINFO pTransmitInfo) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%p) stub\n", This, pTransmitInfo); return E_NOTIMPL; } @@ -1002,7 +1108,8 @@ ENCODINGTYPE ietEncoding, LPCSTR pszFilePath) { - FIXME("stub\n"); + MimeBody *This = impl_from_IMimeBody(iface); + FIXME("(%p)->(%d, %s) stub\n", This, ietEncoding, debugstr_a(pszFilePath)); return E_NOTIMPL; } @@ -1643,7 +1750,7 @@ for(i = 0; i < count; i++) { - if(!strcasecmp(param_info[i].pszName, "boundary")) + if(!lstrcmpiA(param_info[i].pszName, "boundary")) { struct list offset_list; offset_entry_t *cur, *cursor2; @@ -1688,6 +1795,8 @@ return E_FAIL; } + empty_body_list(&This->body_tree); + IStream_AddRef(pStm); This->stream = pStm; offsets.cbBoundaryStart = offsets.cbHeaderStart = 0; @@ -2182,27 +2291,38 @@ const TYPEDID oid, LPCPROPVARIANT pValue) { - HRESULT hr = E_NOTIMPL; + HRESULT hr = S_OK; TRACE("(%p)->(%08x, %p)\n", iface, oid, pValue); + /* Message ID is checked before type. + * OID 0x4D -> 0x56 and 0x58 aren't defined but will filtered out later. + */ + if(TYPEDID_ID(oid) < TYPEDID_ID(OID_ALLOW_8BIT_HEADER) || TYPEDID_ID(oid) > TYPEDID_ID(OID_SECURITY_2KEY_CERT_BAG_64)) + { + WARN("oid (%08x) out of range\n", oid); + return MIME_E_INVALID_OPTION_ID; + } + if(pValue->vt != TYPEDID_TYPE(oid)) { WARN("Called with vartype %04x and oid %08x\n", pValue->vt, oid); - return E_INVALIDARG; + return S_OK; } switch(oid) { case OID_HIDE_TNEF_ATTACHMENTS: FIXME("OID_HIDE_TNEF_ATTACHMENTS (value %d): ignoring\n", pValue->u.boolVal); - hr = S_OK; break; case OID_SHOW_MACBINARY: FIXME("OID_SHOW_MACBINARY (value %d): ignoring\n", pValue->u.boolVal); - hr = S_OK; + break; + case OID_SAVEBODY_KEEPBOUNDARY: + FIXME("OID_SAVEBODY_KEEPBOUNDARY (value %d): ignoring\n", pValue->u.boolVal); break; default: FIXME("Unhandled oid %08x\n", oid); + hr = MIME_E_INVALID_OPTION_ID; } return hr; @@ -2526,6 +2646,8 @@ HRESULT MimeMessage_create(IUnknown *outer, void **obj) { MimeMessage *This; + MimeBody *mime_body; + body_t *root_body; TRACE("(%p, %p)\n", outer, obj); @@ -2545,6 +2667,10 @@ This->stream = NULL; list_init(&This->body_tree); This->next_index = 1; + + mime_body = mimebody_create(); + root_body = new_body_entry(mime_body, This->next_index++, NULL); + list_add_head(&This->body_tree, &root_body->entry); *obj = &This->IMimeMessage_iface; return S_OK; @@ -2976,3 +3102,127 @@ return MimeOleCreateVirtualStream((IStream **)obj); } + +/* IMimePropertySchema Interface */ +static HRESULT WINAPI propschema_QueryInterface(IMimePropertySchema *iface, REFIID riid, void **out) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), out); + + *out = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IMimePropertySchema)) + { + *out = iface; + } + else + { + FIXME("no interface for %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IMimePropertySchema_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI propschema_AddRef(IMimePropertySchema *iface) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI propschema_Release(IMimePropertySchema *iface) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI propschema_RegisterProperty(IMimePropertySchema *iface, const char *name, DWORD flags, + DWORD rownumber, VARTYPE vtdefault, DWORD *propid) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %x, %d, %d, %p) stub\n", This, debugstr_a(name), flags, rownumber, vtdefault, propid); + return E_NOTIMPL; +} + +static HRESULT WINAPI propschema_ModifyProperty(IMimePropertySchema *iface, const char *name, DWORD flags, + DWORD rownumber, VARTYPE vtdefault) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %x, %d, %d) stub\n", This, debugstr_a(name), flags, rownumber, vtdefault); + return S_OK; +} + +static HRESULT WINAPI propschema_GetPropertyId(IMimePropertySchema *iface, const char *name, DWORD *propid) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %p) stub\n", This, debugstr_a(name), propid); + return E_NOTIMPL; +} + +static HRESULT WINAPI propschema_GetPropertyName(IMimePropertySchema *iface, DWORD propid, char **name) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%d, %p) stub\n", This, propid, name); + return E_NOTIMPL; +} + +static HRESULT WINAPI propschema_RegisterAddressType(IMimePropertySchema *iface, const char *name, DWORD *adrtype) +{ + propschema *This = impl_from_IMimePropertySchema(iface); + FIXME("(%p)->(%s, %p) stub\n", This, debugstr_a(name), adrtype); + return E_NOTIMPL; +} + +static IMimePropertySchemaVtbl prop_schema_vtbl = +{ + propschema_QueryInterface, + propschema_AddRef, + propschema_Release, + propschema_RegisterProperty, + propschema_ModifyProperty, + propschema_GetPropertyId, + propschema_GetPropertyName, + propschema_RegisterAddressType +}; + + +HRESULT WINAPI MimeOleGetPropertySchema(IMimePropertySchema **schema) +{ + propschema *This; + + TRACE("(%p) stub\n", schema); + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + if (!This) + return E_OUTOFMEMORY; + + This->IMimePropertySchema_iface.lpVtbl = &prop_schema_vtbl; + This->ref = 1; + + *schema = &This->IMimePropertySchema_iface; + + return S_OK; +} + +HRESULT WINAPI MimeGetAddressFormatW(REFIID riid, void *object, DWORD addr_type, + ADDRESSFORMAT addr_format, WCHAR **address) +{ + FIXME("(%s, %p, %d, %d, %p) stub\n", debugstr_guid(riid), object, addr_type, addr_format, address); + + return E_NOTIMPL; +} Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 5 19:23:27 2016 @@ -78,7 +78,7 @@ reactos/dll/win32/imaadp32.acm # Synced to WineStaging-1.9.11 reactos/dll/win32/imagehlp # Synced to WineStaging-1.9.4 reactos/dll/win32/imm32 # Synced to Wine-1.7.27 -reactos/dll/win32/inetcomm # Synced to WineStaging-1.9.4 +reactos/dll/win32/inetcomm # Synced to WineStaging-1.9.11 reactos/dll/win32/inetmib1 # Synced to WineStaging-1.9.4 reactos/dll/win32/initpki # Synced to WineStaging-1.9.4 reactos/dll/win32/inseng # Synced to WineStaging-1.9.4
8 years, 5 months
1
0
0
0
[akhaldi] 71554: [PSDK] Update mimeole.idl. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:22:51 2016 New Revision: 71554 URL:
http://svn.reactos.org/svn/reactos?rev=71554&view=rev
Log: [PSDK] Update mimeole.idl. CORE-11368 Modified: trunk/reactos/sdk/include/psdk/mimeole.idl Modified: trunk/reactos/sdk/include/psdk/mimeole.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/mimeole.i…
============================================================================== --- trunk/reactos/sdk/include/psdk/mimeole.idl [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/mimeole.idl [iso-8859-1] Sun Jun 5 19:22:51 2016 @@ -48,6 +48,23 @@ cpp_quote("#define MIME_E_CHARSET_TRANSLATE 0x800cce0a") cpp_quote("#define MIME_E_NOT_INITIALIZED 0x800cce0b") +cpp_quote("#define MIME_E_INVALID_OPTION_VALUE 0x800cce1f") +cpp_quote("#define MIME_E_INVALID_OPTION_ID 0x800cce20") +cpp_quote("#define MIME_E_INVALID_HEADER_NAME 0x800cce21") +cpp_quote("#define MIME_E_NOT_BOUND 0x800cce22") +cpp_quote("#define MIME_E_MAX_SIZE_TOO_SMALL 0x800cce23") +cpp_quote("#define MIME_E_MULTIPART_HAS_CHILDREN 0x800cce25") +cpp_quote("#define MIME_E_INVALID_PROP_FLAGS 0x800cce26") +cpp_quote("#define MIME_E_INVALID_ADDRESS_TYPE 0x800cce27") +cpp_quote("#define MIME_E_INVALID_OBJECT_IID 0x800cce28") +cpp_quote("#define MIME_E_MLANG_DLL_NOT_FOUND 0x800cce29") +cpp_quote("#define MIME_E_ROOT_NOT_EMPTY 0x800cce2a") +cpp_quote("#define MIME_E_MLANG_BAD_DLL 0x800cce2b") +cpp_quote("#define MIME_E_REG_OPEN_KEY 0x800cce2c") +cpp_quote("#define MIME_E_INVALID_INET_DATE 0x800cce2d") +cpp_quote("#define MIME_E_INVALID_BODYTYPE 0x800cce2e") +cpp_quote("#define MIME_E_INVALID_DELETE_TYPE 0x800cce2f") +cpp_quote("#define MIME_E_OPTION_HAS_NO_VALUE 0x800cce30") cpp_quote("#define MIME_E_INVALID_CHARSET_TYPE 0x800cce31") cpp_quote("#define MIME_E_INVALID_TEXT_TYPE 0x800cce38") @@ -84,21 +101,85 @@ cpp_quote(" PID_HDR_FOLLOWUPTO = 27,") cpp_quote(" PID_HDR_EXPIRES = 28,") cpp_quote(" PID_HDR_CC = 29,") - +cpp_quote(" PID_HDR_CONTROL = 30,") +cpp_quote(" PID_HDR_DISTRIB = 31,") +cpp_quote(" PID_HDR_KEYWORDS = 32,") +cpp_quote(" PID_HDR_SUMMARY = 33,") +cpp_quote(" PID_HDR_APPROVED = 34,") +cpp_quote(" PID_HDR_LINES = 35,") +cpp_quote(" PID_HDR_XREF = 36,") +cpp_quote(" PID_HDR_ORG = 37,") +cpp_quote(" PID_HDR_XNEWSRDR = 38,") +cpp_quote(" PID_HDR_XPRI = 39,") +cpp_quote(" PID_HDR_XMSPRI = 40,") +cpp_quote(" PID_PAR_FILENAME = 41,") +cpp_quote(" PID_PAR_BOUNDARY = 42,") +cpp_quote(" PID_PAR_CHARSET = 43,") +cpp_quote(" PID_PAR_NAME = 44,") +cpp_quote(" PID_ATT_FILENAME = 45,") +cpp_quote(" PID_ATT_GENFNAME = 46,") +cpp_quote(" PID_ATT_PRITYPE = 47,") +cpp_quote(" PID_ATT_SUBTYPE = 48,") +cpp_quote(" PID_ATT_NORMSUBJ = 49,") +cpp_quote(" PID_ATT_ILLEGAL = 50,") +cpp_quote(" PID_ATT_RENDERED = 51,") +cpp_quote(" PID_ATT_SENTTIME = 52,") +cpp_quote(" PID_ATT_RECVTIME = 53,") +cpp_quote(" PID_ATT_PRIORITY = 54,") +cpp_quote(" PID_HDR_COMMENT = 55,") +cpp_quote(" PID_HDR_ENCODING = 56,") +cpp_quote(" PID_HDR_ENCRYPTED = 57,") +cpp_quote(" PID_HDR_OFFSETS = 58,") +cpp_quote(" PID_HDR_XUNSENT = 59,") +cpp_quote(" PID_HDR_ARTICLEID = 60,") cpp_quote(" PID_HDR_SENDER = 61,") - -cpp_quote(" PID_HDR_INREPLYTO = 77,") +cpp_quote(" PID_ATT_SERVER = 62,") +cpp_quote(" PID_ATT_ACCOUNT = 63,") +cpp_quote(" PID_ATT_UIDL = 64,") +cpp_quote(" PID_ATT_STOREMSGID = 65,") +cpp_quote(" PID_ATT_USERNAME = 66,") +cpp_quote(" PID_ATT_FORWARDTO = 67,") +cpp_quote(" PID_ATT_STOREFOLDERID = 68,") +cpp_quote(" PID_ATT_GHOSTED = 69,") +cpp_quote(" PID_ATT_UNCACHEDSIZE = 70,") +cpp_quote(" PID_ATT_COMBINED = 71,") +cpp_quote(" PID_ATT_AUTOINLINED = 72,") +cpp_quote(" PID_HDR_DISP_NOTIFICATION_TO = 73,") +cpp_quote(" PID_PAR_REPLYTYPE = 74,") +cpp_quote(" PID_PAR_FORMAT = 75,") +cpp_quote(" PID_ATT_FORMAT = 76,") +cpp_quote(" PID_HDR_INREPLYTO = 77,") +cpp_quote(" PID_ATT_ACCOUNTNAME = 78,") +cpp_quote(" PID_LAST = 79,") cpp_quote("} MIMEPROPID;") +cpp_quote("#define TYPEDID_ID(_typedid) (((ULONG)(_typedid))>>16)") cpp_quote("#define TYPEDID_MASK ((ULONG)0xffff)") cpp_quote("#define TYPEDID_TYPE(t) ((VARTYPE)((t) & TYPEDID_MASK))") +cpp_quote("#define OID_ALLOW_8BIT_HEADER (0x00010000 | VT_BOOL)") +cpp_quote("#define OID_CBMAX_HEADER_LINE (0x00020000 | VT_UI4)") +cpp_quote("#define OID_SAVE_FORMAT (0x00030000 | VT_UI4)") +cpp_quote("#define OID_WRAP_BODY_TEXT (0x00040000 | VT_BOOL)") +cpp_quote("#define OID_CBMAX_BODY_LINE (0x00050000 | VT_UI4)") +cpp_quote("#define OID_TRANSMIT_BODY_ENCODING (0x00060000 | VT_UI4)") +cpp_quote("#define OID_TRANSMIT_TEXT_ENCODING (0x00070000 | VT_UI4)") +cpp_quote("#define OID_GENERATE_MESSAGE_ID (0x00080000 | VT_BOOL)") cpp_quote("#define OID_HIDE_TNEF_ATTACHMENTS (0x000e0000 | VT_BOOL)") +cpp_quote("#define OID_CLEANUP_TREE_ON_SAVE (0x000f0000 | VT_BOOL)") +cpp_quote("#define OID_BODY_REMOVE_NBSP (0x00140000 | VT_BOOL)") +cpp_quote("#define OID_DEFAULT_BODY_CHARSET (0x00150000 | VT_UI4)") +cpp_quote("#define OID_DEFAULT_HEADER_CHARSET (0x00160000 | VT_UI4)") +cpp_quote("#define OID_DBCS_ESCAPE_IS_8BIT (0x00170000 | VT_BOOL)") cpp_quote("#define OID_SECURITY_TYPE (0x00180000 | VT_UI4)") cpp_quote("#define OID_SECURITY_HWND_OWNER (0x00320000 | VT_UI4)") cpp_quote("#define OID_HEADER_RELOAD_TYPE (0x00370000 | VT_UI4)") +cpp_quote("#define OID_CAN_INLINE_TEXT_BODIES (0x00380000 | VT_BOOL)") cpp_quote("#define OID_SHOW_MACBINARY (0x00390000 | VT_BOOL)") - +cpp_quote("#define OID_SAVEBODY_KEEPBOUNDARY (0x00400000 | VT_BOOL)") + +cpp_quote("#define OID_SECURITY_2KEY_CERT_BAG (0x00590000 | VT_VECTOR | VT_UI4)") +cpp_quote("#define OID_SECURITY_2KEY_CERT_BAG_64 (0x00590000 | VT_VECTOR | VT_UI8)") [ uuid(e4b28371-83b0-11d0-8259-00c04fd85ab4), @@ -423,6 +504,8 @@ ] interface IMimePropertySchema : IUnknown { + typedef [unique] IMimePropertySchema *LPMIMEPROPERTYSCHEMA; + typedef enum tagMIMEPROPFLAGS { MPF_INETCSET = 0x01, @@ -433,7 +516,30 @@ MPF_READONLY = 0x20 } MIMEPROPFLAGS; - /* FIXME: fill this in */ + HRESULT RegisterProperty( + [in] const char *name, + [in] DWORD flags, + [in] DWORD rownumber, + [in] VARTYPE vtdefault, + [out] DWORD *propid); + + HRESULT ModifyProperty( + [in] const char *name, + [in] DWORD flags, + [in] DWORD rownumber, + [in] VARTYPE vtdefault); + + HRESULT GetPropertyId( + [in] const char *name, + [out] DWORD *propid); + + HRESULT GetPropertyName( + [in] DWORD propid, + [out] char **name); + + HRESULT RegisterAddressType( + [in] const char *name, + [out] DWORD *adrtype); } [ @@ -1332,6 +1438,8 @@ cpp_quote("HRESULT WINAPI MimeEditGetBackgroundImageUrl(IUnknown*,BSTR*);") cpp_quote("HRESULT WINAPI MimeEditDocumentFromStream(IStream*,REFIID,void**);") +cpp_quote("HRESULT WINAPI MimeOleGetPropertySchema(IMimePropertySchema**);") +cpp_quote("HRESULT WINAPI MimeGetAddressFormatW(REFIID,void*,DWORD,ADDRESSFORMAT,WCHAR**);") cpp_quote("#ifdef __cplusplus") cpp_quote("}") cpp_quote("#endif")
8 years, 5 months
1
0
0
0
[akhaldi] 71553: [IMAADP32.ACM] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:20:32 2016 New Revision: 71553 URL:
http://svn.reactos.org/svn/reactos?rev=71553&view=rev
Log: [IMAADP32.ACM] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/win32/imaadp32.acm/imaadp32.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/imaadp32.acm/imaadp32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/imaadp32.acm/ima…
============================================================================== --- trunk/reactos/dll/win32/imaadp32.acm/imaadp32.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/imaadp32.acm/imaadp32.c [iso-8859-1] Sun Jun 5 19:20:32 2016 @@ -179,6 +179,25 @@ { dst[0] = LOBYTE(s); dst[1] = HIBYTE(s); +} + +/*********************************************************************** + * W8 + * + * Write a 8 bit sample + */ +static inline void W8(unsigned char* dst, short s) +{ + dst[0] = (unsigned char)((s + 32768) >> 8); +} + + +static inline void W8_16(unsigned char* dst, short s, int bytes) +{ + if(bytes == 1) + W8(dst, s); + else + W16(dst, s); } /* IMA (or DVI) APDCM codec routines */ @@ -341,43 +360,43 @@ } } -static void cvtMMima16K(PACMDRVSTREAMINSTANCE adsi, - const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - int sample; - int stepIndex; - int nsamp_blk = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxSrc)->wSamplesPerBlock; - int nsamp; +static void cvtMMimaK(PACMDRVSTREAMINSTANCE adsi, + const unsigned char* src, LPDWORD nsrc, + unsigned char* dst, LPDWORD ndst) +{ + int sample; + int stepIndex; + int nsamp_blk = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxSrc)->wSamplesPerBlock; + int nsamp; + int bytesPerSample = adsi->pwfxDst->wBitsPerSample / 8; /* compute the number of entire blocks we can decode... * it's the min of the number of entire blocks in source buffer and the number * of entire blocks in destination buffer */ - DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign, - *ndst / (nsamp_blk * 2)); + DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign, *ndst / (nsamp_blk * bytesPerSample)); *nsrc = nblock * adsi->pwfxSrc->nBlockAlign; - *ndst = nblock * nsamp_blk * 2; + *ndst = nblock * nsamp_blk * bytesPerSample; nsamp_blk--; /* remove the sample in block header */ for (; nblock > 0; nblock--) { - const unsigned char* in_src = src; - - /* handle header first */ - sample = R16(src); - stepIndex = (unsigned)*(src + 2); + const unsigned char* in_src = src; + + /* handle header first */ + sample = R16(src); + stepIndex = (unsigned)*(src + 2); clamp_step_index(&stepIndex); - src += 4; - W16(dst, sample); dst += 2; - - for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2) + src += 4; + W8_16(dst, sample, bytesPerSample); dst += bytesPerSample; + + for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2) { process_nibble(*src, &stepIndex, &sample); - W16(dst, sample); dst += 2; + W8_16(dst, sample, bytesPerSample); dst += bytesPerSample; process_nibble(*src++ >> 4, &stepIndex, &sample); - W16(dst, sample); dst += 2; - } + W8_16(dst, sample, bytesPerSample); dst += bytesPerSample; + } /* we have now to realign the source pointer on block */ src = in_src + adsi->pwfxSrc->nBlockAlign; } @@ -735,13 +754,14 @@ else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_IMA_ADPCM && adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM) { - /* resampling or mono <=> stereo not available + /* resampling or mono <=> stereo not available * ADPCM algo only define 16 bit per sample output + * (The API seems to still allow 8 bit per sample output) */ - if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec || - adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels || - adsi->pwfxDst->wBitsPerSample != 16) - goto theEnd; + if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec || + adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels || + (adsi->pwfxDst->wBitsPerSample != 16 && adsi->pwfxDst->wBitsPerSample != 8)) + goto theEnd; nspb = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxSrc)->wSamplesPerBlock; TRACE("spb=%u\n", nspb); @@ -754,11 +774,16 @@ if ((((nspb - 1) / 2) + 4) * adsi->pwfxSrc->nChannels < adsi->pwfxSrc->nBlockAlign) goto theEnd; - /* adpcm decoding... */ - if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 2) - aad->convert = cvtSSima16K; - if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 1) - aad->convert = cvtMMima16K; + /* adpcm decoding... */ + if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 2) + aad->convert = cvtSSima16K; + if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 1) + aad->convert = cvtMMimaK; + if (adsi->pwfxDst->wBitsPerSample == 8 && adsi->pwfxDst->nChannels == 1) + aad->convert = cvtMMimaK; + /* FIXME: Stereo support for 8bit samples*/ + if (adsi->pwfxDst->wBitsPerSample == 8 && adsi->pwfxDst->nChannels == 2) + goto theEnd; } else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM && adsi->pwfxDst->wFormatTag == WAVE_FORMAT_IMA_ADPCM) Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 5 19:20:32 2016 @@ -75,7 +75,7 @@ reactos/dll/win32/httpapi # Synced to WineStaging-1.9.4 reactos/dll/win32/iccvid # Synced to WineStaging-1.9.11 reactos/dll/win32/ieframe # Synced to WineStaging-1.9.11 -reactos/dll/win32/imaadp32.acm # Synced to WineStaging-1.9.4 +reactos/dll/win32/imaadp32.acm # Synced to WineStaging-1.9.11 reactos/dll/win32/imagehlp # Synced to WineStaging-1.9.4 reactos/dll/win32/imm32 # Synced to Wine-1.7.27 reactos/dll/win32/inetcomm # Synced to WineStaging-1.9.4
8 years, 5 months
1
0
0
0
[akhaldi] 71552: [IMAGEHLP_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:18:47 2016 New Revision: 71552 URL:
http://svn.reactos.org/svn/reactos?rev=71552&view=rev
Log: [IMAGEHLP_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/rostests/winetests/imagehlp/image.c Modified: trunk/rostests/winetests/imagehlp/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/imagehlp/image.…
============================================================================== --- trunk/rostests/winetests/imagehlp/image.c [iso-8859-1] (original) +++ trunk/rostests/winetests/imagehlp/image.c [iso-8859-1] Sun Jun 5 19:18:47 2016 @@ -462,10 +462,8 @@ if (img) { - todo_wine ok(!strcmp(img->ModuleName, temp_file), "unexpected ModuleName, got %s instead of %s\n", img->ModuleName, temp_file); - todo_wine ok(img->MappedAddress != NULL, "MappedAddress != NULL\n"); if (img->MappedAddress) { @@ -475,11 +473,9 @@ ok(img->FileHeader != NULL, "FileHeader != NULL\n"); if (img->FileHeader) { - todo_wine ok(!memcmp(img->FileHeader, &bin.nt_headers, sizeof(bin.nt_headers)), "FileHeader doesn't point to IMAGE_NT_HEADERS32\n"); } - todo_wine ok(img->NumberOfSections == 3, "unexpected NumberOfSections, got %d instead of 3\n", img->NumberOfSections); if (img->NumberOfSections >= 3) @@ -494,7 +490,6 @@ "unexpected name for section 2, expected .idata, got %s\n", (const char *)img->Sections[2].Name); } - todo_wine ok(img->Characteristics == 0x102, "unexpected Characteristics, got 0x%x instead of 0x102\n", img->Characteristics); ok(img->fSystemImage == 0, @@ -507,7 +502,6 @@ todo_wine ok(img->Version == 1 || broken(!img->Version) /* <= WinXP */, "unexpected Version, got %d instead of 1\n", img->Version); - todo_wine ok(img->SizeOfImage == 0x600, "unexpected SizeOfImage, got 0x%x instead of 0x600\n", img->SizeOfImage);
8 years, 5 months
1
0
0
0
[akhaldi] 71551: [IEFRAME] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:18:20 2016 New Revision: 71551 URL:
http://svn.reactos.org/svn/reactos?rev=71551&view=rev
Log: [IEFRAME] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/win32/ieframe/client.c trunk/reactos/dll/win32/ieframe/ieframe.h trunk/reactos/dll/win32/ieframe/intshcut.c trunk/reactos/dll/win32/ieframe/navigate.c trunk/reactos/dll/win32/ieframe/oleobject.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/ieframe/client.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/client.c…
============================================================================== --- trunk/reactos/dll/win32/ieframe/client.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ieframe/client.c [iso-8859-1] Sun Jun 5 19:18:20 2016 @@ -381,8 +381,10 @@ if(FAILED(hres)) return hres; - IOleDocument_CreateView(oledoc, (IOleInPlaceSite*) &This->IOleInPlaceSiteEx_iface, NULL, 0, &This->view); + hres = IOleDocument_CreateView(oledoc, (IOleInPlaceSite*) &This->IOleInPlaceSiteEx_iface, NULL, 0, &This->view); IOleDocument_Release(oledoc); + if(FAILED(hres)) + return hres; GetClientRect(This->hwnd, &rect); IOleDocumentView_SetRect(This->view, &rect); @@ -657,6 +659,11 @@ return IWebBrowser2_QueryInterface(This->wb, riid, ppv); } + if(IsEqualGUID(&IID_ITargetFrame, guidService)) { + TRACE("(%p)->(IID_ITargetFrame %s %p)\n", This, debugstr_guid(riid), ppv); + return IWebBrowser2_QueryInterface(This->wb, riid, ppv); + } + if(IsEqualGUID(&IID_IWebBrowserApp, guidService)) { TRACE("IWebBrowserApp service\n"); return IWebBrowser2_QueryInterface(This->wb, riid, ppv); Modified: trunk/reactos/dll/win32/ieframe/ieframe.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/ieframe.…
============================================================================== --- trunk/reactos/dll/win32/ieframe/ieframe.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ieframe/ieframe.h [iso-8859-1] Sun Jun 5 19:18:20 2016 @@ -72,6 +72,7 @@ typedef struct { IHlinkFrame IHlinkFrame_iface; + ITargetFrame ITargetFrame_iface; ITargetFrame2 ITargetFrame2_iface; ITargetFramePriv2 ITargetFramePriv2_iface; IWebBrowserPriv2IE9 IWebBrowserPriv2IE9_iface; @@ -206,6 +207,7 @@ INT version; IOleClientSite *client; + IOleClientSite *client_closed; IOleContainer *container; IOleInPlaceSiteEx *inplace; Modified: trunk/reactos/dll/win32/ieframe/intshcut.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/intshcut…
============================================================================== --- trunk/reactos/dll/win32/ieframe/intshcut.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ieframe/intshcut.c [iso-8859-1] Sun Jun 5 19:18:20 2016 @@ -404,135 +404,119 @@ return This->isDirty ? S_OK : S_FALSE; } -/* A helper function: Allocate and fill rString. Return number of bytes read. */ -static DWORD get_profile_string(LPCWSTR lpAppName, LPCWSTR lpKeyName, +/* Returns allocated profile string and a standard return code. */ +static HRESULT get_profile_string(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpFileName, WCHAR **rString ) { DWORD r = 0; DWORD len = 128; WCHAR *buffer; + *rString = NULL; buffer = CoTaskMemAlloc(len * sizeof(*buffer)); - if (buffer != NULL) - { + if (!buffer) + return E_OUTOFMEMORY; + + r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, lpFileName); + while (r == len-1) + { + WCHAR *realloc_buf; + + len *= 2; + realloc_buf = CoTaskMemRealloc(buffer, len * sizeof(*buffer)); + if (realloc_buf == NULL) + { + CoTaskMemFree(buffer); + return E_OUTOFMEMORY; + } + buffer = realloc_buf; + r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, lpFileName); - while (r == len-1) - { - WCHAR *realloc_buf; - - len *= 2; - realloc_buf = CoTaskMemRealloc(buffer, len * sizeof(*buffer)); - if (realloc_buf == NULL) - { - CoTaskMemFree(buffer); - *rString = NULL; - return 0; - } - buffer = realloc_buf; - - r = GetPrivateProfileStringW(lpAppName, lpKeyName, NULL, buffer, len, lpFileName); - } } *rString = buffer; - return r; + return r ? S_OK : E_FAIL; } static HRESULT WINAPI PersistFile_Load(IPersistFile *pFile, LPCOLESTR pszFileName, DWORD dwMode) { - WCHAR str_header[] = {'I','n','t','e','r','n','e','t','S','h','o','r','t','c','u','t',0}; - WCHAR str_URL[] = {'U','R','L',0}; - WCHAR str_iconfile[] = {'i','c','o','n','f','i','l','e',0}; - WCHAR str_iconindex[] = {'i','c','o','n','i','n','d','e','x',0}; + InternetShortcut *This = impl_from_IPersistFile(pFile); + static WCHAR str_header[] = {'I','n','t','e','r','n','e','t','S','h','o','r','t','c','u','t',0}; + static WCHAR str_URL[] = {'U','R','L',0}; + static WCHAR str_iconfile[] = {'i','c','o','n','f','i','l','e',0}; + static WCHAR str_iconindex[] = {'i','c','o','n','i','n','d','e','x',0}; WCHAR *filename = NULL; + WCHAR *url; HRESULT hr; - InternetShortcut *This = impl_from_IPersistFile(pFile); + IPropertyStorage *pPropStg; + WCHAR *iconfile; + WCHAR *iconindexstring; + TRACE("(%p, %s, 0x%x)\n", pFile, debugstr_w(pszFileName), dwMode); + if (dwMode != 0) FIXME("ignoring unimplemented mode 0x%x\n", dwMode); + filename = co_strdupW(pszFileName); - if (filename != NULL) - { - DWORD r; - WCHAR *url; - - r = get_profile_string(str_header, str_URL, pszFileName, &url); - - if (url == NULL) - { - hr = E_OUTOFMEMORY; - CoTaskMemFree(filename); - } - else if (r == 0) - { - hr = E_FAIL; - CoTaskMemFree(filename); - } - else - { - hr = S_OK; - CoTaskMemFree(This->currentFile); - This->currentFile = filename; - CoTaskMemFree(This->url); - This->url = url; - This->isDirty = FALSE; - } - - /* Now we're going to read in the iconfile and iconindex. - If we don't find them, that's not a failure case -- it's possible - that they just aren't in there. */ - if (SUCCEEDED(hr)) - { - IPropertyStorage *pPropStg; - WCHAR *iconfile; - WCHAR *iconindexstring; - hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut, - STGM_READWRITE | STGM_SHARE_EXCLUSIVE, - &pPropStg); - - if (get_profile_string(str_header, str_iconfile, pszFileName, &iconfile)) - { - PROPSPEC ps; - PROPVARIANT pv; - ps.ulKind = PRSPEC_PROPID; - ps.u.propid = PID_IS_ICONFILE; - pv.vt = VT_LPWSTR; - pv.u.pwszVal = iconfile; - hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); - if (FAILED(hr)) - { - TRACE("Failed to store the iconfile to our property storage. hr = 0x%x\n", hr); - } - } - CoTaskMemFree(iconfile); - - if (get_profile_string(str_header, str_iconindex, pszFileName, &iconindexstring)) - { - int iconindex; - PROPSPEC ps; - PROPVARIANT pv; - char *iconindexastring = co_strdupWtoA(iconindexstring); - sscanf(iconindexastring, "%d", &iconindex); - CoTaskMemFree(iconindexastring); - ps.ulKind = PRSPEC_PROPID; - ps.u.propid = PID_IS_ICONINDEX; - pv.vt = VT_I4; - pv.u.iVal = iconindex; - hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); - if (FAILED(hr)) - { - TRACE("Failed to store the iconindex to our property storage. hr = 0x%x\n", hr); - } - } - CoTaskMemFree(iconindexstring); - - IPropertyStorage_Release(pPropStg); - } - else - hr = E_OUTOFMEMORY; - } - else - hr = E_OUTOFMEMORY; + if (!filename) + return E_OUTOFMEMORY; + + if (FAILED(hr = get_profile_string(str_header, str_URL, pszFileName, &url))) + { + CoTaskMemFree(filename); + return hr; + } + + hr = IPropertySetStorage_Open(This->property_set_storage, &FMTID_Intshcut, + STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &pPropStg); + if (FAILED(hr)) + { + CoTaskMemFree(filename); + CoTaskMemFree(url); + return hr; + } + + CoTaskMemFree(This->currentFile); + This->currentFile = filename; + CoTaskMemFree(This->url); + This->url = url; + This->isDirty = FALSE; + + /* Now we're going to read in the iconfile and iconindex. + If we don't find them, that's not a failure case -- it's possible + that they just aren't in there. */ + + if (get_profile_string(str_header, str_iconfile, pszFileName, &iconfile) == S_OK) + { + PROPSPEC ps; + PROPVARIANT pv; + ps.ulKind = PRSPEC_PROPID; + ps.u.propid = PID_IS_ICONFILE; + pv.vt = VT_LPWSTR; + pv.u.pwszVal = iconfile; + hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); + if (FAILED(hr)) + TRACE("Failed to store the iconfile to our property storage. hr = 0x%x\n", hr); + } + CoTaskMemFree(iconfile); + + if (get_profile_string(str_header, str_iconindex, pszFileName, &iconindexstring) == S_OK) + { + int iconindex; + PROPSPEC ps; + PROPVARIANT pv; + iconindex = strtolW(iconindexstring, NULL, 10); + ps.ulKind = PRSPEC_PROPID; + ps.u.propid = PID_IS_ICONINDEX; + pv.vt = VT_I4; + pv.u.iVal = iconindex; + hr = IPropertyStorage_WriteMultiple(pPropStg, 1, &ps, &pv, 0); + if (FAILED(hr)) + TRACE("Failed to store the iconindex to our property storage. hr = 0x%x\n", hr); + } + CoTaskMemFree(iconindexstring); + + IPropertyStorage_Release(pPropStg); return hr; } Modified: trunk/reactos/dll/win32/ieframe/navigate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/navigate…
============================================================================== --- trunk/reactos/dll/win32/ieframe/navigate.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ieframe/navigate.c [iso-8859-1] Sun Jun 5 19:18:20 2016 @@ -1228,9 +1228,152 @@ HlinkFrame_UpdateHlink }; +static inline HlinkFrame *impl_from_ITargetFrame(ITargetFrame *iface) +{ + return CONTAINING_RECORD(iface, HlinkFrame, ITargetFrame_iface); +} + +static HRESULT WINAPI TargetFrame_QueryInterface(ITargetFrame *iface, REFIID riid, void **ppv) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + return IUnknown_QueryInterface(This->outer, riid, ppv); +} + +static ULONG WINAPI TargetFrame_AddRef(ITargetFrame *iface) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + return IUnknown_AddRef(This->outer); +} + +static ULONG WINAPI TargetFrame_Release(ITargetFrame *iface) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + return IUnknown_Release(This->outer); +} + +static HRESULT WINAPI TargetFrame_SetFrameName(ITargetFrame *iface, LPCWSTR pszFrameName) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_GetFrameName(ITargetFrame *iface, LPWSTR *ppszFrameName) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p)\n", This, ppszFrameName); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_GetParentFrame(ITargetFrame *iface, IUnknown **ppunkParent) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p)\n", This, ppunkParent); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_FindFrame(ITargetFrame *iface, LPCWSTR pszTargetName, + IUnknown *ppunkContextFrame, DWORD dwFlags, IUnknown **ppunkTargetFrame) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%s %p %x %p)\n", This, debugstr_w(pszTargetName), + ppunkContextFrame, dwFlags, ppunkTargetFrame); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_SetFrameSrc(ITargetFrame *iface, LPCWSTR pszFrameSrc) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(pszFrameSrc)); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_GetFrameSrc(ITargetFrame *iface, LPWSTR *ppszFrameSrc) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p)\n", This, ppszFrameSrc); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_GetFramesContainer(ITargetFrame *iface, IOleContainer **ppContainer) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p)\n", This, ppContainer); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_SetFrameOptions(ITargetFrame *iface, DWORD dwFlags) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%x)\n", This, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_GetFrameOptions(ITargetFrame *iface, DWORD *pdwFlags) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p)\n", This, pdwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_SetFrameMargins(ITargetFrame *iface, DWORD dwWidth, DWORD dwHeight) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%d %d)\n", This, dwWidth, dwHeight); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_GetFrameMargins(ITargetFrame *iface, DWORD *pdwWidth, DWORD *pdwHeight) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p %p)\n", This, pdwWidth, pdwHeight); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_RemoteNavigate(ITargetFrame *iface, ULONG cLength, ULONG *pulData) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%u %p)\n", This, cLength, pulData); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_OnChildFrameActivate(ITargetFrame *iface, IUnknown *pUnkChildFrame) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p)\n", This, pUnkChildFrame); + return E_NOTIMPL; +} + +static HRESULT WINAPI TargetFrame_OnChildFrameDeactivate(ITargetFrame *iface, IUnknown *pUnkChildFrame) +{ + HlinkFrame *This = impl_from_ITargetFrame(iface); + FIXME("(%p)->(%p)\n", This, pUnkChildFrame); + return E_NOTIMPL; +} + +static const ITargetFrameVtbl TargetFrameVtbl = { + TargetFrame_QueryInterface, + TargetFrame_AddRef, + TargetFrame_Release, + TargetFrame_SetFrameName, + TargetFrame_GetFrameName, + TargetFrame_GetParentFrame, + TargetFrame_FindFrame, + TargetFrame_SetFrameSrc, + TargetFrame_GetFrameSrc, + TargetFrame_GetFramesContainer, + TargetFrame_SetFrameOptions, + TargetFrame_GetFrameOptions, + TargetFrame_SetFrameMargins, + TargetFrame_GetFrameMargins, + TargetFrame_RemoteNavigate, + TargetFrame_OnChildFrameActivate, + TargetFrame_OnChildFrameDeactivate +}; + static inline HlinkFrame *impl_from_ITargetFrame2(ITargetFrame2 *iface) { - return CONTAINING_RECORD(iface, HlinkFrame, IHlinkFrame_iface); + return CONTAINING_RECORD(iface, HlinkFrame, ITargetFrame2_iface); } static HRESULT WINAPI TargetFrame2_QueryInterface(ITargetFrame2 *iface, REFIID riid, void **ppv) @@ -1504,6 +1647,9 @@ if(IsEqualGUID(&IID_IHlinkFrame, riid)) { TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv); *ppv = &This->IHlinkFrame_iface; + }else if(IsEqualGUID(&IID_ITargetFrame, riid)) { + TRACE("(%p)->(IID_ITargetFrame %p)\n", This, ppv); + *ppv = &This->ITargetFrame_iface; }else if(IsEqualGUID(&IID_ITargetFrame2, riid)) { TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This, ppv); *ppv = &This->ITargetFrame2_iface; @@ -1526,7 +1672,8 @@ void HlinkFrame_Init(HlinkFrame *This, IUnknown *outer, DocHost *doc_host) { - This->IHlinkFrame_iface.lpVtbl = &HlinkFrameVtbl; + This->IHlinkFrame_iface.lpVtbl = &HlinkFrameVtbl; + This->ITargetFrame_iface.lpVtbl = &TargetFrameVtbl; This->ITargetFrame2_iface.lpVtbl = &TargetFrame2Vtbl; This->ITargetFramePriv2_iface.lpVtbl = &TargetFramePriv2Vtbl; This->IWebBrowserPriv2IE9_iface.lpVtbl = &WebBrowserPriv2IE9Vtbl; Modified: trunk/reactos/dll/win32/ieframe/oleobject.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ieframe/oleobjec…
============================================================================== --- trunk/reactos/dll/win32/ieframe/oleobject.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ieframe/oleobject.c [iso-8859-1] Sun Jun 5 19:18:20 2016 @@ -273,7 +273,7 @@ return S_OK; } -static void release_client_site(WebBrowser *This) +static void release_client_site(WebBrowser *This, BOOL destroy_win) { release_dochost_client(&This->doc_host); @@ -282,7 +282,12 @@ This->client = NULL; } - if(This->shell_embedding_hwnd) { + if(This->client_closed) { + IOleClientSite_Release(This->client_closed); + This->client_closed = NULL; + } + + if(destroy_win && This->shell_embedding_hwnd) { DestroyWindow(This->shell_embedding_hwnd); This->shell_embedding_hwnd = NULL; } @@ -444,16 +449,29 @@ WebBrowser *This = impl_from_IOleObject(iface); IDocHostUIHandler *hostui; IOleCommandTarget *olecmd; + BOOL get_olecmd = TRUE; IOleContainer *container; IDispatch *disp; HRESULT hres; TRACE("(%p)->(%p)\n", This, pClientSite); + if(This->client_closed) { + IOleClientSite_Release(This->client_closed); + This->client_closed = NULL; + } + if(This->client == pClientSite) return S_OK; - release_client_site(This); + if(This->client && pClientSite) { + get_olecmd = FALSE; + olecmd = This->doc_host.olecmd; + if(olecmd) + IOleCommandTarget_AddRef(olecmd); + } + + release_client_site(This, !pClientSite); if(!pClientSite) { on_commandstate_change(&This->doc_host, CSC_NAVIGATEBACK, FALSE); @@ -477,31 +495,46 @@ if(SUCCEEDED(hres)) This->doc_host.hostui = hostui; - hres = IOleClientSite_GetContainer(This->client, &container); - if(SUCCEEDED(hres)) { - ITargetContainer *target_container; - - hres = IOleContainer_QueryInterface(container, &IID_ITargetContainer, - (void**)&target_container); + if(get_olecmd) { + hres = IOleClientSite_GetContainer(This->client, &container); if(SUCCEEDED(hres)) { - FIXME("Unsupported ITargetContainer\n"); - ITargetContainer_Release(target_container); + ITargetContainer *target_container; + + hres = IOleContainer_QueryInterface(container, &IID_ITargetContainer, + (void**)&target_container); + if(SUCCEEDED(hres)) { + FIXME("Unsupported ITargetContainer\n"); + ITargetContainer_Release(target_container); + } + + hres = IOleContainer_QueryInterface(container, &IID_IOleCommandTarget, (void**)&olecmd); + if(FAILED(hres)) + olecmd = NULL; + + IOleContainer_Release(container); + }else { + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd); + if(FAILED(hres)) + olecmd = NULL; } - - hres = IOleContainer_QueryInterface(container, &IID_IOleCommandTarget, (void**)&olecmd); - if(FAILED(hres)) - olecmd = NULL; - - IOleContainer_Release(container); + } + + This->doc_host.olecmd = olecmd; + + if(This->shell_embedding_hwnd) { + IOleInPlaceSite *inplace; + HWND parent; + + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleInPlaceSite, (void**)&inplace); + if(SUCCEEDED(hres)) { + hres = IOleInPlaceSite_GetWindow(inplace, &parent); + IOleInPlaceSite_Release(inplace); + if(SUCCEEDED(hres)) + SHSetParentHwnd(This->shell_embedding_hwnd, parent); + } }else { - hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd); - if(FAILED(hres)) - olecmd = NULL; - } - - This->doc_host.olecmd = olecmd; - - create_shell_embedding_hwnd(This); + create_shell_embedding_hwnd(This); + } on_offlineconnected_change(This); on_silent_change(This); @@ -539,6 +572,8 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption) { WebBrowser *This = impl_from_IOleObject(iface); + IOleClientSite *client; + HRESULT hres; TRACE("(%p)->(%d)\n", This, dwSaveOption); @@ -559,7 +594,13 @@ if(This->inplace) IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace); - return IOleObject_SetClientSite(iface, NULL); + /* store old client site - we need to restore it in DoVerb */ + client = This->client; + if(This->client) + IOleClientSite_AddRef(This->client); + hres = IOleObject_SetClientSite(iface, NULL); + This->client_closed = client; + return hres; } static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk) @@ -600,6 +641,14 @@ TRACE("(%p)->(%d %p %p %d %p %s)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, wine_dbgstr_rect(lprcPosRect)); + + /* restore closed client site if we have one */ + if(!This->client && This->client_closed) { + IOleClientSite *client = This->client_closed; + This->client_closed = NULL; + IOleObject_SetClientSite(iface, client); + IOleClientSite_Release(client); + } switch (iVerb) { @@ -1162,5 +1211,5 @@ void WebBrowser_OleObject_Destroy(WebBrowser *This) { - release_client_site(This); -} + release_client_site(This, TRUE); +} Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 5 19:18:20 2016 @@ -74,7 +74,7 @@ reactos/dll/win32/hnetcfg # Synced to WineStaging-1.9.11 reactos/dll/win32/httpapi # Synced to WineStaging-1.9.4 reactos/dll/win32/iccvid # Synced to WineStaging-1.9.11 -reactos/dll/win32/ieframe # Synced to WineStaging-1.9.4 +reactos/dll/win32/ieframe # Synced to WineStaging-1.9.11 reactos/dll/win32/imaadp32.acm # Synced to WineStaging-1.9.4 reactos/dll/win32/imagehlp # Synced to WineStaging-1.9.4 reactos/dll/win32/imm32 # Synced to Wine-1.7.27
8 years, 5 months
1
0
0
0
[akhaldi] 71550: [PSDK] Update htiface.idl and htiframe.idl. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:17:37 2016 New Revision: 71550 URL:
http://svn.reactos.org/svn/reactos?rev=71550&view=rev
Log: [PSDK] Update htiface.idl and htiframe.idl. CORE-11368 Modified: trunk/reactos/sdk/include/psdk/htiface.idl trunk/reactos/sdk/include/psdk/htiframe.idl Modified: trunk/reactos/sdk/include/psdk/htiface.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/htiface.i…
============================================================================== --- trunk/reactos/sdk/include/psdk/htiface.idl [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/htiface.idl [iso-8859-1] Sun Jun 5 19:17:37 2016 @@ -65,6 +65,24 @@ HRESULT SetFrameSrc([in] LPCWSTR pszFrameSrc); HRESULT GetFrameSrc([out] LPWSTR *ppszFrameSrc); + HRESULT GetFramesContainer([out] IOleContainer **ppContainer); + HRESULT SetFrameOptions([in] DWORD dwFlags); + HRESULT GetFrameOptions([out] DWORD *pdwFlags); + + HRESULT SetFrameMargins( + [in] DWORD dwWidth, + [in] DWORD dwHeight); + + HRESULT GetFrameMargins( + [out] DWORD *pdwWidth, + [out] DWORD *pdwHeight); + + HRESULT RemoteNavigate( + [in] ULONG cLength, + [in, size_is(cLength)] ULONG *pulData); + + HRESULT OnChildFrameActivate([in] IUnknown *pUnkChildFrame); + HRESULT OnChildFrameDeactivate([in] IUnknown *pUnkChildFrame); } /***************************************************************************** Modified: trunk/reactos/sdk/include/psdk/htiframe.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/htiframe.…
============================================================================== --- trunk/reactos/sdk/include/psdk/htiframe.idl [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/htiframe.idl [iso-8859-1] Sun Jun 5 19:17:37 2016 @@ -1,5 +1,5 @@ /* - * Copyright 2006 Jacek Caban for CodeWeavers + * Copyright 2006,2011 Jacek Caban for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public
8 years, 5 months
1
0
0
0
[akhaldi] 71549: [ICCVID] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:11:42 2016 New Revision: 71549 URL:
http://svn.reactos.org/svn/reactos?rev=71549&view=rev
Log: [ICCVID] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/win32/iccvid/iccvid.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/iccvid/iccvid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iccvid/iccvid.c?…
============================================================================== --- trunk/reactos/dll/win32/iccvid/iccvid.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iccvid/iccvid.c [iso-8859-1] Sun Jun 5 19:11:42 2016 @@ -95,6 +95,10 @@ return HeapFree( GetProcessHeap(), 0, ptr ); } +static inline int get_stride(int width, int depth) +{ + return ((depth * width + 31) >> 3) & ~3; +} /* ------------------------------------------------------------------------ */ static unsigned char *in_buffer, uiclip[1024], *uiclp = NULL; @@ -463,7 +467,7 @@ break; } - frm_stride = out_width * bpp; + frm_stride = get_stride(out_width, bpp * 8); frm_ptr = output; if(frame.length != size) @@ -848,9 +852,9 @@ if( out ) { memcpy( out, in, size ); + out->bmiHeader.biBitCount = 24; out->bmiHeader.biCompression = BI_RGB; - out->bmiHeader.biSizeImage = in->bmiHeader.biHeight - * in->bmiHeader.biWidth *4; + out->bmiHeader.biSizeImage = get_stride(in->bmiHeader.biWidth, 24) * in->bmiHeader.biHeight; return ICERR_OK; } return size; Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 5 19:11:42 2016 @@ -73,7 +73,7 @@ reactos/dll/win32/hlink # Synced to WineStaging-1.9.4 reactos/dll/win32/hnetcfg # Synced to WineStaging-1.9.11 reactos/dll/win32/httpapi # Synced to WineStaging-1.9.4 -reactos/dll/win32/iccvid # Synced to WineStaging-1.9.4 +reactos/dll/win32/iccvid # Synced to WineStaging-1.9.11 reactos/dll/win32/ieframe # Synced to WineStaging-1.9.4 reactos/dll/win32/imaadp32.acm # Synced to WineStaging-1.9.4 reactos/dll/win32/imagehlp # Synced to WineStaging-1.9.4
8 years, 5 months
1
0
0
0
[akhaldi] 71548: [HNETCFG] Sync with Wine Staging 1.9.11. CORE-11368
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 5 19:10:33 2016 New Revision: 71548 URL:
http://svn.reactos.org/svn/reactos?rev=71548&view=rev
Log: [HNETCFG] Sync with Wine Staging 1.9.11. CORE-11368 Modified: trunk/reactos/dll/win32/hnetcfg/port.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/hnetcfg/port.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/hnetcfg/port.c?r…
============================================================================== --- trunk/reactos/dll/win32/hnetcfg/port.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/hnetcfg/port.c [iso-8859-1] Sun Jun 5 19:10:33 2016 @@ -512,7 +512,7 @@ fw_ports *This = impl_from_INetFwOpenPorts( iface ); FIXME("%p, %p\n", This, port); - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI fw_ports_Remove( Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 5 19:10:33 2016 @@ -71,7 +71,7 @@ reactos/dll/win32/gdiplus # Synced to WineStaging-1.9.11 reactos/dll/win32/hhctrl.ocx # Synced to WineStaging-1.9.4 reactos/dll/win32/hlink # Synced to WineStaging-1.9.4 -reactos/dll/win32/hnetcfg # Synced to WineStaging-1.9.4 +reactos/dll/win32/hnetcfg # Synced to WineStaging-1.9.11 reactos/dll/win32/httpapi # Synced to WineStaging-1.9.4 reactos/dll/win32/iccvid # Synced to WineStaging-1.9.4 reactos/dll/win32/ieframe # Synced to WineStaging-1.9.4
8 years, 5 months
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
23
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Results per page:
10
25
50
100
200