Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
55e01ac0
Commit
55e01ac0
authored
Sep 23, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrobj: Parse scripts in DllInstall.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4d368c3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
2 deletions
+54
-2
scrobj.c
dlls/scrobj/scrobj.c
+54
-0
scrobj.c
dlls/scrobj/tests/scrobj.c
+0
-2
No files found.
dlls/scrobj/scrobj.c
View file @
55e01ac0
...
...
@@ -117,6 +117,7 @@ struct script_host
IActiveScript
*
active_script
;
IActiveScriptParse
*
parser
;
SCRIPTSTATE
state
;
BOOL
cloned
;
};
...
...
@@ -204,6 +205,16 @@ static WCHAR *heap_strdupW(const WCHAR *str)
return
ret
;
}
static
HRESULT
set_script_state
(
struct
script_host
*
host
,
SCRIPTSTATE
state
)
{
HRESULT
hres
;
if
(
state
==
host
->
state
)
return
S_OK
;
hres
=
IActiveScript_SetScriptState
(
host
->
active_script
,
state
);
if
(
FAILED
(
hres
))
return
hres
;
host
->
state
=
state
;
return
S_OK
;
}
static
inline
struct
script_host
*
impl_from_IActiveScriptSite
(
IActiveScriptSite
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
script_host
,
IActiveScriptSite_iface
);
...
...
@@ -437,6 +448,46 @@ static struct script_host *find_script_host(struct list *hosts, const WCHAR *lan
return
NULL
;
}
static
HRESULT
parse_scripts
(
struct
scriptlet_factory
*
factory
,
struct
list
*
hosts
,
BOOL
start
)
{
DWORD
parse_flags
=
SCRIPTTEXT_ISVISIBLE
;
struct
scriptlet_script
*
script
;
struct
script_host
*
host
;
HRESULT
hres
;
if
(
!
start
)
parse_flags
|=
SCRIPTITEM_ISPERSISTENT
;
LIST_FOR_EACH_ENTRY
(
script
,
&
factory
->
scripts
,
struct
scriptlet_script
,
entry
)
{
host
=
find_script_host
(
hosts
,
script
->
language
);
if
(
start
&&
host
->
state
!=
SCRIPTSTATE_STARTED
)
{
hres
=
set_script_state
(
host
,
SCRIPTSTATE_STARTED
);
if
(
FAILED
(
hres
))
return
hres
;
}
if
(
host
->
cloned
)
continue
;
hres
=
IActiveScriptParse_ParseScriptText
(
host
->
parser
,
script
->
body
,
NULL
,
NULL
,
NULL
,
0
,
0
/* FIXME */
,
parse_flags
,
NULL
,
NULL
);
if
(
FAILED
(
hres
))
{
WARN
(
"ParseScriptText failed: %08x
\n
"
,
hres
);
return
hres
;
}
}
if
(
!
start
)
{
LIST_FOR_EACH_ENTRY
(
host
,
hosts
,
struct
script_host
,
entry
)
{
if
(
host
->
state
!=
SCRIPTSTATE_UNINITIALIZED
)
set_script_state
(
host
,
SCRIPTSTATE_UNINITIALIZED
);
}
}
return
S_OK
;
}
static
HRESULT
init_script_host
(
struct
script_host
*
host
,
IActiveScript
*
clone
)
{
HRESULT
hres
;
...
...
@@ -509,6 +560,7 @@ static HRESULT create_script_host(const WCHAR *language, IActiveScript *origin_s
host
->
IActiveScriptSiteWindow_iface
.
lpVtbl
=
&
ActiveScriptSiteWindowVtbl
;
host
->
IServiceProvider_iface
.
lpVtbl
=
&
ServiceProviderVtbl
;
host
->
ref
=
1
;
host
->
state
=
SCRIPTSTATE_CLOSED
;
if
(
!
(
host
->
language
=
heap_strdupW
(
language
)))
{
...
...
@@ -533,6 +585,7 @@ static void detach_script_hosts(struct list *hosts)
while
(
!
list_empty
(
hosts
))
{
struct
script_host
*
host
=
LIST_ENTRY
(
list_head
(
hosts
),
struct
script_host
,
entry
);
if
(
host
->
state
!=
SCRIPTSTATE_UNINITIALIZED
)
set_script_state
(
host
,
SCRIPTSTATE_UNINITIALIZED
);
list_remove
(
&
host
->
entry
);
if
(
host
->
parser
)
{
...
...
@@ -1800,6 +1853,7 @@ HRESULT WINAPI DllInstall(BOOL install, const WCHAR *arg)
{
/* validate scripts */
hres
=
create_scriptlet_hosts
(
factory
,
&
factory
->
hosts
);
if
(
SUCCEEDED
(
hres
))
hres
=
parse_scripts
(
factory
,
&
factory
->
hosts
,
FALSE
);
}
else
{
...
...
dlls/scrobj/tests/scrobj.c
View file @
55e01ac0
...
...
@@ -720,9 +720,7 @@ static void register_script_object(BOOL do_register, const WCHAR *file_name)
CHECK_CALLED
(
QI_IActiveScriptParse
);
CHECK_CALLED
(
InitNew
);
CHECK_CALLED
(
SetScriptSite
);
todo_wine
CHECK_CALLED
(
ParseScriptText
);
todo_wine
CHECK_CALLED
(
SetScriptState_UNINITIALIZED
);
CHECK_CALLED
(
Close
);
ok
(
hres
==
S_OK
,
"DllInstall failed: %08x
\n
"
,
hres
);
...
...
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