mscoree: Improve GetCORVersion.
[wine.git] / dlls / mscoree / tests / mscoree.c
blobba1e9383174c847aa7c26a596fcc289892c5ef74
1 /*
2 * Copyright 2010 Louis Lenders
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
19 #include "wine/test.h"
21 static HMODULE hmscoree;
23 static HRESULT (WINAPI *pGetCORVersion)(LPWSTR, DWORD, DWORD*);
25 static BOOL init_functionpointers(void)
27 hmscoree = LoadLibraryA("mscoree.dll");
29 if (!hmscoree)
31 win_skip("mscoree.dll not available\n");
32 return FALSE;
35 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
37 if (!pGetCORVersion)
39 win_skip("functions not available\n");
40 FreeLibrary(hmscoree);
41 return FALSE;
44 return TRUE;
47 static void test_versioninfo(void)
49 WCHAR version[MAX_PATH];
50 DWORD size;
51 HRESULT hr;
53 hr = pGetCORVersion(NULL, MAX_PATH, &size);
54 ok(hr == E_POINTER,"GetCORVersion returned %08x\n", hr);
56 hr = pGetCORVersion(version, 1, &size);
57 ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),"GetCORVersion returned %08x\n", hr);
59 hr = pGetCORVersion(version, MAX_PATH, &size);
60 ok(hr == S_OK,"GetCORVersion returned %08x\n", hr);
62 trace("latest installed .net runtime: %s\n", wine_dbgstr_w(version));
65 START_TEST(mscoree)
67 if (!init_functionpointers())
68 return;
70 test_versioninfo();
72 FreeLibrary(hmscoree);