From 47be73ecdecb26c8f7a61cb3883c000a17336c09 Mon Sep 17 00:00:00 2001 From: Louis Lenders Date: Tue, 24 Aug 2010 11:48:01 +0200 Subject: mscoree\tests: added some simple tests for GetCORVersion --- configure | 1 + configure.ac | 1 + dlls/mscoree/tests/Makefile.in | 10 +++++ dlls/mscoree/tests/mscoree.c | 73 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 0 deletions(-) create mode 100644 dlls/mscoree/tests/Makefile.in create mode 100644 dlls/mscoree/tests/mscoree.c diff --git a/configure b/configure index 22fe16f..4af0be7 100755 --- a/configure +++ b/configure @@ -14640,6 +14640,7 @@ wine_fn_config_dll mscat32 enable_mscat32 wine_fn_config_dll mscms enable_mscms mscms wine_fn_config_test dlls/mscms/tests mscms_test wine_fn_config_dll mscoree enable_mscoree +wine_fn_config_test dlls/mscoree/tests mscoree_test wine_fn_config_dll msctf enable_msctf wine_fn_config_test dlls/msctf/tests msctf_test wine_fn_config_dll msdaps enable_msdaps diff --git a/configure.ac b/configure.ac index 5b8a199..34e6060 100644 --- a/configure.ac +++ b/configure.ac @@ -2479,6 +2479,7 @@ WINE_CONFIG_DLL(mscat32) WINE_CONFIG_DLL(mscms,,[mscms]) WINE_CONFIG_TEST(dlls/mscms/tests) WINE_CONFIG_DLL(mscoree) +WINE_CONFIG_TEST(dlls/mscoree/tests) WINE_CONFIG_DLL(msctf) WINE_CONFIG_TEST(dlls/msctf/tests) WINE_CONFIG_DLL(msdaps) diff --git a/dlls/mscoree/tests/Makefile.in b/dlls/mscoree/tests/Makefile.in new file mode 100644 index 0000000..3d05117 --- /dev/null +++ b/dlls/mscoree/tests/Makefile.in @@ -0,0 +1,10 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = mscoree.dll +IMPORTS = + +C_SRCS = \ + mscoree.c +@MAKE_TEST_RULES@ diff --git a/dlls/mscoree/tests/mscoree.c b/dlls/mscoree/tests/mscoree.c new file mode 100644 index 0000000..4775739 --- /dev/null +++ b/dlls/mscoree/tests/mscoree.c @@ -0,0 +1,73 @@ +/* + * Copyright 2010 Louis Lenders + * + * 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 + */ + +#include "wine/test.h" + +static HMODULE hmscoree; + +static HRESULT (WINAPI *pGetCORVersion)(LPWSTR, DWORD, DWORD*); + +static BOOL init_functionpointers(void) +{ + hmscoree = LoadLibraryA("mscoree.dll"); + + if (!hmscoree) + { + win_skip("mscoree.dll not available\n"); + return FALSE; + } + + pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion"); + + if (!pGetCORVersion) + { + win_skip("functions not available\n"); + FreeLibrary(hmscoree); + return FALSE; + } + + return TRUE; +} + +static void test_versioninfo(void) +{ + WCHAR version[MAX_PATH]; + DWORD size; + HRESULT hr; + + hr = pGetCORVersion(NULL, MAX_PATH, &size); + todo_wine ok(hr == E_POINTER,"GetCORVersion returned %08x\n", hr); + + hr = pGetCORVersion(version, 1, &size); + todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),"GetCORVersion returned %08x\n", hr); + + hr = pGetCORVersion(version, MAX_PATH, &size); + ok(hr == S_OK,"GetCORVersion returned %08x\n", hr); + + trace("latest installed .net runtime: %s\n", wine_dbgstr_w(version)); +} + +START_TEST(mscoree) +{ + if (!init_functionpointers()) + return; + + test_versioninfo(); + + FreeLibrary(hmscoree); +} -- 1.7.0.4