C_SRCS = \
assembly.c \
config.c \
+ cordebug.c \
corruntimehost.c \
metadata.c \
metahost.c \
#include "winver.h"
#include "dbghelp.h"
#include "ole2.h"
+#include "mscoree.h"
#include "corhdr.h"
#include "metahost.h"
+#include "cordebug.h"
#include "wine/list.h"
#include "mscoree_private.h"
#include "winreg.h"
#include "ole2.h"
#include "msxml2.h"
+#include "mscoree.h"
+#include "corhdr.h"
#include "metahost.h"
+#include "cordebug.h"
#include "wine/list.h"
#include "mscoree_private.h"
#include "shlwapi.h"
--- /dev/null
+/*
+ *
+ * Copyright 2011 Alistair Leslie-Hughes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+
+#include "winuser.h"
+#include "winnls.h"
+#include "winreg.h"
+#include "ole2.h"
+#include "shellapi.h"
+#include "mscoree.h"
+#include "corhdr.h"
+#include "metahost.h"
+#include "cordebug.h"
+#include "wine/list.h"
+#include "mscoree_private.h"
+#include "wine/debug.h"
+
+
+WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
+
+
+static inline RuntimeHost *impl_from_ICorDebug( ICorDebug *iface )
+{
+ return CONTAINING_RECORD(iface, RuntimeHost, ICorDebug_iface);
+}
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI CorDebug_QueryInterface(ICorDebug *iface, REFIID riid, void **ppvObject)
+{
+ RuntimeHost *This = impl_from_ICorDebug( iface );
+
+ TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
+
+ if ( IsEqualGUID( riid, &IID_ICorDebug ) ||
+ IsEqualGUID( riid, &IID_IUnknown ) )
+ {
+ *ppvObject = &This->ICorDebug_iface;
+ }
+ else
+ {
+ FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
+ }
+
+ ICorDebug_AddRef( iface );
+
+ return S_OK;
+}
+
+static ULONG WINAPI CorDebug_AddRef(ICorDebug *iface)
+{
+ RuntimeHost *This = impl_from_ICorDebug( iface );
+ return ICorRuntimeHost_AddRef(&This->ICorRuntimeHost_iface);
+}
+
+static ULONG WINAPI CorDebug_Release(ICorDebug *iface)
+{
+ RuntimeHost *This = impl_from_ICorDebug( iface );
+ return ICorRuntimeHost_Release(&This->ICorRuntimeHost_iface);
+}
+
+/*** ICorDebug methods ***/
+static HRESULT WINAPI CorDebug_Initialize(ICorDebug *iface)
+{
+ RuntimeHost *This = impl_from_ICorDebug( iface );
+ FIXME("stub %p\n", This);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CorDebug_Terminate(ICorDebug *iface)
+{
+ RuntimeHost *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;
+}
+
+static HRESULT WINAPI CorDebug_SetUnmanagedHandler(ICorDebug *iface, ICorDebugUnmanagedCallback *pCallback)
+{
+ RuntimeHost *This = impl_from_ICorDebug( iface );
+ FIXME("stub %p %p\n", This, pCallback);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CorDebug_CreateProcess(ICorDebug *iface, LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles,
+ DWORD dwCreationFlags, PVOID lpEnvironment,LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation,
+ CorDebugCreateProcessFlags debuggingFlags, ICorDebugProcess **ppProcess)
+{
+ RuntimeHost *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),
+ lpStartupInfo, lpProcessInformation, debuggingFlags, ppProcess);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CorDebug_DebugActiveProcess(ICorDebug *iface, DWORD id, BOOL win32Attach,
+ ICorDebugProcess **ppProcess)
+{
+ RuntimeHost *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 );
+ 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 );
+ FIXME("stub %p %d %p\n", This, dwProcessId, ppProcess);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CorDebug_CanLaunchOrAttach(ICorDebug *iface, DWORD dwProcessId,
+ BOOL win32DebuggingEnabled)
+{
+ RuntimeHost *This = impl_from_ICorDebug( iface );
+ FIXME("stub %p %d %d\n", This, dwProcessId, win32DebuggingEnabled);
+ return E_NOTIMPL;
+}
+
+static const struct ICorDebugVtbl cordebug_vtbl =
+{
+ CorDebug_QueryInterface,
+ CorDebug_AddRef,
+ CorDebug_Release,
+ CorDebug_Initialize,
+ CorDebug_Terminate,
+ CorDebug_SetManagedHandler,
+ CorDebug_SetUnmanagedHandler,
+ CorDebug_CreateProcess,
+ CorDebug_DebugActiveProcess,
+ CorDebug_EnumerateProcesses,
+ CorDebug_GetProcess,
+ CorDebug_CanLaunchOrAttach
+};
+
+void cordebug_init(RuntimeHost *This)
+{
+ This->ICorDebug_iface.lpVtbl = &cordebug_vtbl;
+}
#include "cor.h"
#include "mscoree.h"
#include "metahost.h"
+#include "corhdr.h"
+#include "cordebug.h"
#include "wine/list.h"
#include "mscoree_private.h"
DEFINE_GUID(IID__AppDomain, 0x05f696dc,0x2b29,0x3663,0xad,0x8b,0xc4,0x38,0x9c,0xf2,0xa7,0x13);
-struct RuntimeHost
-{
- ICorRuntimeHost ICorRuntimeHost_iface;
- ICLRRuntimeHost ICLRRuntimeHost_iface;
- const CLRRuntimeInfo *version;
- loaded_mono *mono;
- struct list domains;
- MonoDomain *default_domain;
- CRITICAL_SECTION lock;
- LONG ref;
-};
-
struct DomainEntry
{
struct list entry;
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;
if (FAILED(hr))
return hr;
}
+ else if (IsEqualGUID(clsid, &CLSID_CLRDebuggingLegacy))
+ {
+ unk = (IUnknown*)&This->ICorDebug_iface;
+ IUnknown_AddRef(unk);
+ }
else
unk = NULL;
#include "winbase.h"
#include "winreg.h"
#include "ole2.h"
-
#include "cor.h"
+#include "mscoree.h"
+#include "corhdr.h"
+#include "cordebug.h"
#include "metahost.h"
#include "wine/list.h"
#include "mscoree_private.h"
#include "ole2.h"
#include "corerror.h"
+#include "cor.h"
#include "mscoree.h"
-#include "fusion.h"
+#include "corhdr.h"
+#include "cordebug.h"
#include "metahost.h"
+#include "fusion.h"
#include "wine/list.h"
#include "mscoree_private.h"
return FALSE;
}
-static HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
+HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
{
int i;
#include "initguid.h"
#include "msxml2.h"
-#include "cor.h"
#include "corerror.h"
+#include "cor.h"
#include "mscoree.h"
-#include "fusion.h"
+#include "corhdr.h"
+#include "cordebug.h"
#include "metahost.h"
+#include "fusion.h"
#include "wine/list.h"
#include "mscoree_private.h"
return E_NOTIMPL;
}
-HRESULT WINAPI CreateDebuggingInterfaceFromVersion(int nDebugVersion, LPCWSTR version, IUnknown **ppIUnk)
+HRESULT WINAPI CreateDebuggingInterfaceFromVersion(int nDebugVersion, LPCWSTR version, IUnknown **ppv)
{
- FIXME("(%d %s, %p): stub\n", nDebugVersion, debugstr_w(version), ppIUnk);
- return E_NOTIMPL;
+ const WCHAR v2_0[] = {'v','2','.','0','.','5','0','7','2','7',0};
+ HRESULT hr = E_FAIL;
+ ICLRRuntimeInfo *runtimeinfo;
+
+ if(nDebugVersion < 1 || nDebugVersion > 4)
+ return E_INVALIDARG;
+
+ TRACE("(%d %s, %p): stub\n", nDebugVersion, debugstr_w(version), ppv);
+
+ if(!ppv)
+ return E_INVALIDARG;
+
+ *ppv = NULL;
+
+ if(strcmpW(version, v2_0) != 0)
+ {
+ FIXME("Currently .NET Version '%s' not support.\n", debugstr_w(version));
+ return E_INVALIDARG;
+ }
+
+ if(nDebugVersion != 3)
+ return E_INVALIDARG;
+
+ hr = CLRMetaHost_GetRuntime(0, version, &IID_ICLRRuntimeInfo, (void**)&runtimeinfo);
+ if(hr == S_OK)
+ {
+ hr = ICLRRuntimeInfo_GetInterface(runtimeinfo, &CLSID_CLRDebuggingLegacy, &IID_ICorDebug, (void**)ppv);
+
+ ICLRRuntimeInfo_Release(runtimeinfo);
+ }
+
+ if(!*ppv)
+ return E_FAIL;
+
+ return hr;
}
HRESULT WINAPI CLRCreateInstance(REFCLSID clsid, REFIID riid, LPVOID *ppInterface)
HRESULT assembly_release(ASSEMBLY *assembly) DECLSPEC_HIDDEN;
HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version) DECLSPEC_HIDDEN;
+/* Mono embedding */
+typedef struct _MonoDomain MonoDomain;
+typedef struct _MonoAssembly MonoAssembly;
+typedef struct _MonoAssemblyName MonoAssemblyName;
+typedef struct _MonoType MonoType;
+typedef struct _MonoImage MonoImage;
+typedef struct _MonoClass MonoClass;
+typedef struct _MonoObject MonoObject;
+typedef struct _MonoMethod MonoMethod;
+typedef struct _MonoProfiler MonoProfiler;
+
+typedef struct loaded_mono loaded_mono;
typedef struct RuntimeHost RuntimeHost;
typedef struct CLRRuntimeInfo
struct RuntimeHost *loaded_runtime;
} CLRRuntimeInfo;
+struct RuntimeHost
+{
+ ICorRuntimeHost ICorRuntimeHost_iface;
+ ICLRRuntimeHost ICLRRuntimeHost_iface;
+ ICorDebug ICorDebug_iface;
+ const CLRRuntimeInfo *version;
+ loaded_mono *mono;
+ struct list domains;
+ MonoDomain *default_domain;
+ CRITICAL_SECTION lock;
+ LONG ref;
+};
+
extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result) DECLSPEC_HIDDEN;
extern void free_parsed_config_file(parsed_config_file *file) DECLSPEC_HIDDEN;
-/* Mono embedding */
-typedef struct _MonoDomain MonoDomain;
-typedef struct _MonoAssembly MonoAssembly;
-typedef struct _MonoAssemblyName MonoAssemblyName;
-typedef struct _MonoType MonoType;
-typedef struct _MonoImage MonoImage;
-typedef struct _MonoClass MonoClass;
-typedef struct _MonoObject MonoObject;
-typedef struct _MonoMethod MonoMethod;
-typedef struct _MonoProfiler MonoProfiler;
-
typedef enum {
MONO_IMAGE_OK,
MONO_IMAGE_ERROR_ERRNO,
typedef void (*MonoProfileFunc)(MonoProfiler *prof);
-typedef struct loaded_mono
+struct loaded_mono
{
HMODULE mono_handle;
HMODULE glib_handle;
void (CDECL *mono_thread_pool_cleanup)(void);
void (CDECL *mono_thread_suspend_all_other_threads)(void);
void (CDECL *mono_threads_set_shutting_down)(void);
-} loaded_mono;
+};
/* loaded runtime interfaces */
extern void unload_all_runtimes(void) DECLSPEC_HIDDEN;
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);
+
#endif /* __MSCOREE_PRIVATE__ */
IMPORTS = shlwapi
C_SRCS = \
+ debugging.c \
metahost.c \
mscoree.c
--- /dev/null
+/*
+ * Copyright 2011 Alistair Leslie-Hughes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include "windows.h"
+#include "ole2.h"
+#include "corerror.h"
+#include "mscoree.h"
+#include "corhdr.h"
+
+#include "wine/test.h"
+
+#include "initguid.h"
+#include "cordebug.h"
+
+static HMODULE hmscoree;
+
+static HRESULT (WINAPI *pCreateDebuggingInterfaceFromVersion)(int, LPCWSTR, IUnknown **);
+
+const WCHAR v2_0[] = {'v','2','.','0','.','5','0','7','2','7',0};
+
+static BOOL init_functionpointers(void)
+{
+ hmscoree = LoadLibraryA("mscoree.dll");
+
+ if (!hmscoree)
+ {
+ win_skip("mscoree.dll not available\n");
+ return FALSE;
+ }
+
+ pCreateDebuggingInterfaceFromVersion = (void *)GetProcAddress(hmscoree, "CreateDebuggingInterfaceFromVersion");
+
+ if (!pCreateDebuggingInterfaceFromVersion)
+ {
+ win_skip("functions not available\n");
+ FreeLibrary(hmscoree);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void test_createDebugger(void)
+{
+ HRESULT hr;
+ IUnknown *pUnk;
+ ICorDebug *pCorDebug;
+
+ hr = pCreateDebuggingInterfaceFromVersion(0, v2_0, &pUnk);
+ ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
+
+ hr = pCreateDebuggingInterfaceFromVersion(1, v2_0, &pUnk);
+ ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
+
+ hr = pCreateDebuggingInterfaceFromVersion(2, v2_0, &pUnk);
+ ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
+
+ hr = pCreateDebuggingInterfaceFromVersion(4, v2_0, &pUnk);
+ ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
+
+ hr = pCreateDebuggingInterfaceFromVersion(3, v2_0, NULL);
+ ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
+
+ hr = pCreateDebuggingInterfaceFromVersion(3, v2_0, &pUnk);
+ if(hr == S_OK)
+ {
+ hr = IUnknown_QueryInterface(pUnk, &IID_ICorDebug, (void**)&pCorDebug);
+ todo_wine ok(hr == S_OK, "expected S_OK got %08x\n", hr);
+ if(hr == S_OK)
+ {
+ ICorDebug_Release(pCorDebug);
+ }
+ IUnknown_Release(pUnk);
+ }
+ else
+ {
+ skip(".NET 2.0 or mono not installed.\n");
+ }
+}
+
+START_TEST(debugging)
+{
+ if (!init_functionpointers())
+ return;
+
+ test_createDebugger();
+
+ FreeLibrary(hmscoree);
+}
import "unknwn.idl";
import "objidl.idl";
+cpp_quote("#ifdef WINE_NO_UNICODE_MACROS")
+cpp_quote("#undef CreateProcess")
+cpp_quote("#endif")
+
interface ICorDebugAppDomain;
interface ICorDebugAppDomainEnum;
interface ICorDebugAssembly;
interface ICorDebugStepperEnum;
interface ICorDebugThreadEnum;
interface ICorDebugUnmanagedCallback;
+interface ICorDebugValue;
interface ICorDebugValueBreakpoint;
CallbackThreadSetFnPtr pfnCallbackThreadSet,
CallbackThreadUnsetFnPtr pfnCallbackThreadUnset);
+cpp_quote("DEFINE_GUID(CLSID_CLRDebuggingLegacy, 0xDF8395B5,0xA4BA,0x450b,0xA7,0x7C,0xA9,0xA4,0x77,0x62,0xC5,0x20);")
cpp_quote("DEFINE_GUID(CLSID_CLRMetaHost, 0x9280188d,0x0e8e,0x4867,0xb3,0x0c,0x7f,0xa8,0x38,0x84,0xe8,0xde);")
[