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*);
24 static HRESULT (WINAPI *pGetCORSystemDirectory)(LPWSTR, DWORD, DWORD*);
26 static BOOL init_functionpointers(void)
28 hmscoree = LoadLibraryA("mscoree.dll");
32 win_skip("mscoree.dll not available\n");
36 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
37 pGetCORSystemDirectory = (void *)GetProcAddress(hmscoree, "GetCORSystemDirectory");
38 if (!pGetCORVersion || !pGetCORSystemDirectory)
40 win_skip("functions not available\n");
41 FreeLibrary(hmscoree);
48 static void test_versioninfo(void)
50 WCHAR version[MAX_PATH];
55 hr = pGetCORVersion(NULL, MAX_PATH, &size);
56 ok(hr == E_POINTER,"GetCORVersion returned %08x\n", hr);
58 hr = pGetCORVersion(version, 1, &size);
59 ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),"GetCORVersion returned %08x\n", hr);
61 hr = pGetCORVersion(version, MAX_PATH, &size);
62 ok(hr == S_OK,"GetCORVersion returned %08x\n", hr);
64 trace("latest installed .net runtime: %s\n", wine_dbgstr_w(version));
66 hr = pGetCORSystemDirectory(path, MAX_PATH , &size);
67 ok(hr == S_OK, "GetCORSystemDirectory returned %08x\n", hr);
68 /* size includes terminating null-character */
69 ok(size == (lstrlenW(path) + 1),"size is %d instead of %d\n", size, (lstrlenW(path) + 1));
73 hr = pGetCORSystemDirectory(path, path_len-1 , &size);
74 ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), "GetCORSystemDirectory returned %08x\n", hr);
76 hr = pGetCORSystemDirectory(NULL, MAX_PATH , &size);
77 ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), "GetCORSystemDirectory returned %08x\n", hr);
79 hr = pGetCORSystemDirectory(path, MAX_PATH , NULL);
80 ok(hr == E_POINTER,"GetCORSystemDirectory returned %08x\n", hr);
82 trace("latest installed .net installed in directory: %s\n", wine_dbgstr_w(path));
87 if (!init_functionpointers())
92 FreeLibrary(hmscoree);