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
271819e7
Commit
271819e7
authored
Oct 18, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Create script context in CreateInstance.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
79f39c2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
30 deletions
+24
-30
vbscript.c
dlls/vbscript/vbscript.c
+24
-30
No files found.
dlls/vbscript/vbscript.c
View file @
271819e7
...
...
@@ -57,6 +57,7 @@ struct VBScript {
script_ctx_t
*
ctx
;
LONG
thread_id
;
LCID
lcid
;
BOOL
is_initialized
;
};
typedef
struct
{
...
...
@@ -227,9 +228,7 @@ static void decrease_state(VBScript *This, SCRIPTSTATE state)
This
->
site
=
NULL
;
}
if
(
This
->
ctx
)
release_script
(
This
->
ctx
);
release_script
(
This
->
ctx
);
This
->
thread_id
=
0
;
break
;
case
SCRIPTSTATE_CLOSED
:
...
...
@@ -405,11 +404,8 @@ static ULONG WINAPI VBScript_Release(IActiveScript *iface)
TRACE
(
"(%p) ref=%d
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
if
(
This
->
ctx
)
{
decrease_state
(
This
,
SCRIPTSTATE_CLOSED
);
destroy_script
(
This
->
ctx
);
This
->
ctx
=
NULL
;
}
decrease_state
(
This
,
SCRIPTSTATE_CLOSED
);
destroy_script
(
This
->
ctx
);
if
(
This
->
site
)
IActiveScriptSite_Release
(
This
->
site
);
heap_free
(
This
);
...
...
@@ -442,7 +438,7 @@ static HRESULT WINAPI VBScript_SetScriptSite(IActiveScript *iface, IActiveScript
if
(
hres
==
S_OK
)
This
->
lcid
=
lcid
;
return
This
->
ctx
?
set_ctx_site
(
This
)
:
S_OK
;
return
This
->
is_initialized
?
set_ctx_site
(
This
)
:
S_OK
;
}
static
HRESULT
WINAPI
VBScript_GetScriptSite
(
IActiveScript
*
iface
,
REFIID
riid
,
...
...
@@ -470,7 +466,7 @@ static HRESULT WINAPI VBScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE
return
S_OK
;
}
if
(
!
This
->
ctx
)
if
(
!
This
->
is_initialized
)
return
E_UNEXPECTED
;
switch
(
ss
)
{
...
...
@@ -534,7 +530,7 @@ static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstr
TRACE
(
"(%p)->(%s %x)
\n
"
,
This
,
debugstr_w
(
pstrName
),
dwFlags
);
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
!
This
->
ctx
||
This
->
state
==
SCRIPTSTATE_CLOSED
)
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
This
->
state
==
SCRIPTSTATE_CLOSED
)
return
E_UNEXPECTED
;
if
(
dwFlags
&
SCRIPTITEM_GLOBALMEMBERS
)
{
...
...
@@ -597,7 +593,7 @@ static HRESULT WINAPI VBScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR
if
(
!
ppdisp
)
return
E_POINTER
;
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
!
This
->
ctx
||
!
This
->
ctx
->
script_obj
)
{
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
!
This
->
ctx
->
script_obj
)
{
*
ppdisp
=
NULL
;
return
E_UNEXPECTED
;
}
...
...
@@ -749,29 +745,14 @@ static ULONG WINAPI VBScriptParse_Release(IActiveScriptParse *iface)
static
HRESULT
WINAPI
VBScriptParse_InitNew
(
IActiveScriptParse
*
iface
)
{
VBScript
*
This
=
impl_from_IActiveScriptParse
(
iface
);
script_ctx_t
*
ctx
,
*
old_ctx
;
TRACE
(
"(%p)
\n
"
,
This
);
if
(
This
->
ctx
)
return
E_UNEXPECTED
;
ctx
=
heap_alloc_zero
(
sizeof
(
script_ctx_t
));
if
(
!
ctx
)
return
E_OUTOFMEMORY
;
ctx
->
safeopt
=
This
->
safeopt
;
heap_pool_init
(
&
ctx
->
heap
);
list_init
(
&
ctx
->
objects
);
list_init
(
&
ctx
->
code_list
);
list_init
(
&
ctx
->
named_items
);
old_ctx
=
InterlockedCompareExchangePointer
((
void
**
)
&
This
->
ctx
,
ctx
,
NULL
);
if
(
old_ctx
)
{
destroy_script
(
ctx
);
if
(
This
->
is_initialized
)
return
E_UNEXPECTED
;
}
This
->
is_initialized
=
TRUE
;
This
->
ctx
->
safeopt
=
This
->
safeopt
;
return
This
->
site
?
set_ctx_site
(
This
)
:
S_OK
;
}
...
...
@@ -961,6 +942,7 @@ static const IObjectSafetyVtbl VBScriptSafetyVtbl = {
HRESULT
WINAPI
VBScriptFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppv
)
{
script_ctx_t
*
ctx
;
VBScript
*
ret
;
HRESULT
hres
;
...
...
@@ -980,6 +962,18 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pU
ret
->
state
=
SCRIPTSTATE_UNINITIALIZED
;
ret
->
safeopt
=
INTERFACE_USES_DISPEX
;
ctx
=
ret
->
ctx
=
heap_alloc_zero
(
sizeof
(
*
ctx
));
if
(
!
ctx
)
{
heap_free
(
ret
);
return
E_OUTOFMEMORY
;
}
ctx
->
safeopt
=
INTERFACE_USES_DISPEX
;
heap_pool_init
(
&
ctx
->
heap
);
list_init
(
&
ctx
->
objects
);
list_init
(
&
ctx
->
code_list
);
list_init
(
&
ctx
->
named_items
);
hres
=
IActiveScript_QueryInterface
(
&
ret
->
IActiveScript_iface
,
riid
,
ppv
);
IActiveScript_Release
(
&
ret
->
IActiveScript_iface
);
return
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