winehq.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
2025
February
January
2024
December
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
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2019
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 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
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
895 discussions
Start a n
N
ew thread
Jacek Caban : vbscript: Store only VBScript this objects in execution context.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: 708c1e865d8938973491fe44fcd25d658e218a71 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=708c1e865d8938973491fe44…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Nov 5 14:09:04 2019 +0100 vbscript: Store only VBScript this objects in execution context. If it's an implicit this, we can handle that in interp_me. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/interp.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index a74c6c320e..211a5af5f8 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -31,7 +31,6 @@ typedef struct { instr_t *instr; script_ctx_t *script; function_t *func; - IDispatch *this_obj; vbdisp_t *vbthis; VARIANT *args; @@ -1446,13 +1445,21 @@ static HRESULT interp_stop(exec_ctx_t *ctx) static HRESULT interp_me(exec_ctx_t *ctx) { + IDispatch *disp; VARIANT v; TRACE("\n"); - IDispatch_AddRef(ctx->this_obj); + if(ctx->vbthis) + disp = (IDispatch*)&ctx->vbthis->IDispatchEx_iface; + else if(ctx->script->host_global) + disp = ctx->script->host_global; + else + disp = (IDispatch*)&ctx->script->script_obj->IDispatchEx_iface; + + IDispatch_AddRef(disp); V_VT(&v) = VT_DISPATCH; - V_DISPATCH(&v) = ctx->this_obj; + V_DISPATCH(&v) = disp; return stack_push(ctx, &v); } @@ -2205,8 +2212,8 @@ static void release_exec(exec_ctx_t *ctx) VariantClear(&ctx->ret_val); release_dynamic_vars(ctx->dynamic_vars); - if(ctx->this_obj) - IDispatch_Release(ctx->this_obj); + if(ctx->vbthis) + IDispatchEx_Release(&ctx->vbthis->IDispatchEx_iface); if(ctx->args) { for(i=0; i < ctx->func->arg_cnt; i++) @@ -2301,14 +2308,9 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd IActiveScriptSite_OnEnterScript(ctx->site); if(vbthis) { - exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface; + IDispatchEx_AddRef(&vbthis->IDispatchEx_iface); exec.vbthis = vbthis; - }else if (ctx->host_global) { - exec.this_obj = ctx->host_global; - }else { - exec.this_obj = (IDispatch*)&ctx->script_obj->IDispatchEx_iface; } - IDispatch_AddRef(exec.this_obj); exec.instr = exec.code->instrs + func->code_off; exec.script = ctx;
1
0
0
0
Jacek Caban : vbscript: Lookup this object in lookup_identifier only if it's an actual VBScript object.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: 3c366be35384790713d9cc5e06ab28dcda5bf50f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3c366be35384790713d9cc5e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Nov 5 14:08:47 2019 +0100 vbscript: Lookup this object in lookup_identifier only if it's an actual VBScript object. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/interp.c | 14 +++++++------- dlls/vbscript/tests/run.c | 6 ++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 4800ae7ce6..a74c6c320e 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -139,14 +139,14 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ return S_OK; } } - } - hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id); - if(SUCCEEDED(hres)) { - ref->type = REF_DISP; - ref->u.d.disp = ctx->this_obj; - ref->u.d.id = id; - return S_OK; + hres = vbdisp_get_id(ctx->vbthis, name, invoke_type, TRUE, &id); + if(SUCCEEDED(hres)) { + ref->type = REF_DISP; + ref->u.d.disp = (IDispatch*)&ctx->vbthis->IDispatchEx_iface; + ref->u.d.id = id; + return S_OK; + } } } diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 9ed1096a4d..707fd89493 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -3025,6 +3025,12 @@ static void run_tests(void) parse_script_a("testOptionalArg 1,,2"); CHECK_CALLED(global_testoptionalarg_i); + parse_script_a("sub x()\n" + " dim y\n" + " y = cint(3)\n" + "end sub\n" + "x\n"); + strict_dispid_check = FALSE; SET_EXPECT(testobj_value_i);
1
0
0
0
Jacek Caban : vbscript: Fix parsing call expressions.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: 509044296dde3688cfdaaf02325a1bc8f890bd85 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=509044296dde3688cfdaaf02…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Nov 5 14:08:35 2019 +0100 vbscript: Fix parsing call expressions. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=41119
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/compile.c | 15 --------------- dlls/vbscript/lex.c | 8 +++++++- dlls/vbscript/parser.y | 22 ++++++++++++++++------ dlls/vbscript/tests/lang.vbs | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 6b0e113bef..e52b0814e0 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -1038,21 +1038,6 @@ static HRESULT compile_call_statement(compile_ctx_t *ctx, call_statement_t *stat { HRESULT hres; - /* It's challenging for parser to distinguish parameterized assignment with one argument from call - * with equality expression argument, so we do it in compiler. */ - if(!stat->is_strict && stat->expr->args && !stat->expr->args->next && stat->expr->args->type == EXPR_EQUAL) { - binary_expression_t *eqexpr = (binary_expression_t*)stat->expr->args; - - if(eqexpr->left->type == EXPR_BRACKETS) { - call_expression_t new_call = *stat->expr; - - WARN("converting call expr to assign expr\n"); - - new_call.args = ((unary_expression_t*)eqexpr->left)->subexpr; - return compile_assignment(ctx, &new_call, eqexpr->right, FALSE); - } - } - hres = compile_call_expression(ctx, stat->expr, FALSE); if(FAILED(hres)) return hres; diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index f78eee4ff9..005e7c3d58 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -409,7 +409,13 @@ static int parse_next_token(void *lval, parser_ctx_t *ctx) ctx->ptr++; return tEMPTYBRACKETS; } - return '('; + /* + * Parser can't predict if bracket is part of argument expression or an argument + * in call expression. We predict it here instead. + */ + if(ctx->last_token == tIdentifier || ctx->last_token == ')') + return '('; + return tEXPRLBRACKET; case '"': return parse_string_literal(ctx, lval); case '&': diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 46af0b16be..9315b7ea39 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -107,7 +107,7 @@ static statement_t *link_statements(statement_t*,statement_t*); double dbl; } -%token tEXPRESSION tEOF tNL tEMPTYBRACKETS +%token tEXPRESSION tEOF tNL tEMPTYBRACKETS tEXPRLBRACKET %token tLTEQ tGTEQ tNEQ %token tSTOP tME tREM tDOT %token <string> tTRUE tFALSE @@ -427,7 +427,7 @@ IntegerValue | tInt { $$ = $1; } PrimaryExpression - : '(' Expression ')' { $$ = new_unary_expression(ctx, EXPR_BRACKETS, $2); } + : tEXPRLBRACKET Expression ')' { $$ = new_unary_expression(ctx, EXPR_BRACKETS, $2); } | tME { $$ = new_expression(ctx, EXPR_ME, 0); CHECK_ERROR; } ClassDeclaration @@ -729,18 +729,28 @@ static call_expression_t *make_call_expression(parser_ctx_t *ctx, expression_t * call_expr = (call_expression_t*)callee_expr; if(!call_expr->args) { call_expr->args = arguments; - }else if(call_expr->args->next) { + return call_expr; + } + + if(call_expr->args->next) { FIXME("Invalid syntax: invalid use of parentheses for arguments\n"); ctx->hres = E_FAIL; return NULL; - }else if(arguments->type != EXPR_NOARG) { + } + + call_expr->args = new_unary_expression(ctx, EXPR_BRACKETS, call_expr->args); + if(!call_expr->args) + return NULL; + if(!arguments) + return call_expr; + + if(arguments->type != EXPR_NOARG) { FIXME("Invalid syntax: missing comma\n"); ctx->hres = E_FAIL; return NULL; - }else { - call_expr->args->next = arguments->next; } + call_expr->args->next = arguments->next; return call_expr; } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 8a6f0ecd45..46e2ac7ab8 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1645,4 +1645,23 @@ end function set x = testsetresult(1, 2) ok x.prop = 1, "x.prop = " & x.prop +set arr(0) = new TestPropSyntax +arr(0).prop = 1 +ok arr(0).prop = 1, "arr(0) = " & arr(0).prop + +function f2(x,y) +end function + +f2 1 = 1, 2 + +function f1(x) + ok x = true, "x = " & x +end function + +f1 1 = 1 +f1 1 = (1) +f1 not 1 = 0 + +arr (0) = 2 xor -2 + reportSuccess()
1
0
0
0
Jacek Caban : vbscript: Support changing script state to SCRIPTSTATE_INITIALIZED.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: 9e2700b2fc04dc4c7cfafc671d820d9ea83d52b1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9e2700b2fc04dc4c7cfafc67…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Nov 5 14:08:22 2019 +0100 vbscript: Support changing script state to SCRIPTSTATE_INITIALIZED. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/tests/vbscript.c | 29 +++++++++++++++++++++++++++++ dlls/vbscript/vbscript.c | 9 ++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/dlls/vbscript/tests/vbscript.c b/dlls/vbscript/tests/vbscript.c index fd769cc280..c0a582c361 100644 --- a/dlls/vbscript/tests/vbscript.c +++ b/dlls/vbscript/tests/vbscript.c @@ -796,6 +796,35 @@ static void test_vbscript_uninitializing(void) test_state(script, SCRIPTSTATE_INITIALIZED); + SET_EXPECT(OnStateChange_STARTED); + hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_UNINITIALIZED) failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_STARTED); + + SET_EXPECT(OnStateChange_INITIALIZED); + hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_UNINITIALIZED) failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_INITIALIZED); + + hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_UNINITIALIZED) failed: %08x\n", hres); + + SET_EXPECT(OnStateChange_CLOSED); + hres = IActiveScript_Close(script); + ok(hres == S_OK, "Close failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_CLOSED); + + test_state(script, SCRIPTSTATE_CLOSED); + + SET_EXPECT(GetLCID); + SET_EXPECT(OnStateChange_INITIALIZED); + hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite); + ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres); + CHECK_CALLED(GetLCID); + CHECK_CALLED(OnStateChange_INITIALIZED); + + test_state(script, SCRIPTSTATE_INITIALIZED); + SET_EXPECT(OnStateChange_CLOSED); hres = IActiveScript_Close(script); ok(hres == S_OK, "Close failed: %08x\n", hres); diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index ebd100f4e5..886c9d01af 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -207,14 +207,13 @@ static void decrease_state(VBScript *This, SCRIPTSTATE state) /* FALLTHROUGH */ case SCRIPTSTATE_STARTED: case SCRIPTSTATE_DISCONNECTED: - if(This->state == SCRIPTSTATE_DISCONNECTED) - change_state(This, SCRIPTSTATE_INITIALIZED); - if(state == SCRIPTSTATE_INITIALIZED) - break; + change_state(This, SCRIPTSTATE_INITIALIZED); /* FALLTHROUGH */ case SCRIPTSTATE_INITIALIZED: case SCRIPTSTATE_UNINITIALIZED: change_state(This, state); + if(state == SCRIPTSTATE_INITIALIZED) + break; release_script(This->ctx); This->thread_id = 0; break; @@ -469,7 +468,7 @@ static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE exec_queued_code(This->ctx); break; case SCRIPTSTATE_INITIALIZED: - FIXME("unimplemented SCRIPTSTATE_INITIALIZED\n"); + decrease_state(This, SCRIPTSTATE_INITIALIZED); return S_OK; case SCRIPTSTATE_DISCONNECTED: FIXME("unimplemented SCRIPTSTATE_DISCONNECTED\n");
1
0
0
0
Jacek Caban : vbscript: Don't allow changing script state when script site is not set.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: 706898dcbb5d1553a3e9f60c422f9112fad57694 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=706898dcbb5d1553a3e9f60c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Nov 5 14:08:09 2019 +0100 vbscript: Don't allow changing script state when script site is not set. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/tests/vbscript.c | 5 +++++ dlls/vbscript/vbscript.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/tests/vbscript.c b/dlls/vbscript/tests/vbscript.c index fdbfc4465b..fd769cc280 100644 --- a/dlls/vbscript/tests/vbscript.c +++ b/dlls/vbscript/tests/vbscript.c @@ -713,6 +713,11 @@ static void test_vbscript_uninitializing(void) test_no_script_dispatch(script); + hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED); + ok(hres == E_UNEXPECTED, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres); + hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_INITIALIZED); + ok(hres == E_UNEXPECTED, "SetScriptState(SCRIPTSTATE_INITIALIZED) failed: %08x\n", hres); + SET_EXPECT(GetLCID); SET_EXPECT(OnStateChange_INITIALIZED); hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite); diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index 59ec577846..ebd100f4e5 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -457,7 +457,7 @@ static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE return S_OK; } - if(!This->is_initialized) + if(!This->is_initialized || !This->ctx->site) return E_UNEXPECTED; switch(ss) {
1
0
0
0
Jacek Caban : vbscript: Add Replace function implementation.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: e343fcaf7656eb0ca0b648d8aa159ab2f6007785 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e343fcaf7656eb0ca0b648d8…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Nov 5 14:07:58 2019 +0100 vbscript: Add Replace function implementation. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/vbscript/global.c | 76 +++++++++++++++++++++++++++++++++++++++++++-- dlls/vbscript/tests/api.vbs | 68 +++++++++++++++++++++++++++++++++++++--- dlls/vbscript/vbregexp.c | 42 +++++++++++++++++++++++++ dlls/vbscript/vbscript.h | 1 + 4 files changed, 179 insertions(+), 8 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index e4ff572412..8d4150ad70 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -2278,10 +2278,80 @@ static HRESULT Global_Split(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, return E_NOTIMPL; } -static HRESULT Global_Replace(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Replace(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + BSTR string, find = NULL, replace = NULL, ret; + int from = 1, cnt = -1; + HRESULT hres = S_OK; + + TRACE("%s %s %s %u...\n", debugstr_variant(args), debugstr_variant(args+1), debugstr_variant(args+2), args_cnt); + + assert(3 <= args_cnt && args_cnt <= 6); + if(V_VT(args) != VT_BSTR) { + hres = to_string(args, &string); + if(FAILED(hres)) + return hres; + }else { + string = V_BSTR(args); + } + + if(V_VT(args+1) != VT_BSTR) { + hres = to_string(args+1, &find); + if(FAILED(hres)) + goto error; + }else { + find = V_BSTR(args+1); + } + + if(V_VT(args+2) != VT_BSTR) { + hres = to_string(args+2, &replace); + if(FAILED(hres)) + goto error; + }else { + replace = V_BSTR(args+2); + } + + if(args_cnt >= 4) { + hres = to_int(args+3, &from); + if(FAILED(hres)) + goto error; + if(from < 1) { + hres = E_INVALIDARG; + goto error; + } + } + + if(args_cnt >= 5) { + hres = to_int(args+4, &cnt); + if(FAILED(hres)) + goto error; + if(cnt < -1) { + hres = E_INVALIDARG; + goto error; + } + } + + if(args_cnt == 6) + FIXME("copare argument not supported\n"); + + ret = string_replace(string, find, replace, from - 1, cnt); + if(!ret) { + hres = E_OUTOFMEMORY; + }else if(res) { + V_VT(res) = VT_BSTR; + V_BSTR(res) = ret; + }else { + SysFreeString(ret); + } + +error: + if(V_VT(args) != VT_BSTR) + SysFreeString(string); + if(V_VT(args+1) != VT_BSTR) + SysFreeString(find); + if(V_VT(args+2) != VT_BSTR) + SysFreeString(replace); + return hres; } static HRESULT Global_StrReverse(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index d4f3eeaa47..0a65984483 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -640,11 +640,6 @@ TestLTrim "", "" TestLTrim 123, "123" if isEnglishLang then TestLTrim true, "True" -Sub TestRound(val, exval, vt) - Call ok(Round(val) = exval, "Round(" & val & ") = " & Round(val)) - Call ok(getVT(Round(val)) = vt, "getVT(Round(" & val & ")) = " & getVT(Round(val))) -End Sub - Sub TestRTrim(str, exstr) Call ok(RTrim(str) = exstr, "RTrim(" & str & ") = " & RTrim(str)) End Sub @@ -657,6 +652,69 @@ TestRTrim "", "" TestRTrim 123, "123" if isEnglishLang then TestRTrim true, "True" +sub test_replace(str, find, rep, exp) + dim r + r = Replace(str, find, rep) + ok r = exp, "Replace(""" & str & """, """ & find & """, """ & rep & """) = """ & _ + r & """ expected """ & exp & """" +end sub + +sub test_replace_from(str, find, rep, from, exp) + dim r + r = Replace(str, find, rep, from) + ok r = exp, "Replace(""" & str & """, """ & find & """, """ & rep & """, " & from & ") = """ & _ + r & """ expected """ & exp & """" +end sub + +sub test_replace_cnt(str, find, rep, from, cnt, exp) + dim r + r = Replace(str, find, rep, from, cnt) + ok r = exp, "Replace(""" & str & """, """ & find & """, """ & rep & """, " & from & ", " & cnt & ") = """ & _ + r & """ expected """ & exp & """" +end sub + +test_replace "xx testxx(xx)", "xx", "!", "! test!(!)" +test_replace "xxx", "", "y", "xxx" +test_replace "xxxxx", "xx", "y", "yyx" +test_replace 123, 2, 6, "163" +test_replace "xyz" & Chr(0) & "xyz", "y", "Y", "xYz" & Chr(0) & "xYz" +test_replace "xyz" & Chr(0) & "xyz", Chr(0) & "x", "Y" & Chr(0) & Chr(0), "xyzY" & Chr(0) & Chr(0) & "yz" + +test_replace_from "xx testxx(xx)", "xx", "!", 1, "! test!(!)" +test_replace_from "xx testxx(xx)", "xx", "!", 1, "! test!(!)" +test_replace_from "xx testxx(xx)", "xx", "!", 2, "x test!(!)" +test_replace_from "xx testxx(xx)", "xx", "!", 2000, "" +test_replace_from "xxx", "", "y", 2, "xx" + +test_replace_cnt "xx testxx(xx)", "xx", "!", 1, 2, "! test!(xx)" +test_replace_cnt "xx testxx(xx)", "xx", "!", 1, 1, "! testxx(xx)" +test_replace_cnt "xx testxx(xx)", "xx", "!", 2, 1, "x test!(xx)" +test_replace_cnt "xx testxx(xx)", "xx", "!", 1, -1, "! test!(!)" +test_replace_cnt "xx testxx(xx)", "xx", "!", 1, 0, "xx testxx(xx)" + +on error resume next +Replace "xx", "x", "y", -1 +x = err.number +on error goto 0 +ok x = 5, "err = " & x + +on error resume next +Replace "xx", "x", "y", 0 +x = err.number +on error goto 0 +ok x = 5, "err = " & x + +on error resume next +Replace "xx", "x", "y", 1, -2 +x = err.number +on error goto 0 +ok x = 5, "err = " & x + +Sub TestRound(val, exval, vt) + Call ok(Round(val) = exval, "Round(" & val & ") = " & Round(val)) + Call ok(getVT(Round(val)) = vt, "getVT(Round(" & val & ")) = " & getVT(Round(val))) +End Sub + TestRound 3, 3, "VT_I2" TestRound 3.3, 3, "VT_R8" TestRound 3.8, 4, "VT_R8" diff --git a/dlls/vbscript/vbregexp.c b/dlls/vbscript/vbregexp.c index 4edf9dcbfe..ac667da442 100644 --- a/dlls/vbscript/vbregexp.c +++ b/dlls/vbscript/vbregexp.c @@ -1629,6 +1629,48 @@ static const IRegExp2Vtbl RegExp2Vtbl = { RegExp2_Replace }; +BSTR string_replace(BSTR string, BSTR find, BSTR replace, int from, int cnt) +{ + const WCHAR *ptr, *string_end; + strbuf_t buf = { NULL, 0, 0 }; + size_t replace_len, find_len; + BSTR ret = NULL; + HRESULT hres = S_OK; + + string_end = string + SysStringLen(string); + ptr = from > SysStringLen(string) ? string_end : string + from; + + find_len = SysStringLen(find); + replace_len = SysStringLen(replace); + if(!replace_len) + cnt = 0; + + while(string_end - ptr >= find_len && cnt && find_len) { + if(memcmp(ptr, find, find_len * sizeof(WCHAR))) { + hres = strbuf_append(&buf, ptr, 1); + if(FAILED(hres)) + break; + ptr++; + }else { + hres = strbuf_append(&buf, replace, replace_len); + if(FAILED(hres)) + break; + ptr += find_len; + if(cnt != -1) + cnt--; + } + } + + if(SUCCEEDED(hres)) { + hres = strbuf_append(&buf, ptr, string_end - ptr); + if(SUCCEEDED(hres)) + ret = SysAllocStringLen(buf.buf, buf.len); + } + + heap_free(buf.buf); + return ret; +} + static inline RegExp2 *impl_from_IRegExp(IRegExp *iface) { return CONTAINING_RECORD(iface, RegExp2, IRegExp_iface); diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 8543813c49..0bd1fce156 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -373,6 +373,7 @@ static inline BOOL is_int32(double d) } HRESULT create_regexp(IDispatch**) DECLSPEC_HIDDEN; +BSTR string_replace(BSTR,BSTR,BSTR,int,int) DECLSPEC_HIDDEN; HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN;
1
0
0
0
Nikolay Sivov : msxml3: Remove "stub" from traces.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: be89f936877a3218e5361c2c1efec761045a98ea URL:
https://source.winehq.org/git/wine.git/?a=commit;h=be89f936877a3218e5361c2c…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 5 14:34:18 2019 +0300 msxml3: Remove "stub" from traces. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msxml3/parseerror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/msxml3/parseerror.c b/dlls/msxml3/parseerror.c index 438c9eb3c4..2ca0885708 100644 --- a/dlls/msxml3/parseerror.c +++ b/dlls/msxml3/parseerror.c @@ -224,7 +224,7 @@ static HRESULT WINAPI parseError_get_line( { parse_error_t *This = impl_from_IXMLDOMParseError2( iface ); - TRACE("(%p)->(%p): stub\n", This, line); + TRACE("%p, %p.\n", This, line); if (!line) return E_INVALIDARG;
1
0
0
0
Nikolay Sivov : ole32: Remove "stub" from traces.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: 4fe18052c552268c1a5c5e8de7c9ac654436a4f7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4fe18052c552268c1a5c5e8d…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 5 14:34:08 2019 +0300 ole32: Remove "stub" from traces. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/classmoniker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index 3837a1f74c..07d55e2f94 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -142,7 +142,7 @@ static ULONG WINAPI ClassMoniker_Release(IMoniker* iface) ******************************************************************************/ static HRESULT WINAPI ClassMoniker_GetClassID(IMoniker* iface,CLSID *pClassID) { - TRACE("(%p,%p),stub!\n",iface,pClassID); + TRACE("(%p, %p)\n", iface, pClassID); if (pClassID==NULL) return E_POINTER;
1
0
0
0
Nikolay Sivov : shell32: Remove "stub" from traces.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: 539644ad63702a71080427a2be3359d6f081019c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=539644ad63702a71080427a2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 5 14:33:47 2019 +0300 shell32: Remove "stub" from traces. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/shell32/pidl.c | 4 ++-- dlls/shell32/shellstring.c | 2 +- dlls/shell32/shlview.c | 19 +++++++------------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 54fb818526..e2746deb48 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -1105,7 +1105,7 @@ HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR filename, shortname; WIN32_FIND_DATAA * pfd; - TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); + TRACE_(shell)("%p, %p, %d, %p, %d.\n", psf, pidl, nFormat, dest, len); pdump(pidl); if (!psf || !dest) @@ -1163,7 +1163,7 @@ HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR filename, shortname; WIN32_FIND_DATAW * pfd = dest; - TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); + TRACE_(shell)("%p, %p, %d, %p, %d.\n", psf, pidl, nFormat, dest, len); pdump(pidl); diff --git a/dlls/shell32/shellstring.c b/dlls/shell32/shellstring.c index 956fd50871..3b70a2a94b 100644 --- a/dlls/shell32/shellstring.c +++ b/dlls/shell32/shellstring.c @@ -269,7 +269,7 @@ DWORD WINAPI CheckEscapesW( DWORD size = lstrlenW(string); LPWSTR s, d; - TRACE("(%s %d) stub\n", debugstr_w(string), len); + TRACE("%s, %u.\n", debugstr_w(string), len); if (StrPBrkW(string, strEscapedChars) && size + 2 <= len) { diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index bcb9466315..ff1332087d 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -778,13 +778,9 @@ static HMENU ShellView_BuildFileMenu(IShellViewImpl * This) TRACE("-- return (menu=%p)\n",hSubMenu); return hSubMenu; } -/********************************************************** -* ShellView_MergeFileMenu() -*/ + static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu) { - TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu); - if (hSubMenu) { static const WCHAR dummyW[] = {'d','u','m','m','y','4','5',0}; @@ -806,8 +802,6 @@ static void ShellView_MergeFileMenu(IShellViewImpl *This, HMENU hSubMenu) mii.fType = MFT_STRING; InsertMenuItemW(hSubMenu, 0, TRUE, &mii); } - - TRACE("--\n"); } /********************************************************** @@ -989,7 +983,7 @@ static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL LPCONTEXTMENU pContextMenu = NULL; CMINVOKECOMMANDINFO cmi; - TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault); + TRACE("%p, %d, %d, %d.\n", This, x, y, bDefault); /* look, what's selected and create a context menu object of it*/ if( ShellView_GetSelections(This) ) @@ -1230,7 +1224,7 @@ static LRESULT ShellView_OnSetFocus(IShellViewImpl * This) */ static LRESULT ShellView_OnKillFocus(IShellViewImpl * This) { - TRACE("(%p) stub\n",This); + TRACE("%p.\n", This); ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS); /* Notify the ICommDlgBrowser */ @@ -1870,7 +1864,7 @@ static HRESULT WINAPI IShellView_fnUIActivate(IShellView3 *iface, UINT uState) LRESULT lResult; int nPartArray[1] = {-1}; - TRACE("(%p)->(state=%x) stub\n",This, uState); + TRACE("%p, %d.\n", This, uState); /*don't do anything if the state isn't really changing*/ if(This->uState == uState) @@ -2677,7 +2671,7 @@ static ULONG WINAPI FolderView_Release(IFolderView2 *iface) static HRESULT WINAPI FolderView_GetCurrentViewMode(IFolderView2 *iface, UINT *mode) { IShellViewImpl *This = impl_from_IFolderView2(iface); - TRACE("(%p)->(%p), stub\n", This, mode); + TRACE("%p, %p.\n", This, mode); if(!mode) return E_INVALIDARG; @@ -2690,7 +2684,8 @@ static HRESULT WINAPI FolderView_SetCurrentViewMode(IFolderView2 *iface, UINT mo { IShellViewImpl *This = impl_from_IFolderView2(iface); DWORD dwStyle; - TRACE("(%p)->(%u), stub\n", This, mode); + + TRACE("%p, %u.\n", This, mode); if((mode < FVM_FIRST || mode > FVM_LAST) && (mode != FVM_AUTO))
1
0
0
0
Nikolay Sivov : ole32/tests: Remove Win9x workarounds from moniker tests.
by Alexandre Julliard
05 Nov '19
05 Nov '19
Module: wine Branch: master Commit: ef1e187ae214a73d75975bf9ed5c45f803c18ead URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ef1e187ae214a73d75975bf9…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 5 14:33:30 2019 +0300 ole32/tests: Remove Win9x workarounds from moniker tests. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ole32/tests/moniker.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 18ea4d465b..9e2c23b421 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -708,11 +708,8 @@ static void test_ROT(void) ROTFLAGS_REGISTRATIONKEEPSALIVE|ROTFLAGS_ALLOWANYCLIENT, (IUnknown*)&Test_ClassFactory, pMoniker, &dwCookie); todo_wine { - ok(hr == CO_E_WRONG_SERVER_IDENTITY || - broken(hr == S_OK) /* Win9x */, - "IRunningObjectTable_Register should have returned CO_E_WRONG_SERVER_IDENTITY instead of 0x%08x\n", hr); + ok(hr == CO_E_WRONG_SERVER_IDENTITY, "Unexpected hr %#x.\n", hr); } - if (hr == S_OK) IRunningObjectTable_Revoke(pROT, dwCookie); hr = IRunningObjectTable_Register(pROT, 0xdeadbeef, (IUnknown*)&Test_ClassFactory, pMoniker, &dwCookie); @@ -919,8 +916,8 @@ static void test_MkParseDisplayName(void) eaten = 0xdeadbeef; pmk = (IMoniker *)0xdeadbeef; hr = MkParseDisplayName(pbc, wszNonExistentProgId, &eaten, &pmk); - ok(hr == MK_E_SYNTAX || hr == MK_E_CANTOPENFILE /* Win9x */, - "MkParseDisplayName should have failed with MK_E_SYNTAX or MK_E_CANTOPENFILE instead of 0x%08x\n", hr); +todo_wine + ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr); ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten); ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk); @@ -929,8 +926,8 @@ static void test_MkParseDisplayName(void) eaten = 0xdeadbeef; pmk = (IMoniker *)0xdeadbeef; hr = MkParseDisplayName(pbc, wszDisplayNameClsid, &eaten, &pmk); - ok(hr == MK_E_SYNTAX || hr == MK_E_CANTOPENFILE /* Win9x */, - "MkParseDisplayName should have failed with MK_E_SYNTAX or MK_E_CANTOPENFILE instead of 0x%08x\n", hr); +todo_wine + ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr); ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten); ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk); @@ -1009,8 +1006,8 @@ static void test_MkParseDisplayName(void) eaten = 0xdeadbeef; pmk = (IMoniker *)0xdeadbeef; hr = MkParseDisplayName(pbc, wszDisplayNameProgIdFail, &eaten, &pmk); - ok(hr == MK_E_SYNTAX || hr == MK_E_CANTOPENFILE /* Win9x */, - "MkParseDisplayName with ProgId without marker should fail with MK_E_SYNTAX or MK_E_CANTOPENFILE instead of 0x%08x\n", hr); +todo_wine + ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr); ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten); ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk); @@ -2054,11 +2051,6 @@ static void test_save_load_filemoniker(void) START_TEST(moniker) { - if (!GetProcAddress(GetModuleHandleA("ole32.dll"), "CoRegisterSurrogateEx")) { - win_skip("skipping test on win9x\n"); - return; - } - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); test_ROT();
1
0
0
0
← Newer
1
...
77
78
79
80
81
82
83
...
90
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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Results per page:
10
25
50
100
200