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
d54b8007
Commit
d54b8007
authored
Sep 26, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Oct 05, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscoree: Implement ICLRRuntimeInfo_GetInterface.
parent
0d1c6875
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
157 additions
and
26 deletions
+157
-26
corruntimehost.c
dlls/mscoree/corruntimehost.c
+64
-14
metahost.c
dlls/mscoree/metahost.c
+61
-12
mscoree_main.c
dlls/mscoree/mscoree_main.c
+1
-0
mscoree_private.h
dlls/mscoree/mscoree_private.h
+29
-0
mscoree.idl
include/mscoree.idl
+2
-0
No files found.
dlls/mscoree/corruntimehost.c
View file @
d54b8007
...
...
@@ -29,20 +29,24 @@
#include "cor.h"
#include "mscoree.h"
#include "mscoree_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mscoree
);
typedef
struct
_corruntimeh
ost
struct
RuntimeH
ost
{
const
struct
ICorRuntimeHostVtbl
*
lpVtbl
;
const
CLRRuntimeInfo
*
version
;
const
loaded_mono
*
mono
;
LONG
ref
;
}
corruntimehost
;
BOOL
legacy
;
/* if True, this was created by create_corruntimehost, and Release frees it */
};
static
inline
corruntimeh
ost
*
impl_from_ICorRuntimeHost
(
ICorRuntimeHost
*
iface
)
static
inline
RuntimeH
ost
*
impl_from_ICorRuntimeHost
(
ICorRuntimeHost
*
iface
)
{
return
(
corruntimehost
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
corruntimeh
ost
,
lpVtbl
));
return
(
RuntimeHost
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
RuntimeH
ost
,
lpVtbl
));
}
/*** IUnknown methods ***/
...
...
@@ -50,7 +54,7 @@ static HRESULT WINAPI corruntimehost_QueryInterface(ICorRuntimeHost* iface,
REFIID
riid
,
void
**
ppvObject
)
{
corruntimeh
ost
*
This
=
impl_from_ICorRuntimeHost
(
iface
);
RuntimeH
ost
*
This
=
impl_from_ICorRuntimeHost
(
iface
);
TRACE
(
"%p %s %p
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObject
);
if
(
IsEqualGUID
(
riid
,
&
IID_ICorRuntimeHost
)
||
...
...
@@ -71,19 +75,19 @@ static HRESULT WINAPI corruntimehost_QueryInterface(ICorRuntimeHost* iface,
static
ULONG
WINAPI
corruntimehost_AddRef
(
ICorRuntimeHost
*
iface
)
{
corruntimeh
ost
*
This
=
impl_from_ICorRuntimeHost
(
iface
);
RuntimeH
ost
*
This
=
impl_from_ICorRuntimeHost
(
iface
);
return
InterlockedIncrement
(
&
This
->
ref
);
}
static
ULONG
WINAPI
corruntimehost_Release
(
ICorRuntimeHost
*
iface
)
{
corruntimeh
ost
*
This
=
impl_from_ICorRuntimeHost
(
iface
);
RuntimeH
ost
*
This
=
impl_from_ICorRuntimeHost
(
iface
);
ULONG
ref
;
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
if
(
ref
==
0
&&
This
->
legacy
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
RuntimeHost_Destroy
(
This
);
}
return
ref
;
...
...
@@ -271,18 +275,64 @@ static const struct ICorRuntimeHostVtbl corruntimehost_vtbl =
corruntimehost_CurrentDomain
};
IUnknown
*
create_corruntimehost
(
void
)
HRESULT
RuntimeHost_Construct
(
const
CLRRuntimeInfo
*
runtime_version
,
const
loaded_mono
*
loaded_mono
,
RuntimeHost
**
result
)
{
corruntimeh
ost
*
This
;
RuntimeH
ost
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
*
This
);
if
(
!
This
)
return
NULL
;
return
E_OUTOFMEMORY
;
This
->
lpVtbl
=
&
corruntimehost_vtbl
;
This
->
ref
=
1
;
This
->
version
=
runtime_version
;
This
->
mono
=
loaded_mono
;
This
->
legacy
=
FALSE
;
return
S_OK
;
}
HRESULT
RuntimeHost_GetInterface
(
RuntimeHost
*
This
,
REFCLSID
clsid
,
REFIID
riid
,
void
**
ppv
)
{
IUnknown
*
unk
;
if
(
IsEqualGUID
(
clsid
,
&
CLSID_CorRuntimeHost
))
unk
=
(
IUnknown
*
)
&
This
->
lpVtbl
;
else
unk
=
NULL
;
if
(
unk
)
return
IUnknown_QueryInterface
(
unk
,
riid
,
ppv
);
else
FIXME
(
"not implemented for class %s
\n
"
,
debugstr_guid
(
clsid
));
return
CLASS_E_CLASSNOTAVAILABLE
;
}
HRESULT
RuntimeHost_Destroy
(
RuntimeHost
*
This
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
S_OK
;
}
IUnknown
*
create_corruntimehost
(
void
)
{
RuntimeHost
*
This
;
IUnknown
*
result
;
if
(
FAILED
(
RuntimeHost_Construct
(
NULL
,
NULL
,
&
This
)))
return
NULL
;
This
->
legacy
=
TRUE
;
if
(
FAILED
(
RuntimeHost_GetInterface
(
This
,
&
CLSID_CorRuntimeHost
,
&
IID_IUnknown
,
(
void
**
)
&
result
)))
{
RuntimeHost_Destroy
(
This
);
return
NULL
;
}
FIXME
(
"return iface %p
\n
"
,
This
);
FIXME
(
"return iface %p
\n
"
,
result
);
return
(
IUnknown
*
)
&
This
->
lpVtbl
;
return
result
;
}
dlls/mscoree/metahost.c
View file @
d54b8007
...
...
@@ -43,16 +43,6 @@ static const WCHAR net_11_subdir[] = {'1','.','0',0};
static
const
WCHAR
net_20_subdir
[]
=
{
'2'
,
'.'
,
'0'
,
0
};
static
const
WCHAR
net_40_subdir
[]
=
{
'4'
,
'.'
,
'0'
,
0
};
struct
CLRRuntimeInfo
{
const
struct
ICLRRuntimeInfoVtbl
*
ICLRRuntimeInfo_vtbl
;
LPCWSTR
mono_libdir
;
DWORD
major
;
DWORD
minor
;
DWORD
build
;
int
mono_abi_version
;
};
const
struct
ICLRRuntimeInfoVtbl
CLRRuntimeInfoVtbl
;
#define NUM_RUNTIMES 3
...
...
@@ -75,6 +65,53 @@ static CRITICAL_SECTION_DEBUG runtime_list_cs_debug =
};
static
CRITICAL_SECTION
runtime_list_cs
=
{
&
runtime_list_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
HRESULT
load_mono
(
CLRRuntimeInfo
*
This
,
loaded_mono
**
result
)
{
/* FIXME: stub */
*
result
=
NULL
;
return
S_OK
;
}
static
HRESULT
CLRRuntimeInfo_GetRuntimeHost
(
CLRRuntimeInfo
*
This
,
RuntimeHost
**
result
)
{
HRESULT
hr
=
S_OK
;
loaded_mono
*
ploaded_mono
;
if
(
This
->
loaded_runtime
)
{
*
result
=
This
->
loaded_runtime
;
return
hr
;
}
EnterCriticalSection
(
&
runtime_list_cs
);
if
(
!
This
->
loaded_runtime
)
goto
end
;
hr
=
load_mono
(
This
,
&
ploaded_mono
);
if
(
SUCCEEDED
(
hr
))
hr
=
RuntimeHost_Construct
(
This
,
ploaded_mono
,
&
This
->
loaded_runtime
);
end:
LeaveCriticalSection
(
&
runtime_list_cs
);
if
(
SUCCEEDED
(
hr
))
*
result
=
This
->
loaded_runtime
;
return
hr
;
}
void
unload_all_runtimes
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
NUM_RUNTIMES
;
i
++
)
if
(
runtimes
[
i
].
loaded_runtime
)
RuntimeHost_Destroy
(
runtimes
[
i
].
loaded_runtime
);
}
static
HRESULT
WINAPI
CLRRuntimeInfo_QueryInterface
(
ICLRRuntimeInfo
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
...
...
@@ -178,9 +215,18 @@ static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress(ICLRRuntimeInfo* iface,
static
HRESULT
WINAPI
CLRRuntimeInfo_GetInterface
(
ICLRRuntimeInfo
*
iface
,
REFCLSID
rclsid
,
REFIID
riid
,
LPVOID
*
ppUnk
)
{
FIXME
(
"%p %s %s %p
\n
"
,
iface
,
debugstr_guid
(
rclsid
),
debugstr_guid
(
riid
),
ppUnk
);
struct
CLRRuntimeInfo
*
This
=
(
struct
CLRRuntimeInfo
*
)
iface
;
RuntimeHost
*
host
;
HRESULT
hr
;
return
E_NOTIMPL
;
TRACE
(
"%p %s %s %p
\n
"
,
iface
,
debugstr_guid
(
rclsid
),
debugstr_guid
(
riid
),
ppUnk
);
hr
=
CLRRuntimeInfo_GetRuntimeHost
(
This
,
&
host
);
if
(
SUCCEEDED
(
hr
))
hr
=
RuntimeHost_GetInterface
(
host
,
rclsid
,
riid
,
ppUnk
);
return
hr
;
}
static
HRESULT
WINAPI
CLRRuntimeInfo_IsLoadable
(
ICLRRuntimeInfo
*
iface
,
...
...
@@ -404,6 +450,9 @@ static void find_runtimes(void)
{
runtimes
[
i
].
mono_abi_version
=
abi_version
;
strcpyW
(
runtimes
[
i
].
mono_path
,
mono_path
);
strcpyW
(
runtimes
[
i
].
mscorlib_path
,
lib_path
);
any_runtimes_found
=
TRUE
;
}
}
...
...
dlls/mscoree/mscoree_main.c
View file @
d54b8007
...
...
@@ -343,6 +343,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
DisableThreadLibraryCalls
(
hinstDLL
);
break
;
case
DLL_PROCESS_DETACH
:
unload_all_runtimes
();
break
;
}
return
TRUE
;
...
...
dlls/mscoree/mscoree_private.h
View file @
d54b8007
...
...
@@ -30,6 +30,21 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file);
HRESULT
assembly_release
(
ASSEMBLY
*
assembly
);
HRESULT
assembly_get_runtime_version
(
ASSEMBLY
*
assembly
,
LPSTR
*
version
);
typedef
struct
RuntimeHost
RuntimeHost
;
typedef
struct
CLRRuntimeInfo
{
const
struct
ICLRRuntimeInfoVtbl
*
ICLRRuntimeInfo_vtbl
;
LPCWSTR
mono_libdir
;
DWORD
major
;
DWORD
minor
;
DWORD
build
;
int
mono_abi_version
;
WCHAR
mono_path
[
MAX_PATH
];
WCHAR
mscorlib_path
[
MAX_PATH
];
struct
RuntimeHost
*
loaded_runtime
;
}
CLRRuntimeInfo
;
/* Mono 2.6 embedding */
typedef
struct
_MonoDomain
MonoDomain
;
typedef
struct
_MonoAssembly
MonoAssembly
;
...
...
@@ -44,4 +59,18 @@ extern MonoDomain* (*mono_jit_init)(const char *file);
extern
int
(
*
mono_jit_set_trace_options
)(
const
char
*
options
);
extern
void
(
*
mono_set_dirs
)(
const
char
*
assembly_dir
,
const
char
*
config_dir
);
typedef
struct
loaded_mono
{
}
loaded_mono
;
/* loaded runtime interfaces */
extern
void
unload_all_runtimes
(
void
);
extern
HRESULT
RuntimeHost_Construct
(
const
CLRRuntimeInfo
*
runtime_version
,
const
loaded_mono
*
loaded_mono
,
RuntimeHost
**
result
);
extern
HRESULT
RuntimeHost_GetInterface
(
RuntimeHost
*
This
,
REFCLSID
clsid
,
REFIID
riid
,
void
**
ppv
);
extern
HRESULT
RuntimeHost_Destroy
(
RuntimeHost
*
This
);
#endif
/* __MSCOREE_PRIVATE__ */
include/mscoree.idl
View file @
d54b8007
...
...
@@ -131,6 +131,8 @@ interface IHostControl : IUnknown
[
in
]
IUnknown
*
appDomainManager
)
;
}
cpp_quote
(
"DEFINE_GUID(CLSID_CorRuntimeHost, 0xcb2f6723,0xab3a,0x11d2,0x9c,0x40,0x00,0xc0,0x4f,0xa3,0x0a,0x3e);"
)
[
uuid
(
CB2F6722
-
AB3A
-
11
d2
-
9
C40
-
00
C04FA30A3E
),
version
(
1.0
),
...
...
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