[PATCH 4/5] vbscript: Implement separate script dispatch objects for each named item.

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Feb 4 07:36:26 CST 2020


On 03/02/2020 21:26, Jacek Caban wrote:
> Hi Gabriel,
> 
> On 03.02.2020 17:59, Gabriel Ivăncescu wrote:
>> Hi Jacek,
>>
>> On 03/02/2020 19:17, Jacek Caban wrote:
>>> Hi Gabriel,
>>>
>>> On 31.01.2020 14:29, Gabriel Ivăncescu wrote:
>>>> diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
>>>> index b328674..8ded5cd 100644
>>>> --- a/dlls/vbscript/interp.c
>>>> +++ b/dlls/vbscript/interp.c
>>>> @@ -112,7 +112,7 @@ static BOOL lookup_global_vars(ScriptDisp 
>>>> *script, const WCHAR *name, ref_t *ref
>>>>     static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, 
>>>> vbdisp_invoke_type_t invoke_type, ref_t *ref)
>>>>   {
>>>> -    ScriptDisp *script_obj = ctx->script->script_obj;
>>>> +    ScriptDisp *script_obj = ctx->code->script_obj;
>>>
>>>
>>> Does it really use this script instead of global script global 
>>> context? My guess would be that both should be looked up in this 
>>> case. A test to clarify that would be nice.
>>>
>>
>> Yes, sorry about that, I forgot to add this test to the actual patch 
>> (I did fiddle manually with it though).
>>
>> I double checked and added such a test, it does appear that it was 
>> correct: it cannot access the global context or dispatch at all.
>>
>> See: https://testbot.winehq.org/JobDetails.pl?Key=64413 
> 
> 
> I don't see the test I was interested in  there. I wrote a simple test 
> on top of that (see attachment) and it confirms that my guess was right. 
> Scripts ran in context of named item can access global properties. The 
> test succeeded on win10, but failed on patched Wine.
> 
> 

Ok, I've analyzed this deeper, part of the problems is because the 
current test adds a visibleItem which always returns S_OK, so in fact 
that snippet you added could use any identifier and still have it parse 
correctly. It fails on Wine but that is a separate issue currently.

However, now that I've changed it to a different identifier in my tests 
(testSub_global) and had it return DISP_E_UNKNOWNNAME with anything 
other than testCall, it still passes on Windows, so you are indeed correct.

It can access the global namespace but only through code, not with 
GetIDsOfNames.

So I'll have to revise it now. :-)



More information about the wine-devel mailing list