2 * Copyright 2011 Alistair Leslie-Hughes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/test.h"
32 static HMODULE hmscoree;
34 static HRESULT (WINAPI *pCreateDebuggingInterfaceFromVersion)(int, LPCWSTR, IUnknown **);
36 const WCHAR v2_0[] = {'v','2','.','0','.','5','0','7','2','7',0};
38 static BOOL init_functionpointers(void)
40 hmscoree = LoadLibraryA("mscoree.dll");
44 win_skip("mscoree.dll not available\n");
48 pCreateDebuggingInterfaceFromVersion = (void *)GetProcAddress(hmscoree, "CreateDebuggingInterfaceFromVersion");
50 if (!pCreateDebuggingInterfaceFromVersion)
52 win_skip("functions not available\n");
53 FreeLibrary(hmscoree);
60 static void test_createDebugger(void)
66 hr = pCreateDebuggingInterfaceFromVersion(0, v2_0, &pUnk);
67 ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
69 hr = pCreateDebuggingInterfaceFromVersion(1, v2_0, &pUnk);
70 ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
72 hr = pCreateDebuggingInterfaceFromVersion(2, v2_0, &pUnk);
73 ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
75 hr = pCreateDebuggingInterfaceFromVersion(4, v2_0, &pUnk);
76 ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
78 hr = pCreateDebuggingInterfaceFromVersion(3, v2_0, NULL);
79 ok(hr == E_INVALIDARG, "CreateDebuggingInterfaceFromVersion returned %08x\n", hr);
81 hr = pCreateDebuggingInterfaceFromVersion(3, v2_0, &pUnk);
84 hr = IUnknown_QueryInterface(pUnk, &IID_ICorDebug, (void**)&pCorDebug);
85 todo_wine ok(hr == S_OK, "expected S_OK got %08x\n", hr);
88 ICorDebug_Release(pCorDebug);
90 IUnknown_Release(pUnk);
94 skip(".NET 2.0 or mono not installed.\n");
100 if (!init_functionpointers())
103 test_createDebugger();
105 FreeLibrary(hmscoree);