Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6deee88a
Commit
6deee88a
authored
Jan 26, 2023
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Jan 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Implement SID_GetCaller for QueryService.
Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
a9a3c65c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
3 deletions
+35
-3
dispex.c
dlls/jscript/dispex.c
+9
-0
jscript.c
dlls/jscript/jscript.c
+14
-3
jscript.h
dlls/jscript/jscript.h
+3
-0
jsutils.c
dlls/jscript/jsutils.c
+9
-0
caller.c
dlls/jscript/tests/caller.c
+0
-0
No files found.
dlls/jscript/dispex.c
View file @
6deee88a
...
...
@@ -1900,6 +1900,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
VARIANT
*
pvarRes
,
EXCEPINFO
*
pei
,
IServiceProvider
*
pspCaller
)
{
jsdisp_t
*
This
=
impl_from_IDispatchEx
(
iface
);
IServiceProvider
*
prev_caller
;
dispex_prop_t
*
prop
;
jsexcept_t
ei
;
HRESULT
hres
;
...
...
@@ -1917,6 +1918,11 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
enter_script
(
This
->
ctx
,
&
ei
);
prev_caller
=
This
->
ctx
->
jscaller
->
caller
;
This
->
ctx
->
jscaller
->
caller
=
pspCaller
;
if
(
pspCaller
)
IServiceProvider_AddRef
(
pspCaller
);
switch
(
wFlags
)
{
case
DISPATCH_METHOD
|
DISPATCH_PROPERTYGET
:
wFlags
=
DISPATCH_METHOD
;
...
...
@@ -2000,6 +2006,9 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
break
;
}
This
->
ctx
->
jscaller
->
caller
=
prev_caller
;
if
(
pspCaller
)
IServiceProvider_Release
(
pspCaller
);
return
leave_script
(
This
->
ctx
,
hres
);
}
...
...
dlls/jscript/jscript.c
View file @
6deee88a
...
...
@@ -428,6 +428,17 @@ static void release_named_item_list(JScript *This)
}
}
static
HRESULT
exec_global_code
(
script_ctx_t
*
ctx
,
bytecode_t
*
code
,
jsval_t
*
r
)
{
IServiceProvider
*
prev_caller
=
ctx
->
jscaller
->
caller
;
HRESULT
hres
;
ctx
->
jscaller
->
caller
=
SP_CALLER_UNINITIALIZED
;
hres
=
exec_source
(
ctx
,
EXEC_GLOBAL
,
code
,
&
code
->
global_code
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
r
);
ctx
->
jscaller
->
caller
=
prev_caller
;
return
hres
;
}
static
void
exec_queued_code
(
JScript
*
This
)
{
bytecode_t
*
iter
;
...
...
@@ -436,7 +447,7 @@ static void exec_queued_code(JScript *This)
LIST_FOR_EACH_ENTRY
(
iter
,
&
This
->
queued_code
,
bytecode_t
,
entry
)
{
enter_script
(
This
->
ctx
,
&
ei
);
hres
=
exec_
source
(
This
->
ctx
,
EXEC_GLOBAL
,
iter
,
&
iter
->
global_code
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
);
hres
=
exec_
global_code
(
This
->
ctx
,
iter
,
NULL
);
leave_script
(
This
->
ctx
,
hres
);
if
(
FAILED
(
hres
))
break
;
...
...
@@ -1103,7 +1114,7 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
if
(
dwFlags
&
SCRIPTTEXT_ISEXPRESSION
)
{
jsval_t
r
;
hres
=
exec_
source
(
This
->
ctx
,
EXEC_GLOBAL
,
code
,
&
code
->
global_code
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
&
r
);
hres
=
exec_
global_code
(
This
->
ctx
,
code
,
&
r
);
if
(
SUCCEEDED
(
hres
))
{
if
(
pvarResult
)
hres
=
jsval_to_variant
(
r
,
pvarResult
);
...
...
@@ -1122,7 +1133,7 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
if
(
!
pvarResult
&&
!
is_started
(
This
->
ctx
))
{
list_add_tail
(
&
This
->
queued_code
,
&
code
->
entry
);
}
else
{
hres
=
exec_
source
(
This
->
ctx
,
EXEC_GLOBAL
,
code
,
&
code
->
global_code
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
);
hres
=
exec_
global_code
(
This
->
ctx
,
code
,
NULL
);
if
(
code
->
is_persistent
)
list_add_tail
(
&
This
->
persistent_code
,
&
code
->
entry
);
else
...
...
dlls/jscript/jscript.h
View file @
6deee88a
...
...
@@ -331,12 +331,15 @@ typedef struct {
void
release_cc
(
cc_ctx_t
*
)
DECLSPEC_HIDDEN
;
#define SP_CALLER_UNINITIALIZED ((IServiceProvider*)IntToPtr(-1))
typedef
struct
{
IServiceProvider
IServiceProvider_iface
;
LONG
ref
;
script_ctx_t
*
ctx
;
IServiceProvider
*
caller
;
}
JSCaller
;
#include "jsval.h"
...
...
dlls/jscript/jsutils.c
View file @
6deee88a
...
...
@@ -1034,6 +1034,14 @@ static HRESULT WINAPI JSCaller_QueryService(IServiceProvider *iface, REFGUID gui
{
JSCaller
*
This
=
impl_from_IServiceProvider
(
iface
);
if
(
IsEqualGUID
(
guidService
,
&
SID_GetCaller
))
{
TRACE
(
"(%p)->(SID_GetCaller)
\n
"
,
This
);
*
ppv
=
NULL
;
if
(
!
This
->
caller
)
return
S_OK
;
return
(
This
->
caller
==
SP_CALLER_UNINITIALIZED
)
?
E_NOINTERFACE
:
IServiceProvider_QueryInterface
(
This
->
caller
,
riid
,
ppv
);
}
if
(
IsEqualGUID
(
guidService
,
&
SID_VariantConversion
)
&&
This
->
ctx
&&
This
->
ctx
->
active_script
)
{
TRACE
(
"(%p)->(SID_VariantConversion)
\n
"
,
This
);
return
IActiveScript_QueryInterface
(
This
->
ctx
->
active_script
,
riid
,
ppv
);
...
...
@@ -1063,6 +1071,7 @@ HRESULT create_jscaller(script_ctx_t *ctx)
ret
->
IServiceProvider_iface
.
lpVtbl
=
&
ServiceProviderVtbl
;
ret
->
ref
=
1
;
ret
->
ctx
=
ctx
;
ret
->
caller
=
SP_CALLER_UNINITIALIZED
;
ctx
->
jscaller
=
ret
;
return
S_OK
;
...
...
dlls/jscript/tests/caller.c
View file @
6deee88a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment