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
40001df4
Commit
40001df4
authored
Sep 07, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added ScriptDisp::GetDispID implementation.
parent
8121f732
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
2 deletions
+90
-2
vbdisp.c
dlls/vbscript/vbdisp.c
+83
-2
vbscript.h
dlls/vbscript/vbscript.h
+7
-0
No files found.
dlls/vbscript/vbdisp.c
View file @
40001df4
...
...
@@ -565,6 +565,44 @@ HRESULT create_procedure_disp(script_ctx_t *ctx, vbscode_t *code, IDispatch **re
return
S_OK
;
}
struct
_ident_map_t
{
const
WCHAR
*
name
;
BOOL
is_var
;
union
{
dynamic_var_t
*
var
;
function_t
*
func
;
}
u
;
};
static
inline
DISPID
ident_to_id
(
ScriptDisp
*
This
,
ident_map_t
*
ident
)
{
return
(
ident
-
This
->
ident_map
)
+
1
;
}
static
ident_map_t
*
add_ident
(
ScriptDisp
*
This
,
const
WCHAR
*
name
)
{
ident_map_t
*
ret
;
if
(
!
This
->
ident_map_size
)
{
This
->
ident_map
=
heap_alloc
(
4
*
sizeof
(
*
This
->
ident_map
));
if
(
!
This
->
ident_map
)
return
NULL
;
This
->
ident_map_size
=
4
;
}
else
if
(
This
->
ident_map_cnt
==
This
->
ident_map_size
)
{
ident_map_t
*
new_map
;
new_map
=
heap_realloc
(
This
->
ident_map
,
2
*
This
->
ident_map_size
*
sizeof
(
*
new_map
));
if
(
!
new_map
)
return
NULL
;
This
->
ident_map
=
new_map
;
This
->
ident_map_size
*=
2
;
}
ret
=
This
->
ident_map
+
This
->
ident_map_cnt
++
;
ret
->
name
=
name
;
return
ret
;
}
static
inline
ScriptDisp
*
ScriptDisp_from_IDispatchEx
(
IDispatchEx
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
ScriptDisp
,
IDispatchEx_iface
);
...
...
@@ -612,6 +650,7 @@ static ULONG WINAPI ScriptDisp_Release(IDispatchEx *iface)
if
(
!
ref
)
{
assert
(
!
This
->
ctx
);
heap_free
(
This
->
ident_map
);
heap_free
(
This
);
}
...
...
@@ -659,7 +698,49 @@ static HRESULT WINAPI ScriptDisp_Invoke(IDispatchEx *iface, DISPID dispIdMember,
static
HRESULT
WINAPI
ScriptDisp_GetDispID
(
IDispatchEx
*
iface
,
BSTR
bstrName
,
DWORD
grfdex
,
DISPID
*
pid
)
{
ScriptDisp
*
This
=
ScriptDisp_from_IDispatchEx
(
iface
);
FIXME
(
"(%p)->(%s %x %p)
\n
"
,
This
,
debugstr_w
(
bstrName
),
grfdex
,
pid
);
dynamic_var_t
*
var
;
ident_map_t
*
ident
;
function_t
*
func
;
TRACE
(
"(%p)->(%s %x %p)
\n
"
,
This
,
debugstr_w
(
bstrName
),
grfdex
,
pid
);
if
(
!
This
->
ctx
)
return
E_UNEXPECTED
;
for
(
ident
=
This
->
ident_map
;
ident
<
This
->
ident_map
+
This
->
ident_map_cnt
;
ident
++
)
{
if
(
!
strcmpiW
(
ident
->
name
,
bstrName
))
{
*
pid
=
ident_to_id
(
This
,
ident
);
return
S_OK
;
}
}
for
(
var
=
This
->
ctx
->
global_vars
;
var
;
var
=
var
->
next
)
{
if
(
!
strcmpiW
(
var
->
name
,
bstrName
))
{
ident
=
add_ident
(
This
,
var
->
name
);
if
(
!
ident
)
return
E_OUTOFMEMORY
;
ident
->
is_var
=
TRUE
;
ident
->
u
.
var
=
var
;
*
pid
=
ident_to_id
(
This
,
ident
);
return
S_OK
;
}
}
for
(
func
=
This
->
ctx
->
global_funcs
;
func
;
func
=
func
->
next
)
{
if
(
!
strcmpiW
(
func
->
name
,
bstrName
))
{
ident
=
add_ident
(
This
,
func
->
name
);
if
(
!
ident
)
return
E_OUTOFMEMORY
;
ident
->
is_var
=
FALSE
;
ident
->
u
.
func
=
func
;
*
pid
=
ident_to_id
(
This
,
ident
);
return
S_OK
;
}
}
*
pid
=
-
1
;
return
DISP_E_UNKNOWNNAME
;
}
...
...
@@ -735,7 +816,7 @@ HRESULT create_script_disp(script_ctx_t *ctx, ScriptDisp **ret)
{
ScriptDisp
*
script_disp
;
script_disp
=
heap_alloc
(
sizeof
(
*
script_disp
));
script_disp
=
heap_alloc
_zero
(
sizeof
(
*
script_disp
));
if
(
!
script_disp
)
return
E_OUTOFMEMORY
;
...
...
dlls/vbscript/vbscript.h
View file @
40001df4
...
...
@@ -116,9 +116,16 @@ struct _vbdisp_t {
VARIANT
props
[
1
];
};
typedef
struct
_ident_map_t
ident_map_t
;
typedef
struct
{
IDispatchEx
IDispatchEx_iface
;
LONG
ref
;
ident_map_t
*
ident_map
;
unsigned
ident_map_cnt
;
unsigned
ident_map_size
;
script_ctx_t
*
ctx
;
}
ScriptDisp
;
...
...
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