Commit 56827432 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

mscoree: Implement ICorDebug SetManagedHandler.

parent 197f867f
......@@ -40,16 +40,15 @@
WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
static inline RuntimeHost *impl_from_ICorDebug( ICorDebug *iface )
static inline CorDebug *impl_from_ICorDebug( ICorDebug *iface )
{
return CONTAINING_RECORD(iface, RuntimeHost, ICorDebug_iface);
return CONTAINING_RECORD(iface, CorDebug, ICorDebug_iface);
}
/*** IUnknown methods ***/
static HRESULT WINAPI CorDebug_QueryInterface(ICorDebug *iface, REFIID riid, void **ppvObject)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
......@@ -71,41 +70,85 @@ static HRESULT WINAPI CorDebug_QueryInterface(ICorDebug *iface, REFIID riid, voi
static ULONG WINAPI CorDebug_AddRef(ICorDebug *iface)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
return ICorRuntimeHost_AddRef(&This->ICorRuntimeHost_iface);
CorDebug *This = impl_from_ICorDebug( iface );
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p ref=%u\n", This, ref);
return ref;
}
static ULONG WINAPI CorDebug_Release(ICorDebug *iface)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
return ICorRuntimeHost_Release(&This->ICorRuntimeHost_iface);
CorDebug *This = impl_from_ICorDebug( iface );
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p ref=%u\n", This, ref);
if (ref == 0)
{
if(This->runtimehost)
ICLRRuntimeHost_Release(This->runtimehost);
if(This->pCallback)
ICorDebugManagedCallback2_Release(This->pCallback2);
if(This->pCallback)
ICorDebugManagedCallback_Release(This->pCallback);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/*** ICorDebug methods ***/
static HRESULT WINAPI CorDebug_Initialize(ICorDebug *iface)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p\n", This);
return S_OK;
}
static HRESULT WINAPI CorDebug_Terminate(ICorDebug *iface)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI CorDebug_SetManagedHandler(ICorDebug *iface, ICorDebugManagedCallback *pCallback)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
FIXME("stub %p %p\n", This, pCallback);
return E_NOTIMPL;
CorDebug *This = impl_from_ICorDebug( iface );
HRESULT hr;
ICorDebugManagedCallback2 *pCallback2;
TRACE("%p (%p)\n", This, pCallback);
if(!pCallback)
return E_INVALIDARG;
hr = ICorDebugManagedCallback_QueryInterface(pCallback, &IID_ICorDebugManagedCallback2, (void**)&pCallback2);
if(hr == S_OK)
{
if(This->pCallback2)
ICorDebugManagedCallback2_Release(This->pCallback2);
if(This->pCallback)
ICorDebugManagedCallback_Release(This->pCallback);
This->pCallback = pCallback;
This->pCallback2 = pCallback2;
ICorDebugManagedCallback_AddRef(This->pCallback);
}
return hr;
}
static HRESULT WINAPI CorDebug_SetUnmanagedHandler(ICorDebug *iface, ICorDebugUnmanagedCallback *pCallback)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p %p\n", This, pCallback);
return E_NOTIMPL;
}
......@@ -117,7 +160,7 @@ static HRESULT WINAPI CorDebug_CreateProcess(ICorDebug *iface, LPCWSTR lpApplica
LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation,
CorDebugCreateProcessFlags debuggingFlags, ICorDebugProcess **ppProcess)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p %s %s %p %p %d %d %p %s %p %p %d %p\n", This, debugstr_w(lpApplicationName),
debugstr_w(lpCommandLine), lpProcessAttributes, lpThreadAttributes,
bInheritHandles, dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory),
......@@ -128,21 +171,21 @@ static HRESULT WINAPI CorDebug_CreateProcess(ICorDebug *iface, LPCWSTR lpApplica
static HRESULT WINAPI CorDebug_DebugActiveProcess(ICorDebug *iface, DWORD id, BOOL win32Attach,
ICorDebugProcess **ppProcess)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p %d %d %p\n", This, id, win32Attach, ppProcess);
return E_NOTIMPL;
}
static HRESULT WINAPI CorDebug_EnumerateProcesses( ICorDebug *iface, ICorDebugProcessEnum **ppProcess)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p %p\n", This, ppProcess);
return E_NOTIMPL;
}
static HRESULT WINAPI CorDebug_GetProcess(ICorDebug *iface, DWORD dwProcessId, ICorDebugProcess **ppProcess)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p %d %p\n", This, dwProcessId, ppProcess);
return E_NOTIMPL;
}
......@@ -150,7 +193,7 @@ static HRESULT WINAPI CorDebug_GetProcess(ICorDebug *iface, DWORD dwProcessId, I
static HRESULT WINAPI CorDebug_CanLaunchOrAttach(ICorDebug *iface, DWORD dwProcessId,
BOOL win32DebuggingEnabled)
{
RuntimeHost *This = impl_from_ICorDebug( iface );
CorDebug *This = impl_from_ICorDebug( iface );
FIXME("stub %p %d %d\n", This, dwProcessId, win32DebuggingEnabled);
return E_NOTIMPL;
}
......@@ -171,7 +214,24 @@ static const struct ICorDebugVtbl cordebug_vtbl =
CorDebug_CanLaunchOrAttach
};
void cordebug_init(RuntimeHost *This)
HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown** ppUnk)
{
CorDebug *This;
This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
if ( !This )
return E_OUTOFMEMORY;
This->ICorDebug_iface.lpVtbl = &cordebug_vtbl;
This->ref = 1;
This->pCallback = NULL;
This->pCallback2 = NULL;
This->runtimehost = runtimehost;
if(This->runtimehost)
ICLRRuntimeHost_AddRef(This->runtimehost);
*ppUnk = (IUnknown*)This;
return S_OK;
}
......@@ -787,8 +787,6 @@ HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version,
This->ICorRuntimeHost_iface.lpVtbl = &corruntimehost_vtbl;
This->ICLRRuntimeHost_iface.lpVtbl = &CLRHostVtbl;
cordebug_init(This);
This->ref = 1;
This->version = runtime_version;
This->mono = loaded_mono;
......@@ -826,8 +824,9 @@ HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid,
}
else if (IsEqualGUID(clsid, &CLSID_CLRDebuggingLegacy))
{
unk = (IUnknown*)&This->ICorDebug_iface;
IUnknown_AddRef(unk);
hr = CorDebug_Create(&This->ICLRRuntimeHost_iface, &unk);
if (FAILED(hr))
return hr;
}
else
unk = NULL;
......
......@@ -64,7 +64,6 @@ struct RuntimeHost
{
ICorRuntimeHost ICorRuntimeHost_iface;
ICLRRuntimeHost ICLRRuntimeHost_iface;
ICorDebug ICorDebug_iface;
const CLRRuntimeInfo *version;
loaded_mono *mono;
struct list domains;
......@@ -73,6 +72,18 @@ struct RuntimeHost
LONG ref;
};
typedef struct CorDebug
{
ICorDebug ICorDebug_iface;
LONG ref;
ICLRRuntimeHost *runtimehost;
/* ICorDebug Callback */
ICorDebugManagedCallback *pCallback;
ICorDebugManagedCallback2 *pCallback2;
} CorDebug;
extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result) DECLSPEC_HIDDEN;
......@@ -161,6 +172,6 @@ extern HRESULT RuntimeHost_Destroy(RuntimeHost *This) DECLSPEC_HIDDEN;
HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface, LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime) DECLSPEC_HIDDEN;
extern void cordebug_init(RuntimeHost *This) DECLSPEC_HIDDEN;
extern HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown** ppUnk) DECLSPEC_HIDDEN;
#endif /* __MSCOREE_PRIVATE__ */
TESTDLL = mscoree.dll
IMPORTS = shlwapi
IMPORTS = ole32 shlwapi uuid
C_SRCS = \
debugging.c \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment