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
September 2012
----- 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
2 participants
828 discussions
Start a n
N
ew thread
Piotr Caban : msvcrt: Fixed strncpy_s behavior when count equals 0.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: bdf9a9f9bd56354f70a7431a9682183b84353211 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bdf9a9f9bd56354f70a7431a9…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 7 16:58:23 2012 +0200 msvcrt: Fixed strncpy_s behavior when count equals 0. --- dlls/msvcrt/heap.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/dlls/msvcrt/heap.c b/dlls/msvcrt/heap.c index 5eaf4a1..0a0d819 100644 --- a/dlls/msvcrt/heap.c +++ b/dlls/msvcrt/heap.c @@ -598,8 +598,11 @@ int CDECL strncpy_s(char *dest, MSVCRT_size_t numberOfElements, TRACE("(%s %lu %s %lu)\n", dest, numberOfElements, src, count); - if(!count) + if(!count) { + if(dest && numberOfElements) + *dest = 0; return 0; + } if (!MSVCRT_CHECK_PMT(dest != NULL)) return MSVCRT_EINVAL; if (!MSVCRT_CHECK_PMT(src != NULL)) return MSVCRT_EINVAL;
1
0
0
0
Jacek Caban : jscript: Be more verbose about parser failure.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 42d75be69d9fef4f59153337e8af2f85d7b30d34 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=42d75be69d9fef4f59153337e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 7 17:14:13 2012 +0200 jscript: Be more verbose about parser failure. --- dlls/jscript/parser.y | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index d108ab0..4c69ed9 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -21,6 +21,10 @@ #include "jscript.h" #include "engine.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + #define YYLEX_PARAM ctx #define YYPARSE_PARAM ctx @@ -1516,6 +1520,8 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite jsheap_clear(mark); hres = parser_ctx->hres; if(FAILED(hres)) { + WARN("parser failed around %s\n", + debugstr_w(parser_ctx->begin+20 > parser_ctx->ptr ? parser_ctx->begin : parser_ctx->ptr-20)); parser_release(parser_ctx); return hres; }
1
0
0
0
Jacek Caban : vbscript: Added ScriptDisp tests.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: c2dbc6bfaabefea0c6382001cae88da9a5219a7a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c2dbc6bfaabefea0c6382001c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 7 15:10:38 2012 +0200 vbscript: Added ScriptDisp tests. --- dlls/vbscript/tests/vbscript.c | 152 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 152 insertions(+), 0 deletions(-) diff --git a/dlls/vbscript/tests/vbscript.c b/dlls/vbscript/tests/vbscript.c index fe53854..ec53712 100644 --- a/dlls/vbscript/tests/vbscript.c +++ b/dlls/vbscript/tests/vbscript.c @@ -85,6 +85,18 @@ DEFINE_EXPECT(OnLeaveScript); DEFINE_GUID(CLSID_VBScript, 0xb54f3741, 0x5b07, 0x11cf, 0xa4,0xb0, 0x00,0xaa,0x00,0x4a,0x55,0xe8); +static BSTR a2bstr(const char *str) +{ + BSTR ret; + int len; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = SysAllocStringLen(NULL, len-1); + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + + return ret; +} + #define test_state(s,ss) _test_state(__LINE__,s,ss) static void _test_state(unsigned line, IActiveScript *script, SCRIPTSTATE exstate) { @@ -318,6 +330,35 @@ static IDispatchEx *get_script_dispatch(IActiveScript *script) return dispex; } +static void parse_script(IActiveScriptParse *parse, const char *src) +{ + BSTR str; + HRESULT hres; + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + + str = a2bstr(src); + hres = IActiveScriptParse_ParseScriptText(parse, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + SysFreeString(str); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); +} + +#define get_disp_id(a,b,c,d) _get_disp_id(__LINE__,a,b,c,d) +static void _get_disp_id(unsigned line, IDispatchEx *dispex, const char *name, HRESULT exhres, DISPID *id) +{ + BSTR str; + HRESULT hres; + + str = a2bstr(name); + hres = IDispatchEx_GetDispID(dispex, str, 0, id); + SysFreeString(str); + ok_(__FILE__,line)(hres == exhres, "GetDispID(%s) returned %08x, expected %08x\n", name, hres, exhres); +} + static void test_no_script_dispatch(IActiveScript *script) { IDispatch *disp; @@ -341,6 +382,116 @@ static IActiveScript *create_vbscript(void) return ret; } +static void test_scriptdisp(void) +{ + IActiveScriptParse *parser; + IDispatchEx *script_disp; + IActiveScript *vbscript; + DISPID id, id2; + DISPPARAMS dp; + EXCEPINFO ei; + VARIANT v; + ULONG ref; + HRESULT hres; + + vbscript = create_vbscript(); + + hres = IActiveScript_QueryInterface(vbscript, &IID_IActiveScriptParse, (void**)&parser); + ok(hres == S_OK, "Could not get IActiveScriptParse iface: %08x\n", hres); + + test_state(vbscript, SCRIPTSTATE_UNINITIALIZED); + test_safety(vbscript); + + SET_EXPECT(GetLCID); + hres = IActiveScript_SetScriptSite(vbscript, &ActiveScriptSite); + ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres); + CHECK_CALLED(GetLCID); + + test_state(vbscript, SCRIPTSTATE_UNINITIALIZED); + + SET_EXPECT(OnStateChange_INITIALIZED); + hres = IActiveScriptParse_InitNew(parser); + ok(hres == S_OK, "InitNew failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_INITIALIZED); + + test_state(vbscript, SCRIPTSTATE_INITIALIZED); + + SET_EXPECT(OnStateChange_CONNECTED); + hres = IActiveScript_SetScriptState(vbscript, SCRIPTSTATE_CONNECTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_CONNECTED) failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_CONNECTED); + + test_state(vbscript, SCRIPTSTATE_CONNECTED); + + script_disp = get_script_dispatch(vbscript); + + id = 100; + get_disp_id(script_disp, "LCase", DISP_E_UNKNOWNNAME, &id); + ok(id == -1, "id = %d, expected -1\n", id); + + get_disp_id(script_disp, "globalVariable", DISP_E_UNKNOWNNAME, &id); + parse_script(parser, "dim globalVariable\nglobalVariable = 3"); + get_disp_id(script_disp, "globalVariable", S_OK, &id); + + memset(&dp, 0, sizeof(dp)); + memset(&ei, 0, sizeof(ei)); + V_VT(&v) = VT_EMPTY; + hres = IDispatchEx_InvokeEx(script_disp, id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &v, &ei, NULL); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + ok(V_VT(&v) == VT_I2, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_I2(&v) == 3, "V_I2(v) = %d\n", V_I2(&v)); + + get_disp_id(script_disp, "globalVariable2", DISP_E_UNKNOWNNAME, &id); + parse_script(parser, "globalVariable2 = 4"); + get_disp_id(script_disp, "globalVariable2", S_OK, &id); + + get_disp_id(script_disp, "globalFunction", DISP_E_UNKNOWNNAME, &id); + parse_script(parser, "function globalFunction()\nglobalFunction=5\nend function"); + get_disp_id(script_disp, "globalFunction", S_OK, &id); + + SET_EXPECT(OnEnterScript); + SET_EXPECT(OnLeaveScript); + + memset(&dp, 0, sizeof(dp)); + memset(&ei, 0, sizeof(ei)); + V_VT(&v) = VT_EMPTY; + hres = IDispatchEx_InvokeEx(script_disp, id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &v, &ei, NULL); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + ok(V_VT(&v) == VT_I2, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_I2(&v) == 5, "V_I2(v) = %d\n", V_I2(&v)); + + CHECK_CALLED(OnEnterScript); + CHECK_CALLED(OnLeaveScript); + + get_disp_id(script_disp, "globalSub", DISP_E_UNKNOWNNAME, &id); + parse_script(parser, "sub globalSub()\nend sub"); + get_disp_id(script_disp, "globalSub", S_OK, &id); + get_disp_id(script_disp, "globalSub", S_OK, &id2); + ok(id == id2, "id != id2\n"); + + get_disp_id(script_disp, "constVariable", DISP_E_UNKNOWNNAME, &id); + parse_script(parser, "const constVariable = 6"); + get_disp_id(script_disp, "ConstVariable", S_OK, &id); + get_disp_id(script_disp, "Constvariable", S_OK, &id2); + ok(id == id2, "id != id2\n"); + + IDispatchEx_Release(script_disp); + + IActiveScriptParse_Release(parser); + + SET_EXPECT(OnStateChange_DISCONNECTED); + SET_EXPECT(OnStateChange_INITIALIZED); + SET_EXPECT(OnStateChange_CLOSED); + hres = IActiveScript_Close(vbscript); + ok(hres == S_OK, "Close failed: %08x\n", hres); + CHECK_CALLED(OnStateChange_DISCONNECTED); + CHECK_CALLED(OnStateChange_INITIALIZED); + CHECK_CALLED(OnStateChange_CLOSED); + + ref = IActiveScript_Release(vbscript); + ok(!ref, "ref = %d\n", ref); +} + static void test_vbscript(void) { IActiveScriptParseProcedure2 *parse_proc; @@ -644,6 +795,7 @@ START_TEST(vbscript) test_vbscript_release(); test_vbscript_simplecreate(); test_vbscript_initializing(); + test_scriptdisp(); }else { win_skip("VBScript engine not available\n"); }
1
0
0
0
Jacek Caban : vbscript: Added ScriptDisp::InvokeEx implementation.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 11d2dfaea9eb99c3bebfbb47658742de892e28f3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=11d2dfaea9eb99c3bebfbb476…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 7 15:10:17 2012 +0200 vbscript: Added ScriptDisp::InvokeEx implementation. --- dlls/vbscript/vbdisp.c | 33 ++++++++++++++++++++++++++++++--- 1 files changed, 30 insertions(+), 3 deletions(-) diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 4f473e2..a76660e 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -97,7 +97,7 @@ static VARIANT *get_propput_arg(const DISPPARAMS *dp) return NULL; } -static HRESULT invoke_variant_prop(vbdisp_t *This, VARIANT *v, WORD flags, DISPPARAMS *dp, VARIANT *res) +static HRESULT invoke_variant_prop(VARIANT *v, WORD flags, DISPPARAMS *dp, VARIANT *res) { HRESULT hres; @@ -403,7 +403,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc } if(id < This->desc->prop_cnt + This->desc->func_cnt) - return invoke_variant_prop(This, This->props+(id-This->desc->func_cnt), wFlags, pdp, pvarRes); + return invoke_variant_prop(This->props+(id-This->desc->func_cnt), wFlags, pdp, pvarRes); if(This->desc->builtin_prop_cnt) { unsigned min = 0, max = This->desc->builtin_prop_cnt-1, i; @@ -579,6 +579,11 @@ static inline DISPID ident_to_id(ScriptDisp *This, ident_map_t *ident) return (ident-This->ident_map)+1; } +static inline ident_map_t *id_to_ident(ScriptDisp *This, DISPID id) +{ + return 0 < id && id <= This->ident_map_cnt ? This->ident_map+id-1 : NULL; +} + static ident_map_t *add_ident(ScriptDisp *This, const WCHAR *name) { ident_map_t *ret; @@ -748,8 +753,30 @@ static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + ident_map_t *ident; + HRESULT hres; + TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - return DISP_E_MEMBERNOTFOUND; + + ident = id_to_ident(This, id); + if(!ident) + return DISP_E_MEMBERNOTFOUND; + + if(ident->is_var) { + if(ident->u.var->is_const) { + FIXME("const not supported\n"); + return E_NOTIMPL; + } + + return invoke_variant_prop(&ident->u.var->v, wFlags, pdp, pvarRes); + } + + + IActiveScriptSite_OnEnterScript(This->ctx->site); + hres = exec_script(This->ctx, ident->u.func, NULL, pdp, pvarRes); + IActiveScriptSite_OnLeaveScript(This->ctx->site); + + return hres; } static HRESULT WINAPI ScriptDisp_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
1
0
0
0
Jacek Caban : vbscript: Added ScriptDisp::GetDispID implementation.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 40001df45db90b70710b9fec7fad419322301ad3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=40001df45db90b70710b9fec7…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 7 15:09:59 2012 +0200 vbscript: Added ScriptDisp::GetDispID implementation. --- dlls/vbscript/vbdisp.c | 85 ++++++++++++++++++++++++++++++++++++++++++++- dlls/vbscript/vbscript.h | 7 ++++ 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index b7945d8..4f473e2 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -565,6 +565,44 @@ HRESULT create_procedure_disp(script_ctx_t *ctx, vbscode_t *code, IDispatch **re return S_OK; } +struct _ident_map_t { + const WCHAR *name; + BOOL is_var; + union { + dynamic_var_t *var; + function_t *func; + } u; +}; + +static inline DISPID ident_to_id(ScriptDisp *This, ident_map_t *ident) +{ + return (ident-This->ident_map)+1; +} + +static ident_map_t *add_ident(ScriptDisp *This, const WCHAR *name) +{ + ident_map_t *ret; + + if(!This->ident_map_size) { + This->ident_map = heap_alloc(4 * sizeof(*This->ident_map)); + if(!This->ident_map) + return NULL; + This->ident_map_size = 4; + }else if(This->ident_map_cnt == This->ident_map_size) { + ident_map_t *new_map; + + new_map = heap_realloc(This->ident_map, 2*This->ident_map_size*sizeof(*new_map)); + if(!new_map) + return NULL; + This->ident_map = new_map; + This->ident_map_size *= 2; + } + + ret = This->ident_map + This->ident_map_cnt++; + ret->name = name; + return ret; +} + static inline ScriptDisp *ScriptDisp_from_IDispatchEx(IDispatchEx *iface) { return CONTAINING_RECORD(iface, ScriptDisp, IDispatchEx_iface); @@ -612,6 +650,7 @@ static ULONG WINAPI ScriptDisp_Release(IDispatchEx *iface) if(!ref) { assert(!This->ctx); + heap_free(This->ident_map); heap_free(This); } @@ -659,7 +698,49 @@ static HRESULT WINAPI ScriptDisp_Invoke(IDispatchEx *iface, DISPID dispIdMember, static HRESULT WINAPI ScriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); - FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); + dynamic_var_t *var; + ident_map_t *ident; + function_t *func; + + TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); + + if(!This->ctx) + return E_UNEXPECTED; + + for(ident = This->ident_map; ident < This->ident_map+This->ident_map_cnt; ident++) { + if(!strcmpiW(ident->name, bstrName)) { + *pid = ident_to_id(This, ident); + return S_OK; + } + } + + for(var = This->ctx->global_vars; var; var = var->next) { + if(!strcmpiW(var->name, bstrName)) { + ident = add_ident(This, var->name); + if(!ident) + return E_OUTOFMEMORY; + + ident->is_var = TRUE; + ident->u.var = var; + *pid = ident_to_id(This, ident); + return S_OK; + } + } + + for(func = This->ctx->global_funcs; func; func = func->next) { + if(!strcmpiW(func->name, bstrName)) { + ident = add_ident(This, func->name); + if(!ident) + return E_OUTOFMEMORY; + + ident->is_var = FALSE; + ident->u.func = func; + *pid = ident_to_id(This, ident); + return S_OK; + } + } + + *pid = -1; return DISP_E_UNKNOWNNAME; } @@ -735,7 +816,7 @@ HRESULT create_script_disp(script_ctx_t *ctx, ScriptDisp **ret) { ScriptDisp *script_disp; - script_disp = heap_alloc(sizeof(*script_disp)); + script_disp = heap_alloc_zero(sizeof(*script_disp)); if(!script_disp) return E_OUTOFMEMORY; diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 306cfed..77cf0e7 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -116,9 +116,16 @@ struct _vbdisp_t { VARIANT props[1]; }; +typedef struct _ident_map_t ident_map_t; + typedef struct { IDispatchEx IDispatchEx_iface; LONG ref; + + ident_map_t *ident_map; + unsigned ident_map_cnt; + unsigned ident_map_size; + script_ctx_t *ctx; } ScriptDisp;
1
0
0
0
Jacek Caban : vbscript: Use separated IDispatchEx implementation for script dispatch.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 8121f73273d475a9b5961763a66d398fa6640aa1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8121f73273d475a9b5961763a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 7 15:09:34 2012 +0200 vbscript: Use separated IDispatchEx implementation for script dispatch. --- dlls/vbscript/global.c | 3 +- dlls/vbscript/vbdisp.c | 182 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/vbscript/vbscript.c | 5 +- dlls/vbscript/vbscript.h | 10 ++- 4 files changed, 195 insertions(+), 5 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 55c1acc..3c28e96 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -1825,8 +1825,7 @@ HRESULT init_global(script_ctx_t *ctx) if(FAILED(hres)) return hres; - ctx->script_desc.ctx = ctx; - hres = create_vbdisp(&ctx->script_desc, &ctx->script_obj); + hres = create_script_disp(ctx, &ctx->script_obj); if(FAILED(hres)) return hres; diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index f6e3f11..b7945d8 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -565,6 +565,188 @@ HRESULT create_procedure_disp(script_ctx_t *ctx, vbscode_t *code, IDispatch **re return S_OK; } +static inline ScriptDisp *ScriptDisp_from_IDispatchEx(IDispatchEx *iface) +{ + return CONTAINING_RECORD(iface, ScriptDisp, IDispatchEx_iface); +} + +static HRESULT WINAPI ScriptDisp_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IDispatchEx_iface; + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = &This->IDispatchEx_iface; + }else if(IsEqualGUID(&IID_IDispatchEx, riid)) { + TRACE("(%p)->(IID_IDispatchEx %p)\n", This, ppv); + *ppv = &This->IDispatchEx_iface; + }else { + WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI ScriptDisp_AddRef(IDispatchEx *iface) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI ScriptDisp_Release(IDispatchEx *iface) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + assert(!This->ctx); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI ScriptDisp_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + + TRACE("(%p)->(%p)\n", This, pctinfo); + + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI ScriptDisp_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, LCID lcid, + ITypeInfo **ppTInfo) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_GetIDsOfNames(IDispatchEx *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, + DISPID *rgDispId) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, + lcid, rgDispId); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_Invoke(IDispatchEx *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); + return DISP_E_UNKNOWNNAME; +} + +static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); + return DISP_E_MEMBERNOTFOUND; +} + +static HRESULT WINAPI ScriptDisp_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%x)\n", This, id); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%x %p)\n", This, id, pbstrName); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid); + return E_NOTIMPL; +} + +static HRESULT WINAPI ScriptDisp_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) +{ + ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); + FIXME("(%p)->(%p)\n", This, ppunk); + return E_NOTIMPL; +} + +static IDispatchExVtbl ScriptDispVtbl = { + ScriptDisp_QueryInterface, + ScriptDisp_AddRef, + ScriptDisp_Release, + ScriptDisp_GetTypeInfoCount, + ScriptDisp_GetTypeInfo, + ScriptDisp_GetIDsOfNames, + ScriptDisp_Invoke, + ScriptDisp_GetDispID, + ScriptDisp_InvokeEx, + ScriptDisp_DeleteMemberByName, + ScriptDisp_DeleteMemberByDispID, + ScriptDisp_GetMemberProperties, + ScriptDisp_GetMemberName, + ScriptDisp_GetNextDispID, + ScriptDisp_GetNameSpaceParent +}; + +HRESULT create_script_disp(script_ctx_t *ctx, ScriptDisp **ret) +{ + ScriptDisp *script_disp; + + script_disp = heap_alloc(sizeof(*script_disp)); + if(!script_disp) + return E_OUTOFMEMORY; + + script_disp->IDispatchEx_iface.lpVtbl = &ScriptDispVtbl; + script_disp->ref = 1; + script_disp->ctx = ctx; + + *ret = script_disp; + return S_OK; +} + void collect_objects(script_ctx_t *ctx) { vbdisp_t *iter, *iter2; diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index 095e3ae..05132a6 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -165,8 +165,11 @@ static void release_script(script_ctx_t *ctx) } if(ctx->script_obj) { - IDispatchEx_Release(&ctx->script_obj->IDispatchEx_iface); + ScriptDisp *script_obj = ctx->script_obj; + ctx->script_obj = NULL; + script_obj->ctx = NULL; + IDispatchEx_Release(&script_obj->IDispatchEx_iface); } vbsheap_free(&ctx->heap); diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 8a316ab..306cfed 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -116,6 +116,12 @@ struct _vbdisp_t { VARIANT props[1]; }; +typedef struct { + IDispatchEx IDispatchEx_iface; + LONG ref; + script_ctx_t *ctx; +} ScriptDisp; + HRESULT create_vbdisp(const class_desc_t*,vbdisp_t**) DECLSPEC_HIDDEN; HRESULT disp_get_id(IDispatch*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_HIDDEN; HRESULT vbdisp_get_id(vbdisp_t*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*) DECLSPEC_HIDDEN; @@ -123,6 +129,7 @@ HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*) DECLSPEC HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*) DECLSPEC_HIDDEN; void collect_objects(script_ctx_t*) DECLSPEC_HIDDEN; HRESULT create_procedure_disp(script_ctx_t*,vbscode_t*,IDispatch**) DECLSPEC_HIDDEN; +HRESULT create_script_disp(script_ctx_t*,ScriptDisp**) DECLSPEC_HIDDEN; static inline unsigned arg_cnt(const DISPPARAMS *dp) { @@ -150,8 +157,7 @@ struct _script_ctx_t { IDispatch *host_global; - class_desc_t script_desc; - vbdisp_t *script_obj; + ScriptDisp *script_obj; class_desc_t global_desc; vbdisp_t *global_obj;
1
0
0
0
Jacek Caban : vbscript: Fixed class_desc_t leak.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: bac5fdc85f231abda5b9ac49d4d0d1617fce44a0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bac5fdc85f231abda5b9ac49d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 7 15:08:59 2012 +0200 vbscript: Fixed class_desc_t leak. --- dlls/vbscript/vbscript.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c index f842bba..095e3ae 100644 --- a/dlls/vbscript/vbscript.c +++ b/dlls/vbscript/vbscript.c @@ -115,6 +115,8 @@ static HRESULT set_ctx_site(VBScript *This) static void release_script(script_ctx_t *ctx) { + class_desc_t *class_desc; + collect_objects(ctx); release_dynamic_vars(ctx->global_vars); @@ -130,6 +132,13 @@ static void release_script(script_ctx_t *ctx) heap_free(iter); } + while(ctx->procs) { + class_desc = ctx->procs; + ctx->procs = class_desc->next; + + heap_free(class_desc); + } + if(ctx->host_global) { IDispatch_Release(ctx->host_global); ctx->host_global = NULL;
1
0
0
0
Hans Leidekker : iphlpapi: Add partial support for UDP_TABLE_OWNER_MODULE in GetExtendedUdpTable.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: bc8876f9ce24beda5dba4a4413543f163fa154bb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bc8876f9ce24beda5dba4a441…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Sep 7 13:35:48 2012 +0200 iphlpapi: Add partial support for UDP_TABLE_OWNER_MODULE in GetExtendedUdpTable. --- dlls/iphlpapi/iphlpapi_main.c | 6 +++++- dlls/iphlpapi/ipstats.c | 15 +++++++++++---- include/udpmib.h | 23 +++++++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index a9ab1e0..f3568b8 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -1935,11 +1935,15 @@ DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, if (!pdwSize) return ERROR_INVALID_PARAMETER; if (ulAf != AF_INET || - (TableClass != UDP_TABLE_BASIC && TableClass != UDP_TABLE_OWNER_PID)) + (TableClass != UDP_TABLE_BASIC && TableClass != UDP_TABLE_OWNER_PID && + TableClass != UDP_TABLE_OWNER_MODULE)) { FIXME("ulAf = %u, TableClass = %u not supported\n", ulAf, TableClass); return ERROR_NOT_SUPPORTED; } + if (TableClass == UDP_TABLE_OWNER_MODULE) + FIXME("UDP_TABLE_OWNER_MODULE not fully supported\n"); + if ((ret = build_udp_table(TableClass, &table, bOrder, GetProcessHeap(), 0, &size))) return ret; diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 18307d5..7c64b41 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -1837,6 +1837,12 @@ static DWORD get_udp_table_sizes( UDP_TABLE_CLASS class, DWORD row_count, DWORD if (row_size) *row_size = sizeof(MIB_UDPROW_OWNER_PID); break; } + case UDP_TABLE_OWNER_MODULE: + { + table_size = FIELD_OFFSET(MIB_UDPTABLE_OWNER_MODULE, table[row_count]); + if (row_size) *row_size = sizeof(MIB_UDPROW_OWNER_MODULE); + break; + } default: ERR("unhandled class %u\n", class); return 0; @@ -1846,7 +1852,7 @@ static DWORD get_udp_table_sizes( UDP_TABLE_CLASS class, DWORD row_count, DWORD static MIB_UDPTABLE *append_udp_row( UDP_TABLE_CLASS class, HANDLE heap, DWORD flags, MIB_UDPTABLE *table, DWORD *count, - const MIB_UDPROW_OWNER_PID *row, DWORD row_size ) + const MIB_UDPROW_OWNER_MODULE *row, DWORD row_size ) { if (table->dwNumEntries >= *count) { @@ -1881,7 +1887,7 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE DWORD *size ) { MIB_UDPTABLE *table; - MIB_UDPROW_OWNER_PID row; + MIB_UDPROW_OWNER_MODULE row; DWORD ret = NO_ERROR, count = 16, table_size, row_size; if (!(table_size = get_udp_table_sizes( class, count, &row_size ))) @@ -1904,7 +1910,8 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE unsigned int dummy, num_entries = 0; int inode; - if (class == UDP_TABLE_OWNER_PID) map = get_pid_map( &num_entries ); + if (class == UDP_TABLE_OWNER_PID || class == UDP_TABLE_OWNER_MODULE) + map = get_pid_map( &num_entries ); /* skip header line */ ptr = fgets( buf, sizeof(buf), fp ); @@ -1914,7 +1921,7 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE &row.dwLocalAddr, &row.dwLocalPort, &inode ) != 4) continue; row.dwLocalPort = htons( row.dwLocalPort ); - if (class == UDP_TABLE_OWNER_PID) + if (class == UDP_TABLE_OWNER_PID || class == UDP_TABLE_OWNER_MODULE) row.dwOwningPid = find_owning_pid( map, num_entries, inode ); if (!(table = append_udp_row( class, heap, flags, table, &count, &row, row_size ))) break; diff --git a/include/udpmib.h b/include/udpmib.h index c2d507f..6b3f51c 100644 --- a/include/udpmib.h +++ b/include/udpmib.h @@ -48,6 +48,29 @@ typedef struct _MIB_UDPTABLE_OWNER_PID MIB_UDPROW_OWNER_PID table[1]; } MIB_UDPTABLE_OWNER_PID, *PMIB_UDPTABLE_OWNER_PID; +typedef struct _MIB_UDPROW_OWNER_MODULE +{ + DWORD dwLocalAddr; + DWORD dwLocalPort; + DWORD dwOwningPid; + LARGE_INTEGER liCreateTimestamp; + __C89_NAMELESS union + { + __C89_NAMELESS struct + { + int SpecificPortBind:1; + } __C89_NAMELESSSTRUCTNAME; + int dwFlags; + } __C89_NAMELESSUNIONNAME; + ULONGLONG OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE]; +} MIB_UDPROW_OWNER_MODULE, *PMIB_UDPROW_OWNER_MODULE; + +typedef struct _MIB_UDPTABLE_OWNER_MODULE +{ + DWORD dwNumEntries; + MIB_UDPROW_OWNER_MODULE table[1]; +} MIB_UDPTABLE_OWNER_MODULE, *PMIB_UDPTABLE_OWNER_MODULE; + /* UDP statistics */ typedef struct _MIB_UDPSTATS
1
0
0
0
Hans Leidekker : iphlpapi: Implement GetExtendedUdpTable.
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: 18ba68ea629f98c6afdc73c4baec0003f1c11ec6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=18ba68ea629f98c6afdc73c4b…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Sep 7 13:35:36 2012 +0200 iphlpapi: Implement GetExtendedUdpTable. --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 49 +++-- dlls/iphlpapi/ipstats.c | 438 ++++++++++++++++++++++------------------ dlls/iphlpapi/ipstats.h | 1 + dlls/iphlpapi/tests/iphlpapi.c | 36 ++++ include/iphlpapi.h | 3 + include/iprtrmib.h | 7 + include/udpmib.h | 2 +- 8 files changed, 322 insertions(+), 216 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=18ba68ea629f98c6afdc7…
1
0
0
0
Alexandre Julliard : winex11: Get the current pixel format from the drawable structure in wglMakeContextCurrentARB .
by Alexandre Julliard
07 Sep '12
07 Sep '12
Module: wine Branch: master Commit: bde5156876bc9c2255f3f98bdef81840c057ffb7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=bde5156876bc9c2255f3f98bd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Sep 7 16:09:22 2012 +0200 winex11: Get the current pixel format from the drawable structure in wglMakeContextCurrentARB. --- dlls/winex11.drv/opengl.c | 48 +++++++++++++++++++------------------------- 1 files changed, 21 insertions(+), 27 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index a6fb974..6e0c0b7 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1718,8 +1718,9 @@ done: */ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct wgl_context *ctx ) { - struct x11drv_escape_get_drawable escape_draw, escape_read; - BOOL ret; + BOOL ret = FALSE; + HWND draw_hwnd, read_hwnd; + struct gl_drawable *draw_gl, *read_gl; TRACE("(%p,%p,%p)\n", draw_hdc, read_hdc, ctx); @@ -1730,43 +1731,36 @@ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct return TRUE; } - escape_draw.code = X11DRV_GET_DRAWABLE; - if (!ExtEscape( draw_hdc, X11DRV_ESCAPE, sizeof(escape_draw.code), (LPCSTR)&escape_draw.code, - sizeof(escape_draw), (LPSTR)&escape_draw )) - return FALSE; + if (!pglXMakeContextCurrent) return FALSE; - escape_read.code = X11DRV_GET_DRAWABLE; - if (!ExtEscape( read_hdc, X11DRV_ESCAPE, sizeof(escape_read.code), (LPCSTR)&escape_read.code, - sizeof(escape_read), (LPSTR)&escape_read )) - return FALSE; + draw_hwnd = WindowFromDC( draw_hdc ); + read_hwnd = WindowFromDC( read_hdc ); + EnterCriticalSection( &context_section ); - if (!escape_draw.pixel_format) + if (!XFindContext( gdi_display, (XID)draw_hwnd, gl_hwnd_context, (char **)&draw_gl ) || + !XFindContext( gdi_display, (XID)draw_hdc, gl_pbuffer_context, (char **)&draw_gl )) { - WARN("Trying to use an invalid drawable\n"); - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - else - { - if (!pglXMakeContextCurrent) return FALSE; + if (XFindContext( gdi_display, (XID)read_hwnd, gl_hwnd_context, (char **)&read_gl ) && + XFindContext( gdi_display, (XID)read_hdc, gl_pbuffer_context, (char **)&read_gl )) + read_gl = NULL; - ret = pglXMakeContextCurrent(gdi_display, escape_draw.gl_drawable, escape_read.gl_drawable, ctx->ctx); + ret = pglXMakeContextCurrent(gdi_display, draw_gl->drawable, + read_gl ? read_gl->drawable : 0, ctx->ctx); if (ret) { - EnterCriticalSection( &context_section ); ctx->has_been_current = TRUE; ctx->hdc = draw_hdc; - ctx->drawables[0] = escape_draw.gl_drawable; - ctx->drawables[1] = escape_read.gl_drawable; + ctx->drawables[0] = draw_gl->drawable; + ctx->drawables[1] = read_gl ? read_gl->drawable : 0; ctx->refresh_drawables = FALSE; - LeaveCriticalSection( &context_section ); NtCurrentTeb()->glContext = ctx; + goto done; } - else - SetLastError(ERROR_INVALID_HANDLE); } - - TRACE(" returning %s\n", (ret ? "True" : "False")); + SetLastError( ERROR_INVALID_HANDLE ); +done: + LeaveCriticalSection( &context_section ); + TRACE( "%p,%p,%p returning %d\n", draw_hdc, read_hdc, ctx, ret ); return ret; }
1
0
0
0
← Newer
1
...
63
64
65
66
67
68
69
...
83
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
Results per page:
10
25
50
100
200