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
7e83d413
Commit
7e83d413
authored
Jul 07, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msscript.ocx: Added support for IDispatch functions.
parent
3981205c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
10 deletions
+107
-10
Makefile.in
dlls/msscript.ocx/Makefile.in
+1
-0
msscript.c
dlls/msscript.ocx/msscript.c
+106
-10
No files found.
dlls/msscript.ocx/Makefile.in
View file @
7e83d413
MODULE
=
msscript.ocx
RC_SRCS
=
msscript.rc
IDL_SRCS
=
msscript.idl
IMPORTS
=
oleaut32
C_SRCS
=
\
msscript.c
dlls/msscript.ocx/msscript.c
View file @
7e83d413
...
...
@@ -45,6 +45,75 @@ static inline BOOL heap_free(void *mem)
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
typedef
enum
tid_t
{
IScriptControl_tid
,
LAST_tid
}
tid_t
;
static
ITypeLib
*
typelib
;
static
ITypeInfo
*
typeinfos
[
LAST_tid
];
static
REFIID
tid_ids
[]
=
{
&
IID_IScriptControl
};
static
HRESULT
load_typelib
(
void
)
{
HRESULT
hres
;
ITypeLib
*
tl
;
hres
=
LoadRegTypeLib
(
&
LIBID_MSScriptControl
,
1
,
0
,
LOCALE_SYSTEM_DEFAULT
,
&
tl
);
if
(
FAILED
(
hres
))
{
ERR
(
"LoadRegTypeLib failed: %08x
\n
"
,
hres
);
return
hres
;
}
if
(
InterlockedCompareExchangePointer
((
void
**
)
&
typelib
,
tl
,
NULL
))
ITypeLib_Release
(
tl
);
return
hres
;
}
static
HRESULT
get_typeinfo
(
tid_t
tid
,
ITypeInfo
**
typeinfo
)
{
HRESULT
hres
;
if
(
!
typelib
)
hres
=
load_typelib
();
if
(
!
typelib
)
return
hres
;
if
(
!
typeinfos
[
tid
])
{
ITypeInfo
*
ti
;
hres
=
ITypeLib_GetTypeInfoOfGuid
(
typelib
,
tid_ids
[
tid
],
&
ti
);
if
(
FAILED
(
hres
))
{
ERR
(
"GetTypeInfoOfGuid(%s) failed: %08x
\n
"
,
debugstr_guid
(
tid_ids
[
tid
]),
hres
);
return
hres
;
}
if
(
InterlockedCompareExchangePointer
((
void
**
)(
typeinfos
+
tid
),
ti
,
NULL
))
ITypeInfo_Release
(
ti
);
}
*
typeinfo
=
typeinfos
[
tid
];
ITypeInfo_AddRef
(
typeinfos
[
tid
]);
return
S_OK
;
}
static
void
release_typelib
(
void
)
{
unsigned
i
;
if
(
!
typelib
)
return
;
for
(
i
=
0
;
i
<
sizeof
(
typeinfos
)
/
sizeof
(
*
typeinfos
);
i
++
)
if
(
typeinfos
[
i
])
ITypeInfo_Release
(
typeinfos
[
i
]);
ITypeLib_Release
(
typelib
);
}
static
inline
ScriptControl
*
impl_from_IScriptControl
(
IScriptControl
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
ScriptControl
,
IScriptControl_iface
);
...
...
@@ -99,24 +168,35 @@ static ULONG WINAPI ScriptControl_Release(IScriptControl *iface)
static
HRESULT
WINAPI
ScriptControl_GetTypeInfoCount
(
IScriptControl
*
iface
,
UINT
*
pctinfo
)
{
ScriptControl
*
This
=
impl_from_IScriptControl
(
iface
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pctinfo
);
*
pctinfo
=
1
;
return
S_OK
;
}
static
HRESULT
WINAPI
ScriptControl_GetTypeInfo
(
IScriptControl
*
iface
,
UINT
iTInfo
,
LCID
lcid
,
ITypeInfo
**
ppTInfo
)
{
ScriptControl
*
This
=
impl_from_IScriptControl
(
iface
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%u %u %p)
\n
"
,
This
,
iTInfo
,
lcid
,
ppTInfo
);
return
get_typeinfo
(
IScriptControl_tid
,
ppTInfo
)
;
}
static
HRESULT
WINAPI
ScriptControl_GetIDsOfNames
(
IScriptControl
*
iface
,
REFIID
riid
,
LPOLESTR
*
rgszNames
,
UINT
cNames
,
LCID
lcid
,
DISPID
*
rgDispId
)
{
ScriptControl
*
This
=
impl_from_IScriptControl
(
iface
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
ITypeInfo
*
typeinfo
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s %p %u %u %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
rgszNames
,
cNames
,
lcid
,
rgDispId
);
hres
=
get_typeinfo
(
IScriptControl_tid
,
&
typeinfo
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
ITypeInfo_GetIDsOfNames
(
typeinfo
,
rgszNames
,
cNames
,
rgDispId
);
ITypeInfo_Release
(
typeinfo
);
}
return
hres
;
}
static
HRESULT
WINAPI
ScriptControl_Invoke
(
IScriptControl
*
iface
,
DISPID
dispIdMember
,
...
...
@@ -124,8 +204,20 @@ static HRESULT WINAPI ScriptControl_Invoke(IScriptControl *iface, DISPID dispIdM
EXCEPINFO
*
pExcepInfo
,
UINT
*
puArgErr
)
{
ScriptControl
*
This
=
impl_from_IScriptControl
(
iface
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
ITypeInfo
*
typeinfo
;
HRESULT
hres
;
TRACE
(
"(%p)->(%d %s %d %d %p %p %p %p)
\n
"
,
This
,
dispIdMember
,
debugstr_guid
(
riid
),
lcid
,
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
hres
=
get_typeinfo
(
IScriptControl_tid
,
&
typeinfo
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
ITypeInfo_Invoke
(
typeinfo
,
iface
,
dispIdMember
,
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
ITypeInfo_Release
(
typeinfo
);
}
return
hres
;
}
static
HRESULT
WINAPI
ScriptControl_get_Language
(
IScriptControl
*
iface
,
BSTR
*
p
)
...
...
@@ -344,9 +436,9 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
/******************************************************************
* DllMain (msscript.ocx.@)
*/
BOOL
WINAPI
DllMain
(
HINSTANCE
instance
,
DWORD
reason
,
LPVOID
lpv
)
BOOL
WINAPI
DllMain
(
HINSTANCE
instance
,
DWORD
reason
,
void
*
reserved
)
{
TRACE
(
"(%p %d %p)
\n
"
,
instance
,
reason
,
lpv
);
TRACE
(
"(%p %d %p)
\n
"
,
instance
,
reason
,
reserved
);
switch
(
reason
)
{
case
DLL_WINE_PREATTACH
:
...
...
@@ -355,6 +447,10 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID lpv)
msscript_instance
=
instance
;
DisableThreadLibraryCalls
(
instance
);
break
;
case
DLL_PROCESS_DETACH
:
if
(
!
reserved
)
release_typelib
();
break
;
}
return
TRUE
;
...
...
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