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
bbed41fa
Commit
bbed41fa
authored
Sep 05, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added AddNamedItem implementation.
parent
aff6961b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
1 deletion
+94
-1
vbscript.c
dlls/vbscript/vbscript.c
+63
-1
vbscript.h
dlls/vbscript/vbscript.h
+31
-0
No files found.
dlls/vbscript/vbscript.c
View file @
bbed41fa
...
...
@@ -87,6 +87,18 @@ static HRESULT set_ctx_site(VBScript *This)
static
void
destroy_script
(
script_ctx_t
*
ctx
)
{
while
(
!
list_empty
(
&
ctx
->
named_items
))
{
named_item_t
*
iter
=
LIST_ENTRY
(
list_head
(
&
ctx
->
named_items
),
named_item_t
,
entry
);
list_remove
(
&
iter
->
entry
);
if
(
iter
->
disp
)
IDispatch_Release
(
iter
->
disp
);
heap_free
(
iter
->
name
);
heap_free
(
iter
);
}
if
(
ctx
->
host_global
)
IDispatch_Release
(
ctx
->
host_global
);
if
(
ctx
->
site
)
IActiveScriptSite_Release
(
ctx
->
site
);
if
(
ctx
->
script_obj
)
...
...
@@ -295,7 +307,55 @@ static HRESULT WINAPI VBScript_Close(IActiveScript *iface)
static
HRESULT
WINAPI
VBScript_AddNamedItem
(
IActiveScript
*
iface
,
LPCOLESTR
pstrName
,
DWORD
dwFlags
)
{
VBScript
*
This
=
impl_from_IActiveScript
(
iface
);
FIXME
(
"(%p)->(%s %x)
\n
"
,
This
,
debugstr_w
(
pstrName
),
dwFlags
);
named_item_t
*
item
;
IDispatch
*
disp
=
NULL
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s %x)
\n
"
,
This
,
debugstr_w
(
pstrName
),
dwFlags
);
if
(
This
->
thread_id
!=
GetCurrentThreadId
()
||
!
This
->
ctx
||
This
->
state
==
SCRIPTSTATE_CLOSED
)
return
E_UNEXPECTED
;
if
(
dwFlags
&
SCRIPTITEM_GLOBALMEMBERS
)
{
IUnknown
*
unk
;
hres
=
IActiveScriptSite_GetItemInfo
(
This
->
site
,
pstrName
,
SCRIPTINFO_IUNKNOWN
,
&
unk
,
NULL
);
if
(
FAILED
(
hres
))
{
WARN
(
"GetItemInfo failed: %08x
\n
"
,
hres
);
return
hres
;
}
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IDispatch
,
(
void
**
)
&
disp
);
IUnknown_Release
(
unk
);
if
(
FAILED
(
hres
))
{
WARN
(
"object does not implement IDispatch
\n
"
);
return
hres
;
}
if
(
This
->
ctx
->
host_global
)
IDispatch_Release
(
This
->
ctx
->
host_global
);
IDispatch_AddRef
(
disp
);
This
->
ctx
->
host_global
=
disp
;
}
item
=
heap_alloc
(
sizeof
(
*
item
));
if
(
!
item
)
{
if
(
disp
)
IDispatch_Release
(
disp
);
return
E_OUTOFMEMORY
;
}
item
->
disp
=
disp
;
item
->
flags
=
dwFlags
;
item
->
name
=
heap_strdupW
(
pstrName
);
if
(
!
item
->
name
)
{
if
(
disp
)
IDispatch_Release
(
disp
);
heap_free
(
item
);
return
E_OUTOFMEMORY
;
}
list_add_tail
(
&
This
->
ctx
->
named_items
,
&
item
->
entry
);
return
S_OK
;
}
...
...
@@ -421,6 +481,8 @@ static HRESULT WINAPI VBScriptParse_InitNew(IActiveScriptParse *iface)
if
(
!
ctx
)
return
E_OUTOFMEMORY
;
list_init
(
&
ctx
->
named_items
);
old_ctx
=
InterlockedCompareExchangePointer
((
void
**
)
&
This
->
ctx
,
ctx
,
NULL
);
if
(
old_ctx
)
{
destroy_script
(
ctx
);
...
...
dlls/vbscript/vbscript.h
View file @
bbed41fa
...
...
@@ -28,6 +28,17 @@
#include "vbscript_classes.h"
#include "wine/list.h"
#include "wine/unicode.h"
typedef
struct
named_item_t
{
IDispatch
*
disp
;
DWORD
flags
;
LPWSTR
name
;
struct
list
entry
;
}
named_item_t
;
typedef
struct
{
IDispatchEx
IDispatchEx_iface
;
...
...
@@ -38,7 +49,11 @@ typedef struct {
IActiveScriptSite
*
site
;
LCID
lcid
;
IDispatch
*
host_global
;
vbdisp_t
*
script_obj
;
struct
list
named_items
;
}
script_ctx_t
;
HRESULT
init_global
(
script_ctx_t
*
);
...
...
@@ -59,3 +74,19 @@ static inline BOOL heap_free(void *mem)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
LPWSTR
heap_strdupW
(
LPCWSTR
str
)
{
LPWSTR
ret
=
NULL
;
if
(
str
)
{
DWORD
size
;
size
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
}
return
ret
;
}
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