From 261bc3859ff9b0747dda592a1f8722264371677b Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Mon, 19 Apr 2010 00:45:17 +0200 Subject: [PATCH] shlwapi/tests: Add initial test for SHGetThreadRef. --- dlls/shlwapi/tests/Makefile.in | 1 + dlls/shlwapi/tests/thread.c | 66 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 dlls/shlwapi/tests/thread.c diff --git a/dlls/shlwapi/tests/Makefile.in b/dlls/shlwapi/tests/Makefile.in index 585607c4f03..038d76cb399 100644 --- a/dlls/shlwapi/tests/Makefile.in +++ b/dlls/shlwapi/tests/Makefile.in @@ -15,6 +15,7 @@ C_SRCS = \ path.c \ shreg.c \ string.c \ + thread.c \ url.c @MAKE_TEST_RULES@ diff --git a/dlls/shlwapi/tests/thread.c b/dlls/shlwapi/tests/thread.c new file mode 100644 index 00000000000..b34560422a9 --- /dev/null +++ b/dlls/shlwapi/tests/thread.c @@ -0,0 +1,66 @@ +/* Tests for Thread and SHGlobalCounter functions + * + * Copyright 2010 Detlef Riekenberg + * + * 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 +#include + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "ole2.h" +#include "shlwapi.h" + +#include "wine/test.h" + +static HRESULT (WINAPI *pSHGetThreadRef)(IUnknown**); + +/* ##### */ + +static void test_SHGetThreadRef(void) +{ + IUnknown *punk; + HRESULT hr; + + /* Not present before IE 5 */ + if (!pSHGetThreadRef) { + win_skip("SHGetThreadRef not found\n"); + return; + } + + punk = NULL; + hr = pSHGetThreadRef(&punk); + ok( (hr == E_NOINTERFACE) && (punk == NULL), + "got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk); + + if (0) { + /* this crash on Windows */ + hr = pSHGetThreadRef(NULL); + } +} + +START_TEST(thread) +{ + HMODULE hshlwapi = GetModuleHandleA("shlwapi.dll"); + + pSHGetThreadRef = (void *) GetProcAddress(hshlwapi, "SHGetThreadRef"); + + test_SHGetThreadRef(); + +} -- 2.11.4.GIT